-
Notifications
You must be signed in to change notification settings - Fork 0
/
plus_number.diff
96 lines (83 loc) · 2.88 KB
/
plus_number.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Index: WISHLIST.txt
===================================================================
--- WISHLIST.txt (revision 7335)
+++ WISHLIST.txt (revision 7336)
@@ -266,7 +266,10 @@
- transfer Lua_Extended.txt document to the website
(part of modding guide).
+? implement 2D array access: [x, y] --> [x][y]
+ --> there's a power patch for that
+
----------------------------------------------------------------
DOOM and DOOM II
----------------------------------------------------------------
Index: CHANGES.txt
===================================================================
--- CHANGES.txt (revision 7335)
+++ CHANGES.txt (revision 7336)
@@ -47,6 +47,7 @@
- ternary operator of the form: (X ? Y ; Z)
- continue statement
- alternative inequality operator: !=
+ - allow numbers to begin with plus, like: +3
- incorporated glBSP source for easier building
Index: lua_src/llex.cc
===================================================================
--- lua_src/llex.cc (revision 7335)
+++ lua_src/llex.cc (revision 7336)
@@ -25,7 +25,8 @@
-#define next(ls) (ls->current = zgetc(ls->z))
+/* -AJA- 2011/06/14: remember the last character */
+#define next(ls) (ls->previous = ls->current, ls->current = zgetc(ls->z))
@@ -145,6 +146,7 @@
ls->lastline = 1;
ls->source = source;
luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */
+ ls->current = 0; /* --AJA-- */
next(ls); /* read first char */
}
@@ -357,6 +359,22 @@
next(ls);
continue;
}
+ /* -AJA- 2011/06/14: hacky support for numbers like +3 */
+ case '+': {
+ if (! (ls->previous == 0 || isspace(ls->previous) ||
+ ls->previous == ',' || ls->previous == '(' ||
+ ls->previous == '[' || ls->previous == '{'))
+ {
+ next(ls); return '+';
+ }
+ next(ls);
+ if (isdigit(ls->current))
+ {
+ read_numeral(ls, seminfo);
+ return TK_NUMBER;
+ }
+ return '+';
+ }
case '[': {
int sep = skip_sep(ls);
if (sep >= 0) {
Index: lua_src/llex.h
===================================================================
--- lua_src/llex.h (revision 7335)
+++ lua_src/llex.h (revision 7336)
@@ -54,6 +54,7 @@
typedef struct LexState {
int current; /* current character (charint) */
+ int previous; /* previous character --AJA-- */
int linenumber; /* input line counter */
int lastline; /* line of last token `consumed' */
Token t; /* current token */
Index: doc/Lua_Extended.txt
===================================================================
--- doc/Lua_Extended.txt (revision 7335)
+++ doc/Lua_Extended.txt (revision 7336)
@@ -73,3 +73,7 @@
since I find it more readable -- the exclamation mark just
stands out more.
+
+6. Allow numbers to begin with a plus sign, example: +3
+ Just another little thing I missed from C.
+