test files
This commit is contained in:
parent
f22d0d87df
commit
b822bc1f92
|
@ -194,14 +194,16 @@ Token malar_next_token(Buffer * sc_buf)
|
|||
for (; c != '\"'; c = b_getc(sc_buf), ++lexend) {
|
||||
if (c == '\n' || c == '\r')
|
||||
++line;
|
||||
if (c == '\0' || c == EOF) { /* Illegal string, make it an error token */
|
||||
if (c == '\0' || b_eob(sc_buf)) { /* Illegal string, make it an error token */
|
||||
b_retract_to_mark(sc_buf);
|
||||
b_retract(sc_buf);
|
||||
b_retract(sc_buf);
|
||||
t.code = ERR_T;
|
||||
|
||||
for (i = 0; i < lexend; ++i) {
|
||||
if (i == ERR_LEN) continue;
|
||||
/* Continue until the end of the lexeme where error was found
|
||||
* (error string attribute full) */
|
||||
if (i == ERR_LEN) continue;
|
||||
if (i < (ERR_LEN - 3))
|
||||
t.attribute.err_lex[i] = b_getc(sc_buf);
|
||||
else {
|
||||
|
@ -283,7 +285,7 @@ Token malar_next_token(Buffer * sc_buf)
|
|||
|
||||
|
||||
|
||||
}//end while(1)
|
||||
} /*end while(1)*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
!<This file contains many lexical errors.
|
||||
!<It tests mainly the correctness of the accepting functions
|
||||
!<5 tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
a1234567
|
||||
!<legal, but too long (possible semantic error)
|
||||
a1234567MORE
|
||||
b1234567MORE#
|
||||
!<lexical error: # out of context, allowed only in comments and strings
|
||||
#OR%
|
||||
!<lexical error: | allowed only in strings and comments
|
||||
|
|
||||
!<another lexical error: # out of context
|
||||
Not#here
|
||||
!<another lexical error: . out of context
|
||||
.
|
||||
!<another lexical error: & illegal symbol
|
||||
&
|
||||
!<legal FPL (will be rounded to 2.0 when displayed)
|
||||
1.999999999999999911111111111111111111111111111111111111111111111111111111111111111
|
||||
|
||||
!< big float number (error: out of range)
|
||||
999999999999999999999999999999999999999999999999999999999999999999999999999999999.0
|
||||
|
||||
!<small float number (error: out of range)
|
||||
0.00000000000000000000000000000000000000000000000000000000000000000000000000000000001
|
||||
|
||||
!< big decimal int number (error: out of range)
|
||||
99999
|
||||
!< big octal int number (error: out of range)
|
||||
0177777
|
||||
!< gigantic decimal int number (error: out of range)
|
||||
123456789012345678901234567890
|
||||
!< gigantic octal int number (error: out of range)
|
||||
0123456701234567012345670
|
|
@ -0,0 +1,28 @@
|
|||
!< This program calculates the sum of 32767 even numbers.
|
||||
!< The program is "lexically" and "syntactically" correct
|
||||
!< and should not produce any error
|
||||
PLATYPUS {
|
||||
|
||||
a=+0.0;
|
||||
|
||||
sum008 = 7.87050 ;
|
||||
INPUT(a,sum008);
|
||||
USING(i = 0,i < 32767 .OR. i == 077777,i = i + 02 )REPEAT{
|
||||
a=
|
||||
a*i/0.5
|
||||
;
|
||||
sum008 = sum008 + a - 1 ;
|
||||
};
|
||||
IF(text# == "")THEN
|
||||
text# = "prog" << "ram";
|
||||
ELSE {
|
||||
text# = text# << "ram";
|
||||
};
|
||||
OUTPUT("\* This is a platypus -:)-<-<-- \*");
|
||||
OUTPUT(text#);
|
||||
|
||||
IF(text# == "program".OR.sum008<>8..AND.i>012)THEN
|
||||
OUTPUT(sum008);
|
||||
OUTPUT();
|
||||
ELSE{};
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
!<This program contains many lexical errors
|
||||
!<It tests mainly your transition table
|
||||
!< Use MY output to adjust
|
||||
!< YOUR error state transitions in YOUR transition table
|
||||
!<You should create your own test file with more errors
|
||||
!=Wrong comment
|
||||
PLATYPUs {
|
||||
i=000; !< illegal zero literal
|
||||
j=087; !< illegal octal digit
|
||||
k=2I; !< possible error
|
||||
k=0O; !< digit 0 followed by a letter O
|
||||
a% = 0.0L; !< possible error
|
||||
b. = 0.L !< possible error
|
||||
FOR> = .0 !< illegal floating point literal
|
||||
Read(ElSe)
|
||||
If=0.l !< letter l not digit 1
|
||||
o=018a !< possible error
|
||||
b10 = 1O1.0; !< letter O follows 1
|
||||
3C=7.0O2; !< digit in VID and letter O precedes 2
|
||||
name#S = Last# << " S.#" !< wrong string VID
|
||||
USING(b10 > 00 OR. <= b10.AND a !- 0.0)DO{
|
||||
a=a+1..;
|
||||
c=01.0; !< leading zero not allowed in floating point
|
||||
}
|
||||
WRITE#("No Luck Today);
|
||||
WRITE (""My Scanner has gone astray");
|
||||
}
|
||||
"There is always one more bug
|
Loading…
Reference in New Issue