- /* These conditions are ripped directly from SDCC.lex */
- /* First check the parsing of the basic tokens */
- TEST(altlex_testparse(">>=") == RIGHT_ASSIGN);
- TEST(altlex_testparse("<<=") == LEFT_ASSIGN);
- TEST(altlex_testparse("+=") == ADD_ASSIGN);
- TEST(altlex_testparse("-=") == SUB_ASSIGN);
- TEST(altlex_testparse("*=") == MUL_ASSIGN);
- TEST(altlex_testparse("/=") == DIV_ASSIGN);
- TEST(altlex_testparse("%=") == MOD_ASSIGN);
- TEST(altlex_testparse("&=") == AND_ASSIGN);
- TEST(altlex_testparse("^=") == XOR_ASSIGN);
- TEST(altlex_testparse("|=") == OR_ASSIGN);
- TEST(altlex_testparse(">>") == RIGHT_OP);
- TEST(altlex_testparse("<<") == LEFT_OP);
- TEST(altlex_testparse("++") == INC_OP);
- TEST(altlex_testparse("--") == DEC_OP);
- TEST(altlex_testparse("->") == PTR_OP);
- TEST(altlex_testparse("&&") == AND_OP);
- TEST(altlex_testparse("||") == OR_OP);
- TEST(altlex_testparse("<=") == LE_OP);
- TEST(altlex_testparse(">=") == GE_OP);
- TEST(altlex_testparse("==") == EQ_OP);
- TEST(altlex_testparse("!=") == NE_OP);
- TEST(altlex_testparse(";") == ';');
- TEST(altlex_testparse("{") == '{');
- TEST(altlex_testparse("}") == '}');
- TEST(altlex_testparse(",") == ',');
- TEST(altlex_testparse(":") == ':');
- TEST(altlex_testparse("=") == '=');
- TEST(altlex_testparse("(") == '(');
- TEST(altlex_testparse(")") == ')');
- TEST(altlex_testparse("[") == '[');
- TEST(altlex_testparse("]") == ']');
- TEST(altlex_testparse(".") == '.');
- TEST(altlex_testparse("&") == '&');
- TEST(altlex_testparse("!") == '!');
- TEST(altlex_testparse("~") == '~');
- TEST(altlex_testparse("-") == '-');
- TEST(altlex_testparse("+") == '+');
- TEST(altlex_testparse("*") == '*');
- TEST(altlex_testparse("/") == '/');
- TEST(altlex_testparse("%") == '%');
- TEST(altlex_testparse("<") == '<');
- TEST(altlex_testparse(">") == '>');
- TEST(altlex_testparse("^") == '^');
- TEST(altlex_testparse("|") == '|');
- TEST(altlex_testparse("?") == '?');
-
- /* Now some character constants */
- TEST(altlex_testchar("'1'") == '1');
- TEST(altlex_testchar("'a'") == 'a');
- TEST(altlex_testchar("'A'") == 'A');
- TEST(altlex_testchar("'z'") == 'z');
- TEST(altlex_testchar("'Z'") == 'Z');
- TEST(altlex_testchar("'\n'") == '\n');
- TEST(altlex_testchar("'\\\\'") == '\\');
- TEST(altlex_testchar("'\\''") == '\'');
-
- /* And some numbers */
- TEST(altlex_testnum("0") == 0);
- TEST(altlex_testnum("1") == 1);
- TEST(altlex_testnum("075") == 075);
- TEST(altlex_testnum("0xfeed") == 0xfeed);
- TEST(altlex_testnum("0xFEED") == 0xFEED);
- TEST(altlex_testnum("0x00005678") == 0x5678);
-
- /* Keywords */
- TEST(altlex_testparse("auto") == AUTO);
- TEST(altlex_testparse("break") == BREAK);
- TEST(altlex_testparse("case") == CASE);
- TEST(altlex_testparse("char") == CHAR);
- TEST(altlex_testparse("const") == CONST);
- TEST(altlex_testparse("continue") == CONTINUE);
- TEST(altlex_testparse("default") == DEFAULT);
- TEST(altlex_testparse("do") == DO);
- /* Prints a warning */
- // TEST(altlex_testparse("double") == FLOAT);
- TEST(altlex_testparse("else") == ELSE);
- TEST(altlex_testparse("enum") == ENUM);
- TEST(altlex_testparse("extern") == EXTERN);
- TEST(altlex_testparse("float") == FLOAT);
- TEST(altlex_testparse("for") == FOR);
- TEST(altlex_testparse("goto") == GOTO);
- TEST(altlex_testparse("if") == IF);
- TEST(altlex_testparse("int") == INT);
- TEST(altlex_testparse("interrupt") == INTERRUPT);
- TEST(altlex_testparse("long") == LONG);
- TEST(altlex_testparse("register") == REGISTER);
- TEST(altlex_testparse("return") == RETURN);
- TEST(altlex_testparse("short") == SHORT);
- TEST(altlex_testparse("signed") == SIGNED);
- TEST(altlex_testparse("sizeof") == SIZEOF);
- TEST(altlex_testparse("static") == STATIC);
- TEST(altlex_testparse("struct") == STRUCT);
- TEST(altlex_testparse("switch") == SWITCH);
- TEST(altlex_testparse("typedef") == TYPEDEF);
- TEST(altlex_testparse("union") == UNION);
- TEST(altlex_testparse("unsigned") == UNSIGNED);
- TEST(altlex_testparse("void") == VOID);
- TEST(altlex_testparse("volatile") == VOLATILE);
- TEST(altlex_testparse("while") == WHILE);
- TEST(altlex_testparse("...") == VAR_ARGS);
+ /* These conditions are ripped directly from SDCC.lex */
+ /* First check the parsing of the basic tokens */
+ TEST (altlex_testparse (">>=") == RIGHT_ASSIGN);
+ TEST (altlex_testparse ("<<=") == LEFT_ASSIGN);
+ TEST (altlex_testparse ("+=") == ADD_ASSIGN);
+ TEST (altlex_testparse ("-=") == SUB_ASSIGN);
+ TEST (altlex_testparse ("*=") == MUL_ASSIGN);
+ TEST (altlex_testparse ("/=") == DIV_ASSIGN);
+ TEST (altlex_testparse ("%=") == MOD_ASSIGN);
+ TEST (altlex_testparse ("&=") == AND_ASSIGN);
+ TEST (altlex_testparse ("^=") == XOR_ASSIGN);
+ TEST (altlex_testparse ("|=") == OR_ASSIGN);
+ TEST (altlex_testparse (">>") == RIGHT_OP);
+ TEST (altlex_testparse ("<<") == LEFT_OP);
+ TEST (altlex_testparse ("++") == INC_OP);
+ TEST (altlex_testparse ("--") == DEC_OP);
+ TEST (altlex_testparse ("->") == PTR_OP);
+ TEST (altlex_testparse ("&&") == AND_OP);
+ TEST (altlex_testparse ("||") == OR_OP);
+ TEST (altlex_testparse ("<=") == LE_OP);
+ TEST (altlex_testparse (">=") == GE_OP);
+ TEST (altlex_testparse ("==") == EQ_OP);
+ TEST (altlex_testparse ("!=") == NE_OP);
+ TEST (altlex_testparse (";") == ';');
+ TEST (altlex_testparse ("{") == '{');
+ TEST (altlex_testparse ("}") == '}');
+ TEST (altlex_testparse (",") == ',');
+ TEST (altlex_testparse (":") == ':');
+ TEST (altlex_testparse ("=") == '=');
+ TEST (altlex_testparse ("(") == '(');
+ TEST (altlex_testparse (")") == ')');
+ TEST (altlex_testparse ("[") == '[');
+ TEST (altlex_testparse ("]") == ']');
+ TEST (altlex_testparse (".") == '.');
+ TEST (altlex_testparse ("&") == '&');
+ TEST (altlex_testparse ("!") == '!');
+ TEST (altlex_testparse ("~") == '~');
+ TEST (altlex_testparse ("-") == '-');
+ TEST (altlex_testparse ("+") == '+');
+ TEST (altlex_testparse ("*") == '*');
+ TEST (altlex_testparse ("/") == '/');
+ TEST (altlex_testparse ("%") == '%');
+ TEST (altlex_testparse ("<") == '<');
+ TEST (altlex_testparse (">") == '>');
+ TEST (altlex_testparse ("^") == '^');
+ TEST (altlex_testparse ("|") == '|');
+ TEST (altlex_testparse ("?") == '?');
+
+ /* Now some character constants */
+ TEST (altlex_testchar ("'1'") == '1');
+ TEST (altlex_testchar ("'a'") == 'a');
+ TEST (altlex_testchar ("'A'") == 'A');
+ TEST (altlex_testchar ("'z'") == 'z');
+ TEST (altlex_testchar ("'Z'") == 'Z');
+ TEST (altlex_testchar ("'\n'") == '\n');
+ TEST (altlex_testchar ("'\\\\'") == '\\');
+ TEST (altlex_testchar ("'\\''") == '\'');
+
+ /* And some numbers */
+ TEST (altlex_testnum ("0") == 0);
+ TEST (altlex_testnum ("1") == 1);
+ TEST (altlex_testnum ("075") == 075);
+ TEST (altlex_testnum ("0xfeed") == 0xfeed);
+ TEST (altlex_testnum ("0xFEED") == 0xFEED);
+ TEST (altlex_testnum ("0x00005678") == 0x5678);
+
+ /* Keywords */
+ TEST (altlex_testparse ("auto") == AUTO);
+ TEST (altlex_testparse ("break") == BREAK);
+ TEST (altlex_testparse ("case") == CASE);
+ TEST (altlex_testparse ("char") == CHAR);
+ TEST (altlex_testparse ("const") == CONST);
+ TEST (altlex_testparse ("continue") == CONTINUE);
+ TEST (altlex_testparse ("default") == DEFAULT);
+ TEST (altlex_testparse ("do") == DO);
+ /* Prints a warning */
+ // TEST(altlex_testparse("double") == FLOAT);
+ TEST (altlex_testparse ("else") == ELSE);
+ TEST (altlex_testparse ("enum") == ENUM);
+ TEST (altlex_testparse ("extern") == EXTERN);
+ TEST (altlex_testparse ("float") == FLOAT);
+ TEST (altlex_testparse ("fixed16x16") == FIXED16X16);
+ TEST (altlex_testparse ("for") == FOR);
+ TEST (altlex_testparse ("goto") == GOTO);
+ TEST (altlex_testparse ("if") == IF);
+ TEST (altlex_testparse ("int") == INT);
+ TEST (altlex_testparse ("interrupt") == INTERRUPT);
+ TEST (altlex_testparse ("long") == LONG);
+ TEST (altlex_testparse ("register") == REGISTER);
+ TEST (altlex_testparse ("return") == RETURN);
+ TEST (altlex_testparse ("short") == SHORT);
+ TEST (altlex_testparse ("signed") == SIGNED);
+ TEST (altlex_testparse ("sizeof") == SIZEOF);
+ TEST (altlex_testparse ("static") == STATIC);
+ TEST (altlex_testparse ("struct") == STRUCT);
+ TEST (altlex_testparse ("switch") == SWITCH);
+ TEST (altlex_testparse ("typedef") == TYPEDEF);
+ TEST (altlex_testparse ("union") == UNION);
+ TEST (altlex_testparse ("unsigned") == UNSIGNED);
+ TEST (altlex_testparse ("void") == VOID);
+ TEST (altlex_testparse ("volatile") == VOLATILE);
+ TEST (altlex_testparse ("while") == WHILE);
+ TEST (altlex_testparse ("...") == VAR_ARGS);