lexer: Reimplement for better testability and internationalization.
[pspp-builds.git] / tests / language / lexer / lexer.at
1 AT_BANNER([lexer])
2
3 AT_SETUP([lexer ignores initial @%:@! line])
4 AT_DATA([lexer.sps], [dnl
5 #! /usr/local/bin/pspp
6 DATA LIST LIST NOTABLE /a.
7 BEGIN DATA.
8 1
9 2
10 END DATA.
11 LIST.
12 ])
13 AT_CHECK([pspp -o pspp.csv lexer.sps])
14 AT_CHECK([cat pspp.csv], [0], [dnl
15 Table: Data List
16 a
17 1.00
18 2.00
19 ])
20 AT_CLEANUP
21
22 AT_SETUP([lexer properly reports scan errors])
23 AT_DATA([lexer.sps], [dnl
24 x'123'
25 x'1x'
26 u''
27 u'012345678'
28 u'd800'
29 u'110000'
30 'foo
31 'very long unterminated string that be ellipsized in its error message
32 1e .x
33 `
34
35 ])
36 AT_CHECK([pspp -O format=csv lexer.sps], [1], [dnl
37 "lexer.sps:1.1-1.6: error: Syntax error at `x'123'': String of hex digits has 3 characters, which is not a multiple of 2."
38
39 lexer.sps:2.1-2.5: error: Syntax error at `x'1x'': `x' is not a valid hex digit.
40
41 "lexer.sps:3.1-3.3: error: Syntax error at `u''': Unicode string contains 0 bytes, which is not in the valid range of 1 to 8 bytes."
42
43 "lexer.sps:4.1-4.12: error: Syntax error at `u'012345678'': Unicode string contains 9 bytes, which is not in the valid range of 1 to 8 bytes."
44
45 lexer.sps:5.1-5.7: error: Syntax error at `u'd800'': U+D800 is not a valid Unicode code point.
46
47 lexer.sps:6.1-6.9: error: Syntax error at `u'110000'': U+110000 is not a valid Unicode code point.
48
49 lexer.sps:7.1-7.4: error: Syntax error at `'foo': Unterminated string constant.
50
51 lexer.sps:8.1-8.70: error: Syntax error at `'very long unterminated string that be ellipsized in its err...': Unterminated string constant.
52
53 lexer.sps:9.1-9.2: error: Syntax error at `1e': Missing exponent following `1e'.
54
55 lexer.sps:9.4: error: Syntax error at `.': Unexpected `.' in middle of command.
56
57 lexer.sps:9: error: Unknown command `x'.
58
59 lexer.sps:10.1: error: Syntax error at ``': Bad character ``' in input.
60
61 lexer.sps:11.1: error: Syntax error at `�': Bad character U+FFFD in input.
62 ])
63 AT_CLEANUP