15 |
} |
} |
16 |
|
|
17 |
%name parser |
%name parser |
18 |
%tokentype { Token } |
%tokentype { TokenPosn } |
19 |
%token |
%token |
20 |
INCLUDES { INCLUDES } |
INCLUDES { (INCLUDES , _) } |
21 |
DASHMATCH { DASHMATCH } |
DASHMATCH { (DASHMATCH , _) } |
22 |
LBRACE { LBRACE } |
LBRACE { (LBRACE , _) } |
23 |
PLUS { PLUS } |
PLUS { (PLUS , _) } |
24 |
GREATER { GREATER } |
GREATER { (GREATER , _) } |
25 |
COMMA { COMMA } |
COMMA { (COMMA , _) } |
26 |
STRING { STRING $$ } |
STRING { (STRING $$ , _) } |
27 |
IDENT { IDENT $$ } |
IDENT { (IDENT $$ , _) } |
28 |
HASH { HASH $$ } |
HASH { (HASH $$ , _) } |
29 |
IMPORT_SYM { IMPORT_SYM } |
IMPORT_SYM { (IMPORT_SYM , _) } |
30 |
PAGE_SYM { PAGE_SYM } |
PAGE_SYM { (PAGE_SYM , _) } |
31 |
MEDIA_SYM { MEDIA_SYM } |
MEDIA_SYM { (MEDIA_SYM , _) } |
32 |
CHARSET_SYM { CHARSET_SYM } |
CHARSET_SYM { (CHARSET_SYM , _) } |
33 |
IMPORTANT_SYM { IMPORTANT_SYM } |
IMPORTANT_SYM { (IMPORTANT_SYM, _) } |
34 |
EMS { EMS $$ } |
EMS { (EMS $$ , _) } |
35 |
EXS { EXS $$ } |
EXS { (EXS $$ , _) } |
36 |
LENGTH { LENGTH $$ } |
LENGTH { (LENGTH $$ , _) } |
37 |
ANGLE { ANGLE $$ } |
ANGLE { (ANGLE $$ , _) } |
38 |
TIME { TIME $$ } |
TIME { (TIME $$ , _) } |
39 |
FREQ { FREQ $$ } |
FREQ { (FREQ $$ , _) } |
40 |
DIMEN { DIMEN $$ } |
DIMEN { (DIMEN $$ , _) } |
41 |
PERCENTAGE { PERCENTAGE $$ } |
PERCENTAGE { (PERCENTAGE $$, _) } |
42 |
NUMBER { NUMBER $$ } |
NUMBER { (NUMBER $$ , _) } |
43 |
URI { URI $$ } |
URI { (URI $$ , _) } |
44 |
FUNCTION { FUNCTION $$ } |
FUNCTION { (FUNCTION $$ , _) } |
45 |
DELIM { DELIM $$ } |
DELIM { (DELIM $$ , _) } |
46 |
SEMI { SEMI } |
SEMI { (SEMI , _) } |
47 |
RBRACE { RBRACE } |
RBRACE { (RBRACE , _) } |
48 |
COLON { COLON } |
COLON { (COLON , _) } |
49 |
SLASH { SLASH } |
SLASH { (SLASH , _) } |
50 |
MINUS { MINUS } |
MINUS { (MINUS , _) } |
51 |
DOT { DOT } |
DOT { (DOT , _) } |
52 |
LBRAC { LBRAC } |
LBRAC { (LBRAC , _) } |
53 |
RBRAC { RBRAC } |
RBRAC { (RBRAC , _) } |
54 |
ASTERISK { ASTERISK } |
ASTERISK { (ASTERISK , _) } |
55 |
EQUALS { EQUALS } |
EQUALS { (EQUALS , _) } |
56 |
RPAREN { RPAREN } |
RPAREN { (RPAREN , _) } |
57 |
|
|
58 |
%% |
%% |
59 |
|
|
61 |
: charset import_list statement_list { Stylesheet $1 $2 $3 } |
: charset import_list statement_list { Stylesheet $1 $2 $3 } |
62 |
|
|
63 |
charset :: { Maybe String } |
charset :: { Maybe String } |
64 |
: { Nothing } |
: { Nothing } |
65 |
| CHARSET_SYM STRING SEMI { Just $2 } |
| CHARSET_SYM STRING SEMI { Just $2 } |
66 |
|
|
67 |
import_list :: { [(String, [String])] } |
import_list :: { [(String, [String])] } |
121 |
|
|
122 |
selector_list_1 :: { [Selector] } |
selector_list_1 :: { [Selector] } |
123 |
: selector { [$1] } |
: selector { [$1] } |
124 |
| selector_list_1 COMMA selector { $3 : $1 } |
| selector_list_1 COMMA selector { $3 : $1 } |
125 |
|
|
126 |
selector :: { Selector } |
selector :: { Selector } |
127 |
: simple_selector { [($1, NoMore)] } |
: simple_selector { [($1, NoMore)] } |
128 |
| simple_selector combinator selector { ($1, $2) : $3 } |
| simple_selector combinator selector { ($1, $2) : $3 } |
129 |
|
|
130 |
combinator :: { Combinator } |
combinator :: { Combinator } |
131 |
: { Ancestor } |
: { Ancestor } |
204 |
| FUNCTION value_list RPAREN { Function $1 $2 } |
| FUNCTION value_list RPAREN { Function $1 $2 } |
205 |
|
|
206 |
{ |
{ |
207 |
happyError :: [Token] -> a |
happyError :: [TokenPosn] -> a |
208 |
happyError _ = error "Parse error" |
happyError tks = error ("Parse error at " ++ lcn) |
209 |
|
where |
210 |
|
lcn = case tks of |
211 |
|
[] -> "end of file" |
212 |
|
tk:_ -> "line " ++ show l ++ ", column " ++ show c |
213 |
|
where |
214 |
|
AlexPn _ l c = snd tk |
215 |
} |
} |