123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- lexique logoPlayer_lexique {
- # Identifiers and keywords
- @string tokenString
- style keywordsStyle -> "Keywords"
- $identifier$ ! tokenString error message "an identifier"
- #--- This is the keyword list
- list keyWordList style keywordsStyle error message "the '%K' keyword" {
- "PROGRAM",
- "ROUTINE",
- "BEGIN",
- "END",
- "FORWARD",
- "ROTATE",
- "PEN",
- "UP",
- "DOWN",
- "CALL"
- }
- rule 'a'->'z' | 'A'->'Z' {
- repeat
- enterCharacterIntoString (!?tokenString !*)
- while 'a'->'z' | 'A'->'Z' | '_' | '0'->'9' :
- end
- send search tokenString in keyWordList default $identifier$
- }
- # Literal decimal integers
- style integerStyle -> "Integer Constants"
- @uint uint32value
- $integer$ !uint32value style integerStyle error message "a 32-bit unsigned decimal number"
- message decimalNumberTooLarge : "decimal number too large"
- message internalError : "internal error"
- rule '0'->'9' {
- enterCharacterIntoString (!?tokenString !*)
- repeat
- while '0'->'9' :
- enterCharacterIntoString (!?tokenString !*)
- while '_' :
- end
- convertDecimalStringIntoUInt (
- !tokenString
- !?uint32value
- error decimalNumberTooLarge, internalError
- )
- send $integer$
- }
- # Delimiters
- style delimitersStyle -> "Delimiters"
- list delimitorsList style delimitersStyle error message "the '%K' delimitor" {
- ";", "."
- }
- rule list delimitorsList
- # Comments
- style commentStyle -> "Comments"
- $comment$ style commentStyle %nonAtomicSelection error message "a comment"
- rule '#' {
- repeat
- while '\u0001' -> '\u0009' | '\u000B' | '\u000C' | '\u000E' -> '\uFFFD' :
- end
- drop $comment$
- }
- # Separators
- rule '\u0001' -> ' ' {
- }
- }
|