; Syntax for lexer definition: ; A comment begins with a semicolon and extends to the end of the line. ; Define names for any strings used in the equations using ; thing = character class name, where "thing" can be a string or a name. ; Define tokens using regular expressions. After a regular expression, the ; name after "=>" is a token class name. ; Parentheses are used for grouping. Consecutive things, names, or expressions ; in parentheses are concatenated. ; "|" between expressions means "or." ; Postfix "^" means "Don't keep this character in the token." ; Postfix "-" means "Don't keep the previous character in the token." ; These can only appear after a thing or name, not after an ; expression in parentheses. ; Postfix "*" means "zero or more." ; Postfix "+" means "one or more." ; Postfix "?" means "zero or one." ; These can appear after a thing, name, or expression in parentheses, ; but not after a postfix "^" or "-". ; Prefix "~" means "not." This can only appear before a thing or name, not ; before an expression in parentheses. ~A | ~B actually means ~(A | B). ; That's not logically correct, but it would be a mess to enforce that ; in ~(A | B), A and B can only be single things, not expressions. ; Precedence (strongest to weakest): ; Prefix and postfix ; concatentation ; "or." ; Ampersand (&) or dollar sign ($) at the end of a line (with optional ; comment after) continues a specification onto the next line. Nothing ; other than a comment can appear after continuation. ; ============================================================================ ; Vocabulary: thing = character class name '_' = Under ';' = Cmt '.' = Dot ; Identifiers Letter ( Letter | Digit | '_' )* => Identifier ; Strings with Quote or Apostrophe included Apost ( ( Apost Apost- ) | ~ Apost )* Apost | & Quote ( ( Quote Quote- ) | ~ Quote )* Quote => String ; Incomplete strings with Quote or Apostrophe included Apost ( ( Apost Apost- ) | ~ Apost )* EOL^ | & Quote ( ( Quote Quote- ) | ~ Quote )* EOL^ => Incomplete ;Integers Digit+ => Int ; Operators Op_ch+ => Operator ; Punctuators Pun_ch | Dot => Punctuator ; Coordinate [1-5][A-I^H] digit letter => Coord ; Continuation with or without comment does not produce end-of-line ( Cont ( Blank ^ )* ( ';' ^ (~ EOL ^ )* )? EOL^ ) | & ( Blank ^ ) + => Skip ; Junk other than comment after continuation Cont ( Blank ^ )* ( ~ ';' ^ | ~ EOL ^ )+ => BadCont ; Comment and end-of-line ( ';' ^ (~ EOL ^ )* )? EOL^ => End_Of_Line ; End of file EOF^ => End_Of_File ; $RCSfile: Lexer_Table.lex,v $ ; $Id: Lexer_Table.lex,v 1.2 2022/01/23 09:45:18 vsnyder Exp $ ; $Log: Lexer_Table.lex,v $