logoPlayer-lexique.galgas 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. lexique logoPlayer_lexique {
  2. # Identifiers and keywords
  3. @string tokenString
  4. style keywordsStyle -> "Keywords"
  5. $identifier$ ! tokenString error message "an identifier"
  6. #--- This is the keyword list
  7. list keyWordList style keywordsStyle error message "the '%K' keyword" {
  8. "PROGRAM",
  9. "ROUTINE",
  10. "BEGIN",
  11. "END",
  12. "FORWARD",
  13. "ROTATE",
  14. "PEN",
  15. "UP",
  16. "DOWN",
  17. "CALL"
  18. }
  19. rule 'a'->'z' | 'A'->'Z' {
  20. repeat
  21. enterCharacterIntoString (!?tokenString !*)
  22. while 'a'->'z' | 'A'->'Z' | '_' | '0'->'9' :
  23. end
  24. send search tokenString in keyWordList default $identifier$
  25. }
  26. # Literal decimal integers
  27. style integerStyle -> "Integer Constants"
  28. @uint uint32value
  29. $integer$ !uint32value style integerStyle error message "a 32-bit unsigned decimal number"
  30. message decimalNumberTooLarge : "decimal number too large"
  31. message internalError : "internal error"
  32. rule '0'->'9' {
  33. enterCharacterIntoString (!?tokenString !*)
  34. repeat
  35. while '0'->'9' :
  36. enterCharacterIntoString (!?tokenString !*)
  37. while '_' :
  38. end
  39. convertDecimalStringIntoUInt (
  40. !tokenString
  41. !?uint32value
  42. error decimalNumberTooLarge, internalError
  43. )
  44. send $integer$
  45. }
  46. # Delimiters
  47. style delimitersStyle -> "Delimiters"
  48. list delimitorsList style delimitersStyle error message "the '%K' delimitor" {
  49. ";", "."
  50. }
  51. rule list delimitorsList
  52. # Comments
  53. style commentStyle -> "Comments"
  54. $comment$ style commentStyle %nonAtomicSelection error message "a comment"
  55. rule '#' {
  56. repeat
  57. while '\u0001' -> '\u0009' | '\u000B' | '\u000C' | '\u000E' -> '\uFFFD' :
  58. end
  59. drop $comment$
  60. }
  61. # Separators
  62. rule '\u0001' -> ' ' {
  63. }
  64. }