diff options
Diffstat (limited to 'tests/lexer')
-rw-r--r-- | tests/lexer/thexlit.nim | 2 | ||||
-rw-r--r-- | tests/lexer/thexrange.nim | 2 | ||||
-rw-r--r-- | tests/lexer/tident.nim | 18 | ||||
-rw-r--r-- | tests/lexer/tind1.nim | 2 | ||||
-rw-r--r-- | tests/lexer/tlexer.nim | 120 | ||||
-rw-r--r-- | tests/lexer/tstrlits.nim | 4 | ||||
-rw-r--r-- | tests/lexer/tunderscores.nim | 2 |
7 files changed, 75 insertions, 75 deletions
diff --git a/tests/lexer/thexlit.nim b/tests/lexer/thexlit.nim index 04a530c9c..2b7f0a40e 100644 --- a/tests/lexer/thexlit.nim +++ b/tests/lexer/thexlit.nim @@ -9,4 +9,4 @@ if t==0x950412DE: echo "equal" else: echo "not equal" - + diff --git a/tests/lexer/thexrange.nim b/tests/lexer/thexrange.nim index e5e4c10c6..461e41dfd 100644 --- a/tests/lexer/thexrange.nim +++ b/tests/lexer/thexrange.nim @@ -1,7 +1,7 @@ type TArray = array[0x0012..0x0013, int] - + var a: TArray echo a[0x0012] #OUT 0 diff --git a/tests/lexer/tident.nim b/tests/lexer/tident.nim index 1ed9894c6..68cc01e70 100644 --- a/tests/lexer/tident.nim +++ b/tests/lexer/tident.nim @@ -1,12 +1,12 @@ type - TIdObj* = object of TObject - id*: int # unique id; use this for comparisons and not the pointers - - PIdObj* = ref TIdObj - PIdent* = ref TIdent - TIdent*{.acyclic.} = object - s*: string + TIdObj* = object of TObject + id*: int # unique id; use this for comparisons and not the pointers + + PIdObj* = ref TIdObj + PIdent* = ref TIdent + TIdent*{.acyclic.} = object + s*: string proc myNewString(L: int): string {.inline.} = result = newString(L) @@ -15,8 +15,8 @@ proc myNewString(L: int): string {.inline.} = for i in 0..L-1: if result[i] == '\0': echo("Correct") - else: + else: echo("Wrong") - + var s = myNewString(8) diff --git a/tests/lexer/tind1.nim b/tests/lexer/tind1.nim index f3fd952cc..6a975d5be 100644 --- a/tests/lexer/tind1.nim +++ b/tests/lexer/tind1.nim @@ -17,7 +17,7 @@ mymacro: echo "test" else: echo "else part" - + if 4 == 3: echo "bug" diff --git a/tests/lexer/tlexer.nim b/tests/lexer/tlexer.nim index 10a8ab51d..e36220e7a 100644 --- a/tests/lexer/tlexer.nim +++ b/tests/lexer/tlexer.nim @@ -1,60 +1,60 @@ -discard """ - disabled: true -""" - -# We start with a comment -# This is the same comment - -# This is a new one! - -import - lexbase, os, strutils - -type - TMyRec {.final.} = object - x, y: int # coordinates - c: char # a character - a: int32 # an integer - - PMyRec = ref TMyRec # a reference to `TMyRec` - -proc splitText(txt: string): seq[string] # splits a text into several lines - # the comment continues here - # this is not easy to parse! - -proc anotherSplit(txt: string): seq[string] = - # the comment should belong to `anotherSplit`! - # another problem: comments are statements! - -const - x = 0B0_10001110100_0000101001000111101011101111111011000101001101001001'f64 # x ~~ 1.72826e35 - myNan = 0B01111111100000101100000000001000'f32 # NAN - y = """ - a rather long text. - Over many - lines. - """ - s = "\xff" - a = {0..234} - b = {0..high(int)} - v = 0'i32 - z = 6767566'f32 - -# small test program for lexbase - -proc main*(infile: string, a, b: int, someverylongnamewithtype = 0, - anotherlongthingie = 3) = - var - myInt: int = 0 - s: seq[string] - # this should be an error! - if initBaseLexer(L, infile, 30): nil - else: - writeln(stdout, "could not open: " & infile) - writeln(stdout, "Success!") - call(3, # we use 3 - 12, # we use 12 - 43) # we use 43 - - -main(ParamStr(1), 9, 0) +discard """ + disabled: true +""" + +# We start with a comment +# This is the same comment + +# This is a new one! + +import + lexbase, os, strutils + +type + TMyRec {.final.} = object + x, y: int # coordinates + c: char # a character + a: int32 # an integer + + PMyRec = ref TMyRec # a reference to `TMyRec` + +proc splitText(txt: string): seq[string] # splits a text into several lines + # the comment continues here + # this is not easy to parse! + +proc anotherSplit(txt: string): seq[string] = + # the comment should belong to `anotherSplit`! + # another problem: comments are statements! + +const + x = 0B0_10001110100_0000101001000111101011101111111011000101001101001001'f64 # x ~~ 1.72826e35 + myNan = 0B01111111100000101100000000001000'f32 # NAN + y = """ + a rather long text. + Over many + lines. + """ + s = "\xff" + a = {0..234} + b = {0..high(int)} + v = 0'i32 + z = 6767566'f32 + +# small test program for lexbase + +proc main*(infile: string, a, b: int, someverylongnamewithtype = 0, + anotherlongthingie = 3) = + var + myInt: int = 0 + s: seq[string] + # this should be an error! + if initBaseLexer(L, infile, 30): nil + else: + writeLine(stdout, "could not open: " & infile) + writeLine(stdout, "Success!") + call(3, # we use 3 + 12, # we use 12 + 43) # we use 43 + + +main(ParamStr(1), 9, 0) diff --git a/tests/lexer/tstrlits.nim b/tests/lexer/tstrlits.nim index 1cd43975a..f5b7ce937 100644 --- a/tests/lexer/tstrlits.nim +++ b/tests/lexer/tstrlits.nim @@ -6,9 +6,9 @@ discard """ const tripleEmpty = """"long string"""""""" # "long string """"" - + rawQuote = r"a""" - + raw = r"abc""def" stdout.write(rawQuote) diff --git a/tests/lexer/tunderscores.nim b/tests/lexer/tunderscores.nim index 8075fdae4..e718fb40a 100644 --- a/tests/lexer/tunderscores.nim +++ b/tests/lexer/tunderscores.nim @@ -3,7 +3,7 @@ discard """ line: 8 errormsg: "invalid token: _" """ -# Bug #502670 +# Bug #502670 var ef_ = 3 #ERROR_MSG invalid token: _ var a__b = 1 |