<SyntaxLanguage Key="Pascal" LanguageDefinitionVersion="4.0" Secure="True" xmlns="http://ActiproSoftware/SyntaxEditor/4.0/LanguageDefinition">

	<!-- String Properties -->
	<Properties>
		<Property Key="Creator" Value="Actipro Software LLC" />
		<Property Key="Copyright" Value="Copyright (c) 2001-2006 Actipro Software LLC.  All rights reserved." />
	</Properties>

	<!-- Highlighting Styles -->	
	<Styles>
		<Style Key="ReservedWordStyle" ForeColor="Blue" />
		<Style Key="OperatorStyle" ForeColor="Black" />
		<Style Key="NumberStyle" ForeColor="Purple" />
		<Style Key="StringDelimiterStyle" ForeColor="Maroon" />
		<Style Key="StringDefaultStyle" ForeColor="Maroon" />
		<Style Key="CommentDelimiterStyle" ForeColor="Green" />
		<Style Key="CommentDefaultStyle" ForeColor="Green" />
	</Styles>

	<!-- Macros -->
	<Macros>
		<!-- Redefine word macros to include hyphens -->
		<Macro Key="WordMacro" Value="[a-zA-Z0-9]" />
		<Macro Key="NonWordMacro" Value="[^a-zA-Z0-9]" />
	</Macros>

	<!-- States -->
	<States>
		<!-- Code -->
		<State Key="DefaultState">
			<!-- Patterns Groups -->
			<PatternGroups>
				<!-- Whitespace -->
				<RegexPatternGroup TokenKey="WhitespaceToken" PatternValue="{WhitespaceMacro}+" IsWhitespace="True" />
				<!-- Line Terminators -->
				<RegexPatternGroup TokenKey="LineTerminatorToken" PatternValue="{LineTerminatorMacro}" IsWhitespace="True" />
				<!-- Brackets -->
				<ExplicitPatternGroup Key="OpenParenthesisPatternGroup" TokenKey="OpenParenthesisToken" PatternValue="(" LookAhead="$|[^\*\.]" EndBracket="CloseParenthesisPatternGroup" />
				<ExplicitPatternGroup Key="CloseParenthesisPatternGroup" TokenKey="CloseParenthesisToken" PatternValue=")" StartBracket="OpenParenthesisPatternGroup" />
				<RegexPatternGroup Key="OpenSquareBracePatternGroup" TokenKey="OpenSquareBraceToken" PatternValue="\[ | (\(\.)" EndBracket="CloseSquareBracePatternGroup" />
				<RegexPatternGroup Key="CloseSquareBracePatternGroup" TokenKey="CloseSquareBraceToken" PatternValue="\] | (\.\))" StartBracket="OpenSquareBracePatternGroup" />
				<!-- Punctuation -->
				<ExplicitPatternGroup TokenKey="PunctuationToken">
					<ExplicitPatterns>
						.. . , : ; ^ @
					</ExplicitPatterns>
				</ExplicitPatternGroup>
				<!-- Reserved Words -->
				<ExplicitPatternGroup TokenKey="ReservedWordToken" Style="ReservedWordStyle" LookAhead="{NonWordMacro}|\z" CaseSensitivity="Sensitive">
					<ExplicitPatterns>
						and array begin case const div do downto else end file for
						function goto if in label mod nil not of or packed procedure
						program record repeat set then to type until var while with
					</ExplicitPatterns>
				</ExplicitPatternGroup>
				<!-- Identifier -->
				<RegexPatternGroup TokenKey="IdentifierToken" PatternValue="{AlphaMacro}({WordMacro})*" />
				<!-- Operators -->
				<ExplicitPatternGroup TokenKey="OperatorToken" Style="OperatorStyle">
					<ExplicitPatterns>
						+ - * / =
						&lt;&gt; &lt;= &lt; &gt;= &gt; := 
					</ExplicitPatterns>
				</ExplicitPatternGroup>
				<!-- Numbers -->
				<RegexPatternGroup TokenKey="RealNumberToken" Style="NumberStyle" LookAhead="{NonWordMacro}|\z">
					<RegexPattern Value="[\+\-]? {DigitMacro}+ \. {DigitMacro}+ (e [\+\-]? {DigitMacro}+)?" />
					<RegexPattern Value="[\+\-]? {DigitMacro}+ e [\+\-]? {DigitMacro}+" />
				</RegexPatternGroup>
				<RegexPatternGroup TokenKey="IntegerNumberToken" Style="NumberStyle" PatternValue="[\+\-]? {DigitMacro}+" LookAhead="{NonWordMacro}|\z" />
			</PatternGroups>
			<!-- Child States -->
			<ChildStates>
				<ChildState Key="StringState" />
				<ChildState Key="CommentState" />
			</ChildStates>
		</State>
		
		<!-- Strings -->
		<State Key="StringState" TokenKey="StringDefaultToken" Style="StringDefaultStyle">
			<!-- Scopes -->
			<Scopes>
				<Scope>
					<ExplicitPatternGroup Type="StartScope" TokenKey="StringStartToken" Style="StringDelimiterStyle" PatternValue="'" />
					<RegexPatternGroup Type="EndScope" TokenKey="StringEndToken" Style="StringDelimiterStyle" PatternValue="['\n]" />	
				</Scope>
			</Scopes>
			<!-- Patterns Groups -->
			<PatternGroups>
				<ExplicitPatternGroup TokenKey="StringEscapedCharacterToken" PatternValue="''" />
				<RegexPatternGroup TokenKey="StringDefaultToken" PatternValue="[^\'\n]+" />
			</PatternGroups>
		</State>

		<!-- Comments -->
		<State Key="CommentState" TokenKey="CommentDefaultToken" Style="CommentDefaultStyle">
			<!-- Scopes -->
			<Scopes>
				<Scope>
					<RegexPatternGroup Type="StartScope" TokenKey="CommentStartToken" Style="CommentDelimiterStyle" PatternValue="\{ | (\(\*)" />
					<RegexPatternGroup Type="EndScope" TokenKey="CommentStartToken" Style="CommentDelimiterStyle" PatternValue="\} | (\*\))" />
				</Scope>
			</Scopes>
			<!-- Patterns Groups -->
			<PatternGroups>
				<RegexPatternGroup TokenKey="CommentDefaultToken" PatternValue="[^\}\*]+" />
			</PatternGroups>
		</State>
		
	</States>

	<!-- Example Text -->
	<ExampleText>
		<![CDATA[
{ Sample Pascal Program }
program sample(output);
	var i : integer;

	procedure print(var j: integer);

		function next(k: integer): integer;
		begin
			next := k + 1
		end;

	begin
		writeln('The total is: ', j);
		j := next(j)
	end;

begin
	i := 1;
	while i <= 10 do print(i)
end.
]]>
	</ExampleText>
		
</SyntaxLanguage>
