Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. Production rules for lexical tokens
  2. ===================================
  3.  
  4. This file provides a complete set of production rules for the tokens generated
  5. by the lexer. In case of ambiguity, the longest match wins.
  6.  
  7. Components
  8. ----------
  9.  
  10. ident      ::= '-'? nmstart nmchar*
  11. name       ::= nmchar+
  12. nmstart    ::= [a-zA-Z] | '_' | nonascii | escape
  13. nonascii   ::= [#x80-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF]
  14. unicode    ::= '\' [0-9a-fA-F]{1,6} wc?
  15. escape     ::= unicode | '\' [^\n\r\f0-9a-fA-F]
  16. nmchar     ::= [a-zA-Z0-9] | '-' | '_' | nonascii | escape
  17. num        ::= [-+]? ([0-9]+ | [0-9]* '.' [0-9]+)
  18. string     ::= '"' (stringchar | "'")* '"' | "'" (stringchar | '"')* "'"
  19. stringchar ::= urlchar | #x20 | #x29 | '\' nl
  20. urlchar    ::= [#x9#x21#x23-#x26#x28#x2A-#x7E] | nonascii | escape
  21. nl         ::= #xA | #xD #xA | #xD | #xC
  22. w          ::= wc*
  23. wc         ::= #x9 | #xA | #xC | #xD | #x20
  24.  
  25. Tokens
  26. ------
  27.  
  28. IDENT          ::= ident
  29. ATKEYWORD      ::= '@' ident
  30. STRING         ::= string
  31. INVALID_STRING ::= '"' (stringchar | "'")* [^"] | "'" (stringchar | '"')* [^']
  32. HASH           ::= '#' name
  33. NUMBER         ::= num
  34. PERCENTAGE     ::= num '%'
  35. DIMENSION      ::= num ident
  36. URI            ::= "url(" w (string | urlchar*) w ')'
  37. UNICODE-RANGE  ::= [Uu] '+' [0-9a-fA-F?]{1,6} ('-' [0-9a-fA-F]{1,6})?
  38. CDO            ::= "<!--"
  39. CDC            ::= "-->"
  40. S              ::= wc+
  41. COMMENT        ::= "/*" [^*]* '*'+ ([^/] [^*]* '*'+) '/'
  42. FUNCTION       ::= ident '('
  43. INCLUDES       ::= "~="
  44. DASHMATCH      ::= "|="
  45. PREFIXMATCH    ::= "^="
  46. SUFFIXMATCH    ::= "$="
  47. SUBSTRINGMATCH ::= "*="
  48. CHAR           ::= any other character, except " or '
  49.  
  50. Differences from the CSS3 Syntax module specification
  51. -----------------------------------------------------
  52.  
  53. 1) UNICODE-RANGE is case insensitive (it's uppercase only in the spec)
  54. 2) escape follows CSS2.1. CSS3 defines it as:
  55.    escape ::= unicode | '\' [#x20-#x7E#x80-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF]
  56. 3) urlchar omits ' and ):
  57.    a) If ' is permitted verbatim then, as stringchar inherits from urlchar,
  58.       single quoted strings may contain verbatim single quotes. This is
  59.       clearly nonsense.
  60.    b) If ) is permitted verbatim then it becomes impossible to determine the
  61.       true end of URI. Thus, for sanity's sake, it's omitted here.
  62. 4) stringchar explicitly includes ). See 3(b) for why it won't inherit it
  63.    from urlchar as the spec implies.
  64. 5) BOM ::= #xFEFF is omitted. It is assumed that any leading BOM will be
  65.    stripped from the document before lexing occurs.
  66.  
  67.