summaryrefslogtreecommitdiff
path: root/tests/examplefiles/test.ebnf
diff options
context:
space:
mode:
authorBryan Davis <bd808@bd808.com>2013-04-25 22:54:55 -0600
committerBryan Davis <bd808@bd808.com>2013-04-25 22:54:55 -0600
commit4641268f11100113420b27d0fd7465c9c43e814b (patch)
tree88e169210f9c2a4a4ef7c0cb25b74256fef7f902 /tests/examplefiles/test.ebnf
parent690efaf0304427ab5ab023c67b27459beccc4b15 (diff)
downloadpygments-4641268f11100113420b27d0fd7465c9c43e814b.tar.gz
Lexer for ISO/IEC 14977 EBNF grammars.
A regex based lexer for EBNF as defined in http://www.cl.cam.ac.uk/~mgk25/iso-14977.pdf Related to issue #805.
Diffstat (limited to 'tests/examplefiles/test.ebnf')
-rw-r--r--tests/examplefiles/test.ebnf31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/examplefiles/test.ebnf b/tests/examplefiles/test.ebnf
new file mode 100644
index 00000000..a96171b0
--- /dev/null
+++ b/tests/examplefiles/test.ebnf
@@ -0,0 +1,31 @@
+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 } ;