diff --git a/Makefile b/Makefile index ec333dc..57c29a6 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,9 @@ test3: test4: ./$(EXE) ./tests/test_variables.txt +test5: + ./$(EXE) ./tests/test_otherpunc.txt + clean: rm -f *.o rm -f lex.yy.c diff --git a/lexicalStructure b/lexicalStructure deleted file mode 100755 index 8817fe4..0000000 Binary files a/lexicalStructure and /dev/null differ diff --git a/lexicalStructure.lex b/lexicalStructure.lex index 2a0245c..64ce9b2 100644 --- a/lexicalStructure.lex +++ b/lexicalStructure.lex @@ -10,8 +10,6 @@ DIGIT [0-9] CHAR \\n|\\t|\\'|[^'\n\t\\] SCHAR \\n|\\t|\\\"|[^\"\n\\] COM ([^*]|\*+[^)*])* - -/* INCOMPLETE */ ID [A-Za-z_][0-9A-Za-z_]* %% @@ -34,7 +32,10 @@ ID [A-Za-z_][0-9A-Za-z_]* "external" {printf("EXTERNAL %s, Token: %d\n", yytext, EXTERNAL);} // {return EXTERNAL} "as" {printf("AS %s, Token: %d\n", yytext, AS);} // {return AS} -{ID} {printf("ID: %s, Token: %d\n", yytext, ID );} // INCOMPLETE +";" {printf("SEMI_COLON %s, Token: %d\n", yytext, SEMI_COLON);} +":" {printf("COLON %s, Token: %d\n", yytext, COLON);} +"," {printf("COMMA %s, Token: %d\n", yytext, COMMA);} +"->" {printf("ARROW %s, Token: %d\n", yytext, ARROW);} {DIGIT}+ {printf("C_INTEGER: %s, Token: %d\n", yytext, atoi( yytext ) );} "null" {printf("C_NULL: %s, Token: %d\n", yytext, atoi( yytext ) );} @@ -42,6 +43,9 @@ ID [A-Za-z_][0-9A-Za-z_]* "true" {printf("C_TRUE: %s, Token: %d\n", yytext, atoi( yytext ) );} "false" {printf("C_FALSE: %s, Token: %d\n", yytext, atoi( yytext ) );} \"{SCHAR}*\" {printf("C_STRING: %s, Token: %d\n", yytext, atoi( yytext ) );} + +{ID} {printf("ID: %s, Token: %d\n", yytext, ID);} + .|\n %% diff --git a/test1.txt b/test1.txt deleted file mode 100644 index defc56b..0000000 --- a/test1.txt +++ /dev/null @@ -1,24 +0,0 @@ -This is a test -9combined 7okens -12345 -893247892 -combined'DueToUnknownChar _validtoken __validtoken1 _valid_token2 validToken3_ -true false -null while !wrong if when -else type function -return external as -string _NOte_that_was_not_reserved -([)]{}:;,->"\ -+-*/% -<= -:= -"This is not a valid -String" -"This is a valid String" -!| -.. -(* this is a comment *) -(*Not a comment -$^& -> - diff --git a/tests/test_keywards.alpha b/tests/test_keywards.alpha index ff18168..ebd52ee 100644 --- a/tests/test_keywards.alpha +++ b/tests/test_keywards.alpha @@ -27,3 +27,4 @@ exteRnal as As aS +functionaly \ No newline at end of file diff --git a/tests/test_otherpunc.txt b/tests/test_otherpunc.txt new file mode 100644 index 0000000..bd1f2de --- /dev/null +++ b/tests/test_otherpunc.txt @@ -0,0 +1,6 @@ +; +: +, +-> +->> +--> \ No newline at end of file