diff options
| author | Georg Brandl <georg@python.org> | 2021-01-18 21:24:00 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2021-01-18 22:08:36 +0100 |
| commit | 2a3d3a7d5b9c60dedf6638d876161d9563faebcf (patch) | |
| tree | 809c0b4a686db98f5954afa1944404cd9652c6b2 /tests/lexers/ebnf | |
| parent | f0445be718da83541ea3401aad882f3937147263 (diff) | |
| download | pygments-git-examplefiles.tar.gz | |
Move test_examplefiles to new tests/lexers scheme.examplefiles
Diffstat (limited to 'tests/lexers/ebnf')
| -rw-r--r-- | tests/lexers/ebnf/example.txt | 521 |
1 files changed, 521 insertions, 0 deletions
diff --git a/tests/lexers/ebnf/example.txt b/tests/lexers/ebnf/example.txt new file mode 100644 index 00000000..e3400bd7 --- /dev/null +++ b/tests/lexers/ebnf/example.txt @@ -0,0 +1,521 @@ +---input--- +letter = "A" | "B" | "C" | "D" | "E" | "F" | "G" + | "H" | "I" | "J" | "K" | "L" | "M" | "N" + | "O" | "P" | "Q" | "R" | "S" | "T" | "U" + | "V" | "W" | "X" | "Y" | "Z" ; +digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ; +symbol = "[" | "]" | "{" | "}" | "(" | ")" | "<" | ">" + | "'" | '"' | "=" | "|" | "." | "," | ";" ; +character = letter | digit | symbol | " " ; + +identifier = letter , { letter | digit | " " } ; +terminal = "'" , character , { character } , "'" + | '"' , character , { character } , '"' ; + +special = "?" , any , "?" ; + +comment = (* this is a comment "" *) "(*" , any-symbol , "*)" ; +any-symbol = ? any visible character ? ; (* ? ... ? *) + +lhs = identifier ; +rhs = identifier + | terminal + | comment , rhs + | rhs , comment + | "[" , rhs , "]" + | "{" , rhs , "}" + | "(" , rhs , ")" + | rhs , "|" , rhs + | rhs , "," , rhs ; + +rule = lhs , "=" , rhs , ";" | comment ; +grammar = { rule } ; + +---tokens--- +'letter ' Keyword +'=' Operator +' ' Text +'"A"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"B"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"C"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"D"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"E"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"F"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"G"' Literal.String.Double +'\n ' Text +'|' Punctuation +' ' Text +'"H"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"I"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"J"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"K"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"L"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"M"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"N"' Literal.String.Double +'\n ' Text +'|' Punctuation +' ' Text +'"O"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"P"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"Q"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"R"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"S"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"T"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"U"' Literal.String.Double +'\n ' Text +'|' Punctuation +' ' Text +'"V"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"W"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"X"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"Y"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"Z"' Literal.String.Double +' ' Text +';' Punctuation +'\n' Text + +'digit ' Keyword +'=' Operator +' ' Text +'"0"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"1"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"2"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"3"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"4"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"5"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"6"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"7"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"8"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"9"' Literal.String.Double +' ' Text +';' Punctuation +'\n' Text + +'symbol ' Keyword +'=' Operator +' ' Text +'"["' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"]"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"{"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"}"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"("' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'")"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"<"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'">"' Literal.String.Double +'\n ' Text +'|' Punctuation +' ' Text +'"\'"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'\'"\'' Literal.String.Single +' ' Text +'|' Punctuation +' ' Text +'"="' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"|"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'"."' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'","' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'";"' Literal.String.Double +' ' Text +';' Punctuation +'\n' Text + +'character ' Keyword +'=' Operator +' ' Text +'letter ' Keyword +'|' Punctuation +' ' Text +'digit ' Keyword +'|' Punctuation +' ' Text +'symbol ' Keyword +'|' Punctuation +' ' Text +'" "' Literal.String.Double +' ' Text +';' Punctuation +'\n\n' Text + +'identifier ' Keyword +'=' Operator +' ' Text +'letter ' Keyword +',' Punctuation +' ' Text +'{' Punctuation +' ' Text +'letter ' Keyword +'|' Punctuation +' ' Text +'digit ' Keyword +'|' Punctuation +' ' Text +'" "' Literal.String.Double +' ' Text +'}' Punctuation +' ' Text +';' Punctuation +'\n' Text + +'terminal ' Keyword +'=' Operator +' ' Text +'"\'"' Literal.String.Double +' ' Text +',' Punctuation +' ' Text +'character ' Keyword +',' Punctuation +' ' Text +'{' Punctuation +' ' Text +'character ' Keyword +'}' Punctuation +' ' Text +',' Punctuation +' ' Text +'"\'"' Literal.String.Double +'\n ' Text +'|' Punctuation +' ' Text +'\'"\'' Literal.String.Single +' ' Text +',' Punctuation +' ' Text +'character ' Keyword +',' Punctuation +' ' Text +'{' Punctuation +' ' Text +'character ' Keyword +'}' Punctuation +' ' Text +',' Punctuation +' ' Text +'\'"\'' Literal.String.Single +' ' Text +';' Punctuation +'\n\n' Text + +'special ' Keyword +'=' Operator +' ' Text +'"?"' Literal.String.Double +' ' Text +',' Punctuation +' ' Text +'any ' Keyword +',' Punctuation +' ' Text +'"?"' Literal.String.Double +' ' Text +';' Punctuation +'\n\n' Text + +'comment ' Keyword +'=' Operator +' ' Text +'(*' Comment.Multiline +' ' Comment.Multiline +'t' Comment.Multiline +'h' Comment.Multiline +'i' Comment.Multiline +'s' Comment.Multiline +' ' Comment.Multiline +'i' Comment.Multiline +'s' Comment.Multiline +' ' Comment.Multiline +'a' Comment.Multiline +' ' Comment.Multiline +'c' Comment.Multiline +'o' Comment.Multiline +'m' Comment.Multiline +'m' Comment.Multiline +'e' Comment.Multiline +'n' Comment.Multiline +'t' Comment.Multiline +' ' Comment.Multiline +'"' Comment.Multiline +'"' Comment.Multiline +' ' Comment.Multiline +'*)' Comment.Multiline +' ' Text +'"(*"' Literal.String.Double +' ' Text +',' Punctuation +' ' Text +'any-symbol ' Keyword +',' Punctuation +' ' Text +'"*)"' Literal.String.Double +' ' Text +';' Punctuation +'\n' Text + +'any-symbol ' Keyword +'=' Operator +' ' Text +'? any visible character ?' Name.Entity +' ' Text +';' Punctuation +' ' Text +'(*' Comment.Multiline +' ' Comment.Multiline +'?' Comment.Multiline +' ' Comment.Multiline +'.' Comment.Multiline +'.' Comment.Multiline +'.' Comment.Multiline +' ' Comment.Multiline +'?' Comment.Multiline +' ' Comment.Multiline +'*)' Comment.Multiline +'\n\n' Text + +'lhs ' Keyword +'=' Operator +' ' Text +'identifier ' Keyword +';' Punctuation +'\n' Text + +'rhs ' Keyword +'=' Operator +' ' Text +'identifier' Keyword +'\n ' Text +'|' Punctuation +' ' Text +'terminal' Keyword +'\n ' Text +'|' Punctuation +' ' Text +'comment ' Keyword +',' Punctuation +' ' Text +'rhs' Keyword +'\n ' Text +'|' Punctuation +' ' Text +'rhs ' Keyword +',' Punctuation +' ' Text +'comment' Keyword +'\n ' Text +'|' Punctuation +' ' Text +'"["' Literal.String.Double +' ' Text +',' Punctuation +' ' Text +'rhs ' Keyword +',' Punctuation +' ' Text +'"]"' Literal.String.Double +'\n ' Text +'|' Punctuation +' ' Text +'"{"' Literal.String.Double +' ' Text +',' Punctuation +' ' Text +'rhs ' Keyword +',' Punctuation +' ' Text +'"}"' Literal.String.Double +'\n ' Text +'|' Punctuation +' ' Text +'"("' Literal.String.Double +' ' Text +',' Punctuation +' ' Text +'rhs ' Keyword +',' Punctuation +' ' Text +'")"' Literal.String.Double +'\n ' Text +'|' Punctuation +' ' Text +'rhs ' Keyword +',' Punctuation +' ' Text +'"|"' Literal.String.Double +' ' Text +',' Punctuation +' ' Text +'rhs' Keyword +'\n ' Text +'|' Punctuation +' ' Text +'rhs ' Keyword +',' Punctuation +' ' Text +'","' Literal.String.Double +' ' Text +',' Punctuation +' ' Text +'rhs ' Keyword +';' Punctuation +'\n\n' Text + +'rule ' Keyword +'=' Operator +' ' Text +'lhs ' Keyword +',' Punctuation +' ' Text +'"="' Literal.String.Double +' ' Text +',' Punctuation +' ' Text +'rhs ' Keyword +',' Punctuation +' ' Text +'";"' Literal.String.Double +' ' Text +'|' Punctuation +' ' Text +'comment ' Keyword +';' Punctuation +'\n' Text + +'grammar ' Keyword +'=' Operator +' ' Text +'{' Punctuation +' ' Text +'rule ' Keyword +'}' Punctuation +' ' Text +';' Punctuation +'\n' Text |
