updated comment count
This commit is contained in:
2
lex.yy.c
2
lex.yy.c
@ -824,7 +824,7 @@ do_action: /* This label is used only to access EOF actions. */
|
|||||||
case 1:
|
case 1:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 27 "lexicalStructure.lex"
|
#line 27 "lexicalStructure.lex"
|
||||||
{if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {column_number=column_number+yyleng; return T_INTEGER;}}
|
{if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 2:
|
case 2:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
|
@ -23,7 +23,7 @@ SCHAR \\n|\\t|\\\"|[^\"\n\\]
|
|||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
"integer" {if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {column_number=column_number+yyleng; return T_INTEGER;}}
|
"integer" {if(DEBUG) {printf( "T_INTEGER: %s (%d)\n", yytext, T_INTEGER);} else {return T_INTEGER;}}
|
||||||
"address" {if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}}
|
"address" {if(DEBUG) {printf( "T_ADDRESS: %s (%d)\n", yytext, T_ADDRESS);} else {return T_ADDRESS;}}
|
||||||
"Boolean" {if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}}
|
"Boolean" {if(DEBUG) {printf( "T_BOOLEAN: %s (%d)\n", yytext, T_BOOLEAN);} else {return T_BOOLEAN;}}
|
||||||
"character" {if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}}
|
"character" {if(DEBUG) {printf( "T_CHARACTER: %s (%d)\n", yytext, T_CHARACTER);} else {return T_CHARACTER;}}
|
||||||
|
11
runner.c
11
runner.c
@ -26,6 +26,17 @@ int main(int argc, char *argv[]) {
|
|||||||
if (arg == TOK_ARG) {
|
if (arg == TOK_ARG) {
|
||||||
fprintf(output, "%d %d %3d \"%s\"\n", line_number, column_number, token, yytext);
|
fprintf(output, "%d %d %3d \"%s\"\n", line_number, column_number, token, yytext);
|
||||||
}
|
}
|
||||||
|
if(token == COMMENT){
|
||||||
|
for (int i = 0; i < yyleng; i++) {
|
||||||
|
if(yytext[i] == '\n'){
|
||||||
|
line_number++;
|
||||||
|
column_number = 0;
|
||||||
|
}
|
||||||
|
column_number++;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
column_number += yyleng;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yyin != NULL) {
|
if (yyin != NULL) {
|
||||||
|
1
runner.h
1
runner.h
@ -14,6 +14,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "flex.h"
|
#include "flex.h"
|
||||||
|
#include "typedefs.h"
|
||||||
|
|
||||||
extern int line_number, column_number;
|
extern int line_number, column_number;
|
||||||
extern char *yytext;
|
extern char *yytext;
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
2 1 700 "(* hello *)"
|
2 1 700 "(* hello *)"
|
||||||
3 1 700 "(* I'd think this is a legal "string" that contains several \n \t
|
3 1 700 "(* I'd think this is a legal "string" that contains several \n \t
|
||||||
escaped characters, isn't it? *)"
|
escaped characters, isn't it? *)"
|
||||||
4 1 700 "(* \ *)"
|
5 1 700 "(* \ *)"
|
||||||
5 1 700 "(* *)"
|
6 1 700 "(* *)"
|
||||||
6 1 700 "(*{COMMENT}+ *)"
|
7 1 700 "(*{COMMENT}+ *)"
|
||||||
7 1 700 "(* * *)"
|
8 1 700 "(* * *)"
|
||||||
8 1 700 "(* (hello) *)"
|
9 1 700 "(* (hello) *)"
|
||||||
|
@ -1,61 +1,61 @@
|
|||||||
1 1 101 "This"
|
1 1 101 "This"
|
||||||
1 2 101 "is"
|
1 6 101 "is"
|
||||||
1 3 101 "a"
|
1 9 101 "a"
|
||||||
1 4 101 "test"
|
1 11 101 "test"
|
||||||
2 1 301 "9"
|
2 1 301 "9"
|
||||||
2 1 101 "combined"
|
2 2 101 "combined"
|
||||||
2 2 301 "7"
|
2 11 301 "7"
|
||||||
2 2 101 "okens"
|
2 12 101 "okens"
|
||||||
3 1 301 "12345"
|
3 1 301 "12345"
|
||||||
4 1 301 "893247892"
|
4 1 301 "893247892"
|
||||||
5 1 101 "combined"
|
5 1 101 "combined"
|
||||||
5 2 101 "DueToUnknownChar"
|
5 10 101 "DueToUnknownChar"
|
||||||
5 3 101 "_validtoken"
|
5 27 101 "_validtoken"
|
||||||
5 4 101 "__validtoken1"
|
5 39 101 "__validtoken1"
|
||||||
5 5 101 "_valid_token2"
|
5 53 101 "_valid_token2"
|
||||||
5 6 101 "validToken3_"
|
5 67 101 "validToken3_"
|
||||||
6 1 305 "true"
|
6 1 305 "true"
|
||||||
6 2 306 "false"
|
6 6 306 "false"
|
||||||
7 1 302 "null"
|
7 1 302 "null"
|
||||||
7 2 401 "while"
|
7 6 401 "while"
|
||||||
7 3 609 "!"
|
7 12 609 "!"
|
||||||
7 3 101 "wrong"
|
7 13 101 "wrong"
|
||||||
7 4 402 "if"
|
7 19 402 "if"
|
||||||
7 5 101 "when"
|
7 22 101 "when"
|
||||||
8 1 404 "else"
|
8 1 404 "else"
|
||||||
8 2 405 "type"
|
8 6 405 "type"
|
||||||
8 3 406 "function"
|
8 11 406 "function"
|
||||||
9 1 407 "return"
|
9 1 407 "return"
|
||||||
9 3 408 "external"
|
9 9 408 "external"
|
||||||
9 11 409 "as"
|
9 25 409 "as"
|
||||||
10 1 101 "string"
|
10 1 101 "string"
|
||||||
10 2 101 "_NOte_that_was_not_reserved"
|
10 8 101 "_NOte_that_was_not_reserved"
|
||||||
11 7 508 ":"
|
11 7 508 ":"
|
||||||
11 7 507 ";"
|
11 8 507 ";"
|
||||||
11 7 509 ","
|
11 9 509 ","
|
||||||
11 7 510 "->"
|
11 10 510 "->"
|
||||||
12 1 601 "+"
|
12 1 601 "+"
|
||||||
12 1 602 "-"
|
12 2 602 "-"
|
||||||
12 1 603 "*"
|
12 3 603 "*"
|
||||||
12 1 604 "/"
|
12 4 604 "/"
|
||||||
12 1 605 "%"
|
12 5 605 "%"
|
||||||
13 1 606 "<"
|
13 1 606 "<"
|
||||||
13 1 607 "="
|
13 2 607 "="
|
||||||
14 1 608 ":="
|
14 1 608 ":="
|
||||||
15 2 101 "This"
|
15 2 101 "This"
|
||||||
15 3 101 "is"
|
15 7 101 "is"
|
||||||
15 4 101 "not"
|
15 10 101 "not"
|
||||||
15 5 101 "a"
|
15 14 101 "a"
|
||||||
15 6 101 "valid"
|
15 16 101 "valid"
|
||||||
16 1 101 "String"
|
16 1 101 "String"
|
||||||
17 1 304 ""This is a valid String""
|
17 1 304 ""This is a valid String""
|
||||||
18 1 609 "!"
|
18 1 609 "!"
|
||||||
18 1 611 "|"
|
18 2 611 "|"
|
||||||
19 1 612 "."
|
|
||||||
19 1 612 "."
|
19 1 612 "."
|
||||||
|
19 2 612 "."
|
||||||
20 1 700 "(* this is a comment *)"
|
20 1 700 "(* this is a comment *)"
|
||||||
21 2 603 "*"
|
21 2 603 "*"
|
||||||
21 2 101 "Not"
|
21 3 101 "Not"
|
||||||
21 3 101 "a"
|
21 7 101 "a"
|
||||||
21 4 101 "comment"
|
21 9 101 "comment"
|
||||||
22 3 610 "&"
|
22 3 610 "&"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
9 1 607 "="
|
9 1 607 "="
|
||||||
10 1 608 ":="
|
10 1 608 ":="
|
||||||
11 1 607 "="
|
11 1 607 "="
|
||||||
11 1 508 ":"
|
11 2 508 ":"
|
||||||
12 1 508 ":"
|
12 1 508 ":"
|
||||||
13 1 607 "="
|
13 1 607 "="
|
||||||
14 1 609 "!"
|
14 1 609 "!"
|
||||||
|
@ -4,4 +4,4 @@
|
|||||||
4 1 510 "->"
|
4 1 510 "->"
|
||||||
5 1 510 "->"
|
5 1 510 "->"
|
||||||
6 1 602 "-"
|
6 1 602 "-"
|
||||||
6 1 510 "->"
|
6 2 510 "->"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
2 1 301 "123"
|
2 1 301 "123"
|
||||||
3 1 301 "8392"
|
3 1 301 "8392"
|
||||||
4 1 301 "40"
|
4 1 301 "40"
|
||||||
4 2 301 "40"
|
4 4 301 "40"
|
||||||
5 2 301 "200"
|
5 2 301 "200"
|
||||||
5 3 301 "50"
|
5 6 301 "50"
|
||||||
5 4 301 "21783"
|
5 9 301 "21783"
|
||||||
|
@ -1,62 +1,63 @@
|
|||||||
1 1 304 ""this is a string""
|
1 1 304 ""this is a string""
|
||||||
1 2 301 "721398"
|
1 20 301 "721398"
|
||||||
1 3 303 "'g'"
|
1 27 303 "'g'"
|
||||||
1 5 604 "/"
|
1 32 604 "/"
|
||||||
1 5 101 "n"
|
1 33 101 "n"
|
||||||
1 7 700 "(* should print 3 tokens before this *)"
|
1 36 700 "(* should print 3 tokens before this *)"
|
||||||
4 1 301 "12893"
|
4 1 301 "12893"
|
||||||
4 3 101 "this"
|
4 8 101 "this"
|
||||||
4 4 101 "is"
|
4 13 101 "is"
|
||||||
4 5 101 "not"
|
4 16 101 "not"
|
||||||
4 6 101 "a"
|
4 20 101 "a"
|
||||||
4 7 101 "string"
|
4 22 101 "string"
|
||||||
4 8 700 "(*one valid token before this*)"
|
4 29 700 "(*one valid token before this*)"
|
||||||
5 1 700 "(* spacey comment here
|
5 1 700 "(* spacey comment here
|
||||||
over multiple lines
|
over multiple lines
|
||||||
will it work? *)"
|
will it work? *)"
|
||||||
9 1 306 "false"
|
7 18 306 "false"
|
||||||
10 1 700 "(**)"
|
11 1 306 "false"
|
||||||
12 1 101 "nullfalse"
|
12 1 700 "(**)"
|
||||||
13 2 101 "nulltrue"
|
14 1 101 "nullfalse"
|
||||||
14 1 302 "null"
|
15 2 101 "nulltrue"
|
||||||
15 1 303 "'7'"
|
16 1 302 "null"
|
||||||
16 1 305 "true"
|
17 1 303 "'7'"
|
||||||
17 2 301 "189"
|
18 1 305 "true"
|
||||||
18 1 303 "'\t'"
|
19 2 301 "189"
|
||||||
19 1 303 "'"'"
|
20 1 303 "'\t'"
|
||||||
20 1 303 "'/'"
|
21 1 303 "'"'"
|
||||||
21 1 303 "'\n'"
|
22 1 303 "'/'"
|
||||||
22 1 303 "'\''"
|
23 1 303 "'\n'"
|
||||||
23 1 303 "'\t'"
|
24 1 303 "'\''"
|
||||||
25 1 303 "'n'"
|
25 1 303 "'\t'"
|
||||||
27 2 101 "fdsf"
|
27 1 303 "'n'"
|
||||||
28 1 700 "(*/jnewjno2893u86^ Lots of random characters /n /t '") *)"
|
29 2 101 "fdsf"
|
||||||
33 1 304 ""STRINGwithnotSPaces""
|
30 1 700 "(*/jnewjno2893u86^ Lots of random characters /n /t '") *)"
|
||||||
34 1 303 "' '"
|
35 1 304 ""STRINGwithnotSPaces""
|
||||||
36 1 304 ""J""
|
36 1 303 "' '"
|
||||||
37 1 304 """"
|
38 1 304 ""J""
|
||||||
38 1 304 "" ""
|
39 1 304 """"
|
||||||
40 1 304 ""{SCHAR}""
|
40 1 304 "" ""
|
||||||
41 1 304 ""SCHAR""
|
42 1 304 ""{SCHAR}""
|
||||||
42 1 304 ""[SCHAR]""
|
43 1 304 ""SCHAR""
|
||||||
43 1 304 ""FINAL: I'd think this is a legal \"string\" that contains \n \t several escaped characters, isn't it?""
|
44 1 304 ""[SCHAR]""
|
||||||
44 2 101 "I"
|
45 1 304 ""FINAL: I'd think this is a legal \"string\" that contains \n \t several escaped characters, isn't it?""
|
||||||
44 3 101 "d"
|
46 2 101 "I"
|
||||||
44 4 101 "think"
|
46 4 101 "d"
|
||||||
44 5 101 "this"
|
46 6 101 "think"
|
||||||
44 6 101 "is"
|
46 12 101 "this"
|
||||||
44 7 101 "a"
|
46 17 101 "is"
|
||||||
44 8 101 "legal"
|
46 20 101 "a"
|
||||||
44 11 101 "string"
|
46 22 101 "legal"
|
||||||
44 14 101 "that"
|
46 30 101 "string"
|
||||||
44 15 101 "contains"
|
46 39 101 "that"
|
||||||
44 16 101 "several"
|
46 44 101 "contains"
|
||||||
44 19 101 "n"
|
46 53 101 "several"
|
||||||
44 21 101 "t"
|
46 63 101 "n"
|
||||||
44 22 101 "escaped"
|
46 66 101 "t"
|
||||||
44 23 101 "characters"
|
46 68 101 "escaped"
|
||||||
44 23 509 ","
|
46 76 101 "characters"
|
||||||
44 24 101 "isn"
|
46 86 509 ","
|
||||||
44 25 101 "t"
|
46 88 101 "isn"
|
||||||
44 26 101 "it"
|
46 92 101 "t"
|
||||||
45 1 101 "nullLike"
|
46 94 101 "it"
|
||||||
|
47 1 101 "nullLike"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
12893 "this is not a string (*one valid token before this*)
|
12893 "this is not a string (*one valid token before this*)
|
||||||
(* spacey comment here
|
(* spacey comment here
|
||||||
over multiple lines
|
over multiple lines
|
||||||
will it work? *)
|
will it work? *) false
|
||||||
"
|
"
|
||||||
'''
|
'''
|
||||||
'\'
|
'\'
|
||||||
|
Reference in New Issue
Block a user