-define(ASCII_CONTROL_CODES, [
{null, 0},
{start_heading, 1}, % Start of Heading
{start_text, 2}, % Start of Text
{end_text, 3}, % End of Text
{eot, 4}, % End of Transmission
{enquiry, 5},
{ack, 6}, % Acknowledgment
{bell, 7},
{back, 8}, % Back Space
{tab, 9},
{line, 10}, % Line Feed
{vtab, 11}, % Vertical Tab
{page, 12}, % Form Feed
{carriage, 13}, % Carriage Return
{shift_out, 14}, % Shift Out / X-On
{shift_in, 15}, % Shift In / X-Off
{dle, 16}, % Data Line Escape
{dc1, 17}, % Device Control 1
{dc2, 18}, % Device Control 2
{dc3, 19}, % Device Control 3
{dc4, 20}, % Device Control 4
{nak, 21}, % Negative Acknowledgement
{idle, 22}, % Synchronous Idle
{etb, 23}, % End of Transmit Block
{cancel, 24},
{eom, 25}, % End of Medium
{substitute, 26},
{escape, 27},
{file_separator, 28},
{group_separator, 29},
{record_separator, 30},
{unit_separator, 31}
]).
-define(DEFAULT_GRAMMAR, #age_grammar{
id = default_grammar,
terminals = [
{greater_equal, ">="},
{greater_than, ">"},
{less_equal, "<="},
{less_than, "<"},
{equal, "=="},
{not_equal, "!="},
{round_equal, "~="},
{plus_assign, "+="},
{minus_assign, "-="},
{devide_assign, "/="},
{modulo_assign, "%="},
{assign, "="},
{colon, ":"},
{semicolon, ";"},
{comma, ","},
{plus_plus, "++"},
{plus, "+"},
{minus_minus, "--"},
{minus, "-"},
{multiply, "*"},
{devide, "/"},
{modulo, "%"},
{open_parenthesis, "("},
{close_parenthesis, ")"},
{open_bracket, "["},
{close_bracket, "]"},
{open_brace, "{"},
{close_brace, "}"},
{quote, "'"},
{escaped_quotes, "\\\""},
{quotes, "\""},
{escaped_back, "\\"},
{'and', "&&"},
{'or', "||"},
{'not', "!"},
{'band', "&"},
{'bor', "|"},
{'xor', "^"},
{range, ".."},
{int, "int"},
{float, "float"},
{string, "string"},
{eol, [13, 10]}
] ++ ?ASCII_CONTROL_CODES,
nonterminals = [
{variable, {int, identifier, semicolon}},
{variable, {int, identifier, assign, value_integer, semicolon}},
{variable, {int, identifier, open_bracket, value_integer, close_bracket, semicolon}},
{variable, {int, array, assign, terms_list, semicolon}},
{variable, {float, identifier, semicolon}},
{variable, {float, identifier, assign, value_number, semicolon}},
{variable, {float, identifier, open_bracket, value_integer, close_bracket, semicolon}},
{variable, {float, array, assign, terms_list, semicolon}},
{variable, {string, identifier, semicolon}},
{variable, {string, identifier, assign, string_list, semicolon}},
{array, {identifier, terms_list}},
{params, {open_parenthesis, {'$any', close_parenthesis}}},
{terms_set, {open_brace, {'$any', close_brace}}, '$pure_tuple'},
{terms_list, {open_bracket, {'$any', close_bracket}}, '$pure_list'},
{string_list, {quotes, {'$value', quotes}}, '$string'},
{string_list, {quote, {'$value', quote}}, '$string'},
{operator, plus},
{operator, minus},
{operator, multiply},
{operator, devide},
{value_integer, "^[+-]?[0-9]+$", '$integer'},
{value_float, "^[+-]?[0-9]+([.]?[0-9]+([eE][+-]?[0-9]+)?)?$", '$float'},
{value_number, value_integer},
{value_number, value_float},
{value, value_number},
{value, string_list},
{identifier, "^[_a-zA-Z][_a-zA-Z0-9]*$"},
{atom, value},
{atom, identifier}
]
}).
|