Mercurial > projects > dang
annotate tests/parser/string_1.d @ 187:08b6ce45b456
Changed the way static arrays are represented
Now uses [3 x i32] rather than [3 x i32]*, and when using constants they are
copied before use.
Also dixed a test or two
author | Anders Halager <halager@gmail.com> |
---|---|
date | Fri, 25 Jul 2008 12:53:58 +0200 |
parents | 6cb2f4201e2a |
children |
rev | line source |
---|---|
104
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
1 |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
2 int main() |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
3 { |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
4 /* All examples taken from D's Language site */ |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
5 |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
6 char[4] s1 = "food"; |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
7 |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
8 char[5] s2 = r"hello"; |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
9 char[15] s3 = r"c:\root\foo.exe"; |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
10 char[4] s4 = r"ab\n"; |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
11 |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
12 char[5] s5 = `hello`; |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
13 char[15] s6 = `c:\root\foo.exe`; |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
14 char[4] s7 = `ab\n`; |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
15 |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
16 char[5] s10 = "hello"; |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
17 char[15] s11 = "c:\\root\\foo.exe"; |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
18 char[3] s12 = "ab\n"; |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
19 char[3] s13 = "ab |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
20 "; |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
21 |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
22 char[1] s14 = x"0A"; |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
23 char[6] s15 = x"00 FBCD 32FD 0A"; |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
24 |
106
89db676fbacb
Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents:
104
diff
changeset
|
25 /* And some custom ones */ |
89db676fbacb
Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents:
104
diff
changeset
|
26 |
187
08b6ce45b456
Changed the way static arrays are represented
Anders Halager <halager@gmail.com>
parents:
160
diff
changeset
|
27 char[7] s16 = "\x61\u05D0\U000201A4"; |
106
89db676fbacb
Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents:
104
diff
changeset
|
28 char[2] s17 = "\122\522"; |
187
08b6ce45b456
Changed the way static arrays are represented
Anders Halager <halager@gmail.com>
parents:
160
diff
changeset
|
29 char[8] s18 = x"61 62 63 64 |
106
89db676fbacb
Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents:
104
diff
changeset
|
30 65 66 67 68"; |
89db676fbacb
Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents:
104
diff
changeset
|
31 |
187
08b6ce45b456
Changed the way static arrays are represented
Anders Halager <halager@gmail.com>
parents:
160
diff
changeset
|
32 char[3] s19 = "\®\&"; |
111
c658172ca8a0
Parsing basic integers and floats.
Anders Johnsen <skabet@gmail.com>
parents:
106
diff
changeset
|
33 |
187
08b6ce45b456
Changed the way static arrays are represented
Anders Halager <halager@gmail.com>
parents:
160
diff
changeset
|
34 char[3] s20 = "\®\&"c; |
160 | 35 wchar[2] s21 = "\®\&"w; |
36 dchar[2] s22 = "\®\&"d; | |
106
89db676fbacb
Now able of understanding strings.
Anders Johnsen <skabet@gmail.com>
parents:
104
diff
changeset
|
37 |
104
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
38 return 0; |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
diff
changeset
|
39 } |