59 | PostfixOp String Expression |
59 | PostfixOp String Expression |
60 | BinOp String Expression Expression |
60 | BinOp String Expression Expression |
61 | StringLiteral String |
61 | StringLiteral String |
62 | CharCode String |
62 | CharCode String |
63 | NumberLiteral String |
63 | NumberLiteral String |
|
64 | FloatLiteral String |
64 | HexNumber String |
65 | HexNumber String |
65 | Reference Reference |
66 | Reference Reference |
66 | Null |
67 | Null |
67 deriving Show |
68 deriving Show |
68 data Reference = ArrayElement [Expression] Reference |
69 data Reference = ArrayElement [Expression] Reference |
69 | FunCall [Expression] Reference |
70 | FunCall [Expression] Reference |
|
71 | BuiltInFunCall [Expression] Reference |
70 | SimpleReference Identifier |
72 | SimpleReference Identifier |
71 | Dereference Reference |
73 | Dereference Reference |
72 | RecordField Reference Reference |
74 | RecordField Reference Reference |
73 | Address Reference |
75 | Address Reference |
74 deriving Show |
76 deriving Show |
98 , "implementation", "and", "or", "xor", "shl" |
101 , "implementation", "and", "or", "xor", "shl" |
99 , "shr", "while", "do", "repeat", "until", "case", "of" |
102 , "shr", "while", "do", "repeat", "until", "case", "of" |
100 , "type", "var", "const", "out", "array", "packed" |
103 , "type", "var", "const", "out", "array", "packed" |
101 , "procedure", "function", "with", "for", "to" |
104 , "procedure", "function", "with", "for", "to" |
102 , "downto", "div", "mod", "record", "set", "nil" |
105 , "downto", "div", "mod", "record", "set", "nil" |
103 , "string", "shortstring" |
106 , "string", "shortstring", "succ", "pred", "low" |
|
107 , "high" |
104 ] |
108 ] |
105 , reservedOpNames= [] |
109 , reservedOpNames= [] |
106 , caseSensitive = False |
110 , caseSensitive = False |
107 } |
111 } |
108 |
112 |
381 |
385 |
382 expression = buildExpressionParser table term <?> "expression" |
386 expression = buildExpressionParser table term <?> "expression" |
383 where |
387 where |
384 term = comments >> choice [ |
388 term = comments >> choice [ |
385 parens pas $ expression |
389 parens pas $ expression |
|
390 , try $ integer pas >>= \i -> notFollowedBy (char '.') >> (return . NumberLiteral . show) i |
|
391 , try $ float pas >>= return . FloatLiteral . show |
386 , try $ integer pas >>= return . NumberLiteral . show |
392 , try $ integer pas >>= return . NumberLiteral . show |
387 , stringLiteral pas >>= return . StringLiteral |
393 , stringLiteral pas >>= return . StringLiteral |
388 , char '#' >> many digit >>= return . CharCode |
394 , char '#' >> many digit >>= return . CharCode |
389 , char '$' >> many hexDigit >>= return . HexNumber |
395 , char '$' >> many hexDigit >>= return . HexNumber |
390 , try $ string "nil" >> return Null |
396 , try $ string "nil" >> return Null |