Commit 1c3e2ecb authored by Taddeüs Kroes's avatar Taddeüs Kroes

Added some support for xross-browser compatibility hacks

parent 9f135688
...@@ -25,7 +25,7 @@ let unicode = '\\' h(h(h(h(h(h)?)?)?)?)? wc? ...@@ -25,7 +25,7 @@ let unicode = '\\' h(h(h(h(h(h)?)?)?)?)? wc?
let escape = unicode | '\\'[^'\r' '\n' '\012' '0'-'9' 'a'-'f' 'A'-'F'] let escape = unicode | '\\'[^'\r' '\n' '\012' '0'-'9' 'a'-'f' 'A'-'F']
let nmstart = ['_' 'a'-'z' 'A'-'Z'] | nonascii | escape let nmstart = ['_' 'a'-'z' 'A'-'Z'] | nonascii | escape
let nmchar = ['_' 'a'-'z' 'A'-'Z' '0'-'9' '-'] | nonascii | escape let nmchar = ['_' 'a'-'z' 'A'-'Z' '0'-'9' '-'] | nonascii | escape
let string1 = '"'([^'\n' '\r' '\012' '"'] | '\\'nl | escape)*'"' let string1 = '"' ([^'\n' '\r' '\012' '"'] | '\\'nl | escape)* '"'
let string2 = '\'' ([^'\n' '\r' '\012' '\''] | '\\' nl | escape)* '\'' let string2 = '\'' ([^'\n' '\r' '\012' '\''] | '\\' nl | escape)* '\''
let mystring = string1 | string2 let mystring = string1 | string2
let badstring1 = '"' ([^'\n' '\r' '\012' '"'] | '\\'nl | escape)* '\\'? let badstring1 = '"' ([^'\n' '\r' '\012' '"'] | '\\'nl | escape)* '\\'?
...@@ -71,6 +71,8 @@ let X = ['x' 'X'] ...@@ -71,6 +71,8 @@ let X = ['x' 'X']
let Y = ['y' 'Y'] let Y = ['y' 'Y']
let Z = ['z' 'Z'] let Z = ['z' 'Z']
let uagent = ('-' ("webkit" | "moz" | "ms" | "o") '-')?
rule token = parse rule token = parse
| s { S } | s { S }
...@@ -88,14 +90,14 @@ rule token = parse ...@@ -88,14 +90,14 @@ rule token = parse
| '#' (name as nm) { HASH nm } | '#' (name as nm) { HASH nm }
| '@' I M P O R T { IMPORT_SYM } | '@' I M P O R T { IMPORT_SYM }
| '@' P A G E { PAGE_SYM } | '@' P A G E { PAGE_SYM }
| '@' M E D I A { MEDIA_SYM } | '@' M E D I A { MEDIA_SYM }
| "@charset " { CHARSET_SYM } | "@charset " { CHARSET_SYM }
| '@' F O N T '-' F A C E { FONT_FACE_SYM } | '@' F O N T '-' F A C E { FONT_FACE_SYM }
| '@' N A M E S P A C E { NAMESPACE_SYM } | '@' N A M E S P A C E { NAMESPACE_SYM }
| '@' K E Y F R A M E S { KEYFRAMES_SYM } | '@' uagent K E Y F R A M E S { KEYFRAMES_SYM }
| '@' S U P P O R T S { SUPPORTS_SYM } | '@' S U P P O R T S { SUPPORTS_SYM }
| (w | comment)* w A N D w (w | comment)* { SUPPORTS_AND } | (w | comment)* w A N D w (w | comment)* { SUPPORTS_AND }
| (w | comment)* w O R w (w | comment)* { SUPPORTS_OR } | (w | comment)* w O R w (w | comment)* { SUPPORTS_OR }
...@@ -141,4 +143,5 @@ rule token = parse ...@@ -141,4 +143,5 @@ rule token = parse
| eof | '\000' { EOF } | eof | '\000' { EOF }
| _ { token lexbuf }
| _ as c { raise (SyntaxError ("unexpected '" ^ Char.escaped c ^ "'")) } | _ as c { raise (SyntaxError ("unexpected '" ^ Char.escaped c ^ "'")) }
...@@ -251,7 +251,9 @@ pseudo: ...@@ -251,7 +251,9 @@ pseudo:
declaration: declaration:
| name=property S* COLON S* value=expr important=boption(ig2(IMPORTANT_SYM, S*)) | name=property S* COLON S* value=expr important=boption(ig2(IMPORTANT_SYM, S*))
{ (String.lowercase name, value, important) } { (String.lowercase name, value, important) }
%inline property: name=IDENT { name } %inline property:
| name=IDENT { name }
| STAR name=IDENT { "*" ^ name } (* IE7 property name hack *)
expr: expr:
| l=exprl { concat_terms l } | l=exprl { concat_terms l }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment