aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-22 15:59:59 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-22 15:59:59 -0300
commit5f37134e64aec3a0414a41c11d6b055c667369d1 (patch)
tree29415835aca3bc8bfe31c9e4c03d894ac6bcef09
parent52ee91dd73199e068d31d3ac138d933ddd4fb9b1 (diff)
downloadlua-5f37134e64aec3a0414a41c11d6b055c667369d1.tar.gz
lua-5f37134e64aec3a0414a41c11d6b055c667369d1.tar.bz2
lua-5f37134e64aec3a0414a41c11d6b055c667369d1.zip
avoid '...' and "..." inside comments
-rw-r--r--lapi.c4
-rw-r--r--lbaselib.c6
-rw-r--r--ldebug.c4
-rw-r--r--ldo.c4
-rw-r--r--lgc.c4
-rw-r--r--llex.c14
-rw-r--r--lmathlib.c6
-rw-r--r--lparser.c40
-rw-r--r--lstrlib.c18
-rw-r--r--ltests.c4
-rw-r--r--ltm.c4
-rw-r--r--lvm.c12
12 files changed, 60 insertions, 60 deletions
diff --git a/lapi.c b/lapi.c
index 6592552f..db6d6a91 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 1.130 2001/02/14 17:04:11 roberto Exp roberto $ 2** $Id: lapi.c,v 1.131 2001/02/20 18:15:33 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -531,7 +531,7 @@ LUA_API int lua_ref (lua_State *L, int lock) {
531 531
532 532
533/* 533/*
534** "do" functions (run Lua code) 534** `do' functions (run Lua code)
535** (most of them are in ldo.c) 535** (most of them are in ldo.c)
536*/ 536*/
537 537
diff --git a/lbaselib.c b/lbaselib.c
index 44dc38e5..6ec951ca 100644
--- a/lbaselib.c
+++ b/lbaselib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lbaselib.c,v 1.24 2001/02/20 18:29:54 roberto Exp roberto $ 2** $Id: lbaselib.c,v 1.25 2001/02/22 17:15:18 roberto Exp roberto $
3** Basic library 3** Basic library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -447,7 +447,7 @@ static int luaB_tremove (lua_State *L) {
447 luaL_checktype(L, 1, LUA_TTABLE); 447 luaL_checktype(L, 1, LUA_TTABLE);
448 n = lua_getn(L, 1); 448 n = lua_getn(L, 1);
449 pos = luaL_opt_int(L, 2, n); 449 pos = luaL_opt_int(L, 2, n);
450 if (n <= 0) return 0; /* table is "empty" */ 450 if (n <= 0) return 0; /* table is `empty' */
451 lua_rawgeti(L, 1, pos); /* result = t[pos] */ 451 lua_rawgeti(L, 1, pos); /* result = t[pos] */
452 for ( ;pos<n; pos++) { 452 for ( ;pos<n; pos++) {
453 lua_rawgeti(L, 1, pos+1); 453 lua_rawgeti(L, 1, pos+1);
@@ -545,7 +545,7 @@ static void auxsort (lua_State *L, int l, int u) {
545 lua_rawgeti(L, 1, i); 545 lua_rawgeti(L, 1, i);
546 set2(L, u-1, i); /* swap pivot (a[u-1]) with a[i] */ 546 set2(L, u-1, i); /* swap pivot (a[u-1]) with a[i] */
547 /* a[l..i-1] <= a[i] == P <= a[i+1..u] */ 547 /* a[l..i-1] <= a[i] == P <= a[i+1..u] */
548 /* adjust so that smaller "half" is in [j..i] and larger one in [l..u] */ 548 /* adjust so that smaller half is in [j..i] and larger one in [l..u] */
549 if (i-l < u-i) { 549 if (i-l < u-i) {
550 j=l; i=i-1; l=i+2; 550 j=l; i=i-1; l=i+2;
551 } 551 }
diff --git a/ldebug.c b/ldebug.c
index a9503ccd..7c605638 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.c,v 1.66 2001/02/20 18:28:11 roberto Exp roberto $ 2** $Id: ldebug.c,v 1.67 2001/02/21 16:52:09 roberto Exp roberto $
3** Debug Interface 3** Debug Interface
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -277,7 +277,7 @@ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
277 if (isactive) 277 if (isactive)
278 func = ar->_func; 278 func = ar->_func;
279 else { 279 else {
280 what++; /* skip the '>' */ 280 what++; /* skip the `>' */
281 func = L->top - 1; 281 func = L->top - 1;
282 } 282 }
283 for (; *what; what++) { 283 for (; *what; what++) {
diff --git a/ldo.c b/ldo.c
index 7ab130af..3685dc8d 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.124 2001/02/20 18:15:33 roberto Exp roberto $ 2** $Id: ldo.c,v 1.125 2001/02/22 17:15:18 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -276,7 +276,7 @@ static int parse_file (lua_State *L, const char *filename) {
276 lua_pushliteral(L, "@"); 276 lua_pushliteral(L, "@");
277 lua_pushstring(L, (filename == NULL) ? "(stdin)" : filename); 277 lua_pushstring(L, (filename == NULL) ? "(stdin)" : filename);
278 lua_concat(L, 2); 278 lua_concat(L, 2);
279 filename = lua_tostring(L, -1); /* filename = '@'..filename */ 279 filename = lua_tostring(L, -1); /* filename = `@'..filename */
280 luaZ_Fopen(&z, f, filename); 280 luaZ_Fopen(&z, f, filename);
281 status = protectedparser(L, &z, bin); 281 status = protectedparser(L, &z, bin);
282 lua_remove(L, -2); /* remove filename */ 282 lua_remove(L, -2); /* remove filename */
diff --git a/lgc.c b/lgc.c
index 9b4c4eaa..73c841b0 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 1.89 2001/02/20 18:15:33 roberto Exp roberto $ 2** $Id: lgc.c,v 1.90 2001/02/20 18:28:11 roberto Exp roberto $
3** Garbage Collector 3** Garbage Collector
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -18,7 +18,7 @@
18 18
19 19
20/* 20/*
21** optional "lock" for GC 21** optional lock for GC
22** (when Lua calls GC tag methods it unlocks the regular lock) 22** (when Lua calls GC tag methods it unlocks the regular lock)
23*/ 23*/
24#ifndef LUA_LOCKGC 24#ifndef LUA_LOCKGC
diff --git a/llex.c b/llex.c
index 5ed43493..386ea316 100644
--- a/llex.c
+++ b/llex.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.c,v 1.77 2001/02/09 20:22:29 roberto Exp roberto $ 2** $Id: llex.c,v 1.78 2001/02/22 17:15:18 roberto Exp roberto $
3** Lexical Analyzer 3** Lexical Analyzer
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -89,7 +89,7 @@ static void luaX_invalidchar (LexState *ls, int c) {
89 89
90 90
91static void inclinenumber (LexState *LS) { 91static void inclinenumber (LexState *LS) {
92 next(LS); /* skip '\n' */ 92 next(LS); /* skip `\n' */
93 ++LS->linenumber; 93 ++LS->linenumber;
94 luaX_checklimit(LS, LS->linenumber, MAX_INT, "lines in a chunk"); 94 luaX_checklimit(LS, LS->linenumber, MAX_INT, "lines in a chunk");
95} 95}
@@ -167,7 +167,7 @@ static void read_number (LexState *LS, int comma, SemInfo *seminfo) {
167 save_and_next(L, LS, l); 167 save_and_next(L, LS, l);
168 } 168 }
169 if (LS->current == 'e' || LS->current == 'E') { 169 if (LS->current == 'e' || LS->current == 'E') {
170 save_and_next(L, LS, l); /* read 'E' */ 170 save_and_next(L, LS, l); /* read `E' */
171 if (LS->current == '+' || LS->current == '-') 171 if (LS->current == '+' || LS->current == '-')
172 save_and_next(L, LS, l); /* optional exponent sign */ 172 save_and_next(L, LS, l); /* optional exponent sign */
173 while (isdigit(LS->current)) { 173 while (isdigit(LS->current)) {
@@ -186,8 +186,8 @@ static void read_long_string (LexState *LS, SemInfo *seminfo) {
186 int cont = 0; 186 int cont = 0;
187 size_t l = 0; 187 size_t l = 0;
188 checkbuffer(L, 10, l); 188 checkbuffer(L, 10, l);
189 save(L, '[', l); /* save first '[' */ 189 save(L, '[', l); /* save first `[' */
190 save_and_next(L, LS, l); /* pass the second '[' */ 190 save_and_next(L, LS, l); /* pass the second `[' */
191 for (;;) { 191 for (;;) {
192 checkbuffer(L, 10, l); 192 checkbuffer(L, 10, l);
193 switch (LS->current) { 193 switch (LS->current) {
@@ -218,7 +218,7 @@ static void read_long_string (LexState *LS, SemInfo *seminfo) {
218 save_and_next(L, LS, l); 218 save_and_next(L, LS, l);
219 } 219 }
220 } endloop: 220 } endloop:
221 save_and_next(L, LS, l); /* skip the second ']' */ 221 save_and_next(L, LS, l); /* skip the second `]' */
222 save(L, '\0', l); 222 save(L, '\0', l);
223 seminfo->ts = luaS_newlstr(L, G(L)->Mbuffer+2, l-5); 223 seminfo->ts = luaS_newlstr(L, G(L)->Mbuffer+2, l-5);
224} 224}
@@ -237,7 +237,7 @@ static void read_string (LexState *LS, int del, SemInfo *seminfo) {
237 luaX_error(LS, "unfinished string", TK_STRING); 237 luaX_error(LS, "unfinished string", TK_STRING);
238 break; /* to avoid warnings */ 238 break; /* to avoid warnings */
239 case '\\': 239 case '\\':
240 next(LS); /* do not save the '\' */ 240 next(LS); /* do not save the `\' */
241 switch (LS->current) { 241 switch (LS->current) {
242 case 'a': save(L, '\a', l); next(LS); break; 242 case 'a': save(L, '\a', l); next(LS); break;
243 case 'b': save(L, '\b', l); next(LS); break; 243 case 'b': save(L, '\b', l); next(LS); break;
diff --git a/lmathlib.c b/lmathlib.c
index 92a54f1f..b7fc41c6 100644
--- a/lmathlib.c
+++ b/lmathlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmathlib.c,v 1.33 2000/12/04 18:33:40 roberto Exp roberto $ 2** $Id: lmathlib.c,v 1.34 2001/02/02 19:02:40 roberto Exp roberto $
3** Standard mathematical library 3** Standard mathematical library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -166,8 +166,8 @@ static int math_max (lua_State *L) {
166 166
167 167
168static int math_random (lua_State *L) { 168static int math_random (lua_State *L) {
169 /* the '%' avoids the (rare) case of r==1, and is needed also because on 169 /* the `%' avoids the (rare) case of r==1, and is needed also because on
170 some systems (SunOS!) "rand()" may return a value larger than RAND_MAX */ 170 some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */
171 lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX; 171 lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX;
172 switch (lua_gettop(L)) { /* check number of arguments */ 172 switch (lua_gettop(L)) { /* check number of arguments */
173 case 0: { /* no arguments */ 173 case 0: { /* no arguments */
diff --git a/lparser.c b/lparser.c
index aea4b621..17dd2983 100644
--- a/lparser.c
+++ b/lparser.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lparser.c,v 1.135 2001/02/20 18:15:33 roberto Exp roberto $ 2** $Id: lparser.c,v 1.136 2001/02/20 18:28:11 roberto Exp roberto $
3** LL(1) Parser and code generator for Lua 3** LL(1) Parser and code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -26,7 +26,7 @@
26** Constructors descriptor: 26** Constructors descriptor:
27** `n' indicates number of elements, and `k' signals whether 27** `n' indicates number of elements, and `k' signals whether
28** it is a list constructor (k = 0) or a record constructor (k = 1) 28** it is a list constructor (k = 0) or a record constructor (k = 1)
29** or empty (k = ';' or '}') 29** or empty (k = `;' or `}')
30*/ 30*/
31typedef struct Constdesc { 31typedef struct Constdesc {
32 int n; 32 int n;
@@ -381,7 +381,7 @@ Proto *luaY_parser (lua_State *L, ZIO *z) {
381 381
382 382
383static int explist1 (LexState *ls) { 383static int explist1 (LexState *ls) {
384 /* explist1 -> expr { ',' expr } */ 384 /* explist1 -> expr { `,' expr } */
385 int n = 1; /* at least one expression */ 385 int n = 1; /* at least one expression */
386 expdesc v; 386 expdesc v;
387 expr(ls, &v); 387 expr(ls, &v);
@@ -400,7 +400,7 @@ static void funcargs (LexState *ls, int slf) {
400 FuncState *fs = ls->fs; 400 FuncState *fs = ls->fs;
401 int slevel = fs->stacklevel - slf - 1; /* where is func in the stack */ 401 int slevel = fs->stacklevel - slf - 1; /* where is func in the stack */
402 switch (ls->t.token) { 402 switch (ls->t.token) {
403 case '(': { /* funcargs -> '(' [ explist1 ] ')' */ 403 case '(': { /* funcargs -> `(' [ explist1 ] `)' */
404 int line = ls->linenumber; 404 int line = ls->linenumber;
405 int nargs = 0; 405 int nargs = 0;
406 next(ls); 406 next(ls);
@@ -442,7 +442,7 @@ static void funcargs (LexState *ls, int slf) {
442 442
443 443
444static void recfield (LexState *ls) { 444static void recfield (LexState *ls) {
445 /* recfield -> (NAME | '['exp1']') = exp1 */ 445 /* recfield -> (NAME | `['exp1`]') = exp1 */
446 switch (ls->t.token) { 446 switch (ls->t.token) {
447 case TK_NAME: { 447 case TK_NAME: {
448 luaK_kstr(ls, checkname(ls)); 448 luaK_kstr(ls, checkname(ls));
@@ -462,7 +462,7 @@ static void recfield (LexState *ls) {
462 462
463 463
464static int recfields (LexState *ls) { 464static int recfields (LexState *ls) {
465 /* recfields -> recfield { ',' recfield } [','] */ 465 /* recfields -> recfield { `,' recfield } [`,'] */
466 FuncState *fs = ls->fs; 466 FuncState *fs = ls->fs;
467 int n = 1; /* at least one element */ 467 int n = 1; /* at least one element */
468 recfield(ls); 468 recfield(ls);
@@ -481,7 +481,7 @@ static int recfields (LexState *ls) {
481 481
482 482
483static int listfields (LexState *ls) { 483static int listfields (LexState *ls) {
484 /* listfields -> exp1 { ',' exp1 } [','] */ 484 /* listfields -> exp1 { `,' exp1 } [`,'] */
485 FuncState *fs = ls->fs; 485 FuncState *fs = ls->fs;
486 int n = 1; /* at least one element */ 486 int n = 1; /* at least one element */
487 exp1(ls); 487 exp1(ls);
@@ -531,7 +531,7 @@ static void constructor_part (LexState *ls, Constdesc *cd) {
531 531
532 532
533static void constructor (LexState *ls) { 533static void constructor (LexState *ls) {
534 /* constructor -> '{' constructor_part [';' constructor_part] '}' */ 534 /* constructor -> `{' constructor_part [`;' constructor_part] `}' */
535 FuncState *fs = ls->fs; 535 FuncState *fs = ls->fs;
536 int line = ls->linenumber; 536 int line = ls->linenumber;
537 int pc = luaK_code1(fs, OP_CREATETABLE, 0); 537 int pc = luaK_code1(fs, OP_CREATETABLE, 0);
@@ -617,18 +617,18 @@ static void primaryexp (LexState *ls, expdesc *v) {
617 617
618static void simpleexp (LexState *ls, expdesc *v) { 618static void simpleexp (LexState *ls, expdesc *v) {
619 /* simpleexp -> 619 /* simpleexp ->
620 primaryexp { '.' NAME | '[' exp ']' | ':' NAME funcargs | funcargs } */ 620 primaryexp { `.' NAME | `[' exp `]' | `:' NAME funcargs | funcargs } */
621 primaryexp(ls, v); 621 primaryexp(ls, v);
622 for (;;) { 622 for (;;) {
623 switch (ls->t.token) { 623 switch (ls->t.token) {
624 case '.': { /* '.' NAME */ 624 case '.': { /* `.' NAME */
625 next(ls); 625 next(ls);
626 luaK_tostack(ls, v, 1); /* `v' must be on stack */ 626 luaK_tostack(ls, v, 1); /* `v' must be on stack */
627 luaK_kstr(ls, checkname(ls)); 627 luaK_kstr(ls, checkname(ls));
628 v->k = VINDEXED; 628 v->k = VINDEXED;
629 break; 629 break;
630 } 630 }
631 case '[': { /* '[' exp1 ']' */ 631 case '[': { /* `[' exp1 `]' */
632 next(ls); 632 next(ls);
633 luaK_tostack(ls, v, 1); /* `v' must be on stack */ 633 luaK_tostack(ls, v, 1); /* `v' must be on stack */
634 v->k = VINDEXED; 634 v->k = VINDEXED;
@@ -636,7 +636,7 @@ static void simpleexp (LexState *ls, expdesc *v) {
636 check(ls, ']'); 636 check(ls, ']');
637 break; 637 break;
638 } 638 }
639 case ':': { /* ':' NAME funcargs */ 639 case ':': { /* `:' NAME funcargs */
640 next(ls); 640 next(ls);
641 luaK_tostack(ls, v, 1); /* `v' must be on stack */ 641 luaK_tostack(ls, v, 1); /* `v' must be on stack */
642 luaK_code1(ls->fs, OP_PUSHSELF, checkname(ls)); 642 luaK_code1(ls->fs, OP_PUSHSELF, checkname(ls));
@@ -775,14 +775,14 @@ static void block (LexState *ls) {
775static int assignment (LexState *ls, expdesc *v, int nvars) { 775static int assignment (LexState *ls, expdesc *v, int nvars) {
776 int left = 0; /* number of values left in the stack after assignment */ 776 int left = 0; /* number of values left in the stack after assignment */
777 luaX_checklimit(ls, nvars, MAXVARSLH, "variables in a multiple assignment"); 777 luaX_checklimit(ls, nvars, MAXVARSLH, "variables in a multiple assignment");
778 if (ls->t.token == ',') { /* assignment -> ',' simpleexp assignment */ 778 if (ls->t.token == ',') { /* assignment -> `,' simpleexp assignment */
779 expdesc nv; 779 expdesc nv;
780 next(ls); 780 next(ls);
781 simpleexp(ls, &nv); 781 simpleexp(ls, &nv);
782 check_condition(ls, (nv.k != VEXP), "syntax error"); 782 check_condition(ls, (nv.k != VEXP), "syntax error");
783 left = assignment(ls, &nv, nvars+1); 783 left = assignment(ls, &nv, nvars+1);
784 } 784 }
785 else { /* assignment -> '=' explist1 */ 785 else { /* assignment -> `=' explist1 */
786 int nexps; 786 int nexps;
787 check(ls, '='); 787 check(ls, '=');
788 nexps = explist1(ls); 788 nexps = explist1(ls);
@@ -943,11 +943,11 @@ static void ifstat (LexState *ls, int line) {
943 943
944 944
945static void localstat (LexState *ls) { 945static void localstat (LexState *ls) {
946 /* stat -> LOCAL NAME {',' NAME} ['=' explist1] */ 946 /* stat -> LOCAL NAME {`,' NAME} [`=' explist1] */
947 int nvars = 0; 947 int nvars = 0;
948 int nexps; 948 int nexps;
949 do { 949 do {
950 next(ls); /* skip LOCAL or ',' */ 950 next(ls); /* skip LOCAL or `,' */
951 new_localvar(ls, str_checkname(ls), nvars++); 951 new_localvar(ls, str_checkname(ls), nvars++);
952 } while (ls->t.token == ','); 952 } while (ls->t.token == ',');
953 if (optional(ls, '=')) 953 if (optional(ls, '='))
@@ -960,7 +960,7 @@ static void localstat (LexState *ls) {
960 960
961 961
962static int funcname (LexState *ls, expdesc *v) { 962static int funcname (LexState *ls, expdesc *v) {
963 /* funcname -> NAME {'.' NAME} [':' NAME] */ 963 /* funcname -> NAME {`.' NAME} [`:' NAME] */
964 int needself = 0; 964 int needself = 0;
965 singlevar(ls, str_checkname(ls), v); 965 singlevar(ls, str_checkname(ls), v);
966 while (ls->t.token == '.') { 966 while (ls->t.token == '.') {
@@ -1083,7 +1083,7 @@ static int stat (LexState *ls) {
1083 1083
1084 1084
1085static void parlist (LexState *ls) { 1085static void parlist (LexState *ls) {
1086 /* parlist -> [ param { ',' param } ] */ 1086 /* parlist -> [ param { `,' param } ] */
1087 int nparams = 0; 1087 int nparams = 0;
1088 short dots = 0; 1088 short dots = 0;
1089 if (ls->t.token != ')') { /* is `parlist' not empty? */ 1089 if (ls->t.token != ')') { /* is `parlist' not empty? */
@@ -1100,7 +1100,7 @@ static void parlist (LexState *ls) {
1100 1100
1101 1101
1102static void body (LexState *ls, int needself, int line) { 1102static void body (LexState *ls, int needself, int line) {
1103 /* body -> '(' parlist ')' chunk END */ 1103 /* body -> `(' parlist `)' chunk END */
1104 FuncState new_fs; 1104 FuncState new_fs;
1105 open_func(ls, &new_fs); 1105 open_func(ls, &new_fs);
1106 new_fs.f->lineDefined = line; 1106 new_fs.f->lineDefined = line;
@@ -1122,7 +1122,7 @@ static void body (LexState *ls, int needself, int line) {
1122 1122
1123 1123
1124static void chunk (LexState *ls) { 1124static void chunk (LexState *ls) {
1125 /* chunk -> { stat [';'] } */ 1125 /* chunk -> { stat [`;'] } */
1126 int islast = 0; 1126 int islast = 0;
1127 while (!islast && !block_follow(ls->t.token)) { 1127 while (!islast && !block_follow(ls->t.token)) {
1128 islast = stat(ls); 1128 islast = stat(ls);
diff --git a/lstrlib.c b/lstrlib.c
index 07ec43ad..5fb4de3e 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.62 2001/02/02 19:02:40 roberto Exp roberto $ 2** $Id: lstrlib.c,v 1.63 2001/02/22 17:15:18 roberto Exp roberto $
3** Standard library for string operations and pattern-matching 3** Standard library for string operations and pattern-matching
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -17,7 +17,7 @@
17#include "lualib.h" 17#include "lualib.h"
18 18
19 19
20typedef long sint32; /* a "signed" version for size_t */ 20typedef long sint32; /* a signed version for size_t */
21 21
22 22
23static int str_len (lua_State *L) { 23static int str_len (lua_State *L) {
@@ -128,7 +128,7 @@ static int str_char (lua_State *L) {
128 128
129typedef struct MatchState { 129typedef struct MatchState {
130 const char *src_init; /* init of source string */ 130 const char *src_init; /* init of source string */
131 const char *src_end; /* end ('\0') of source string */ 131 const char *src_end; /* end (`\0') of source string */
132 int level; /* total number of captures (finished or unfinished) */ 132 int level; /* total number of captures (finished or unfinished) */
133 struct { 133 struct {
134 const char *init; 134 const char *init;
@@ -166,9 +166,9 @@ static const char *luaI_classend (MatchState *ms, const char *p) {
166 return p+1; 166 return p+1;
167 case '[': 167 case '[':
168 if (*p == '^') p++; 168 if (*p == '^') p++;
169 do { /* look for a ']' */ 169 do { /* look for a `]' */
170 if (*p == '\0') lua_error(ms->L, "malformed pattern (missing `]')"); 170 if (*p == '\0') lua_error(ms->L, "malformed pattern (missing `]')");
171 if (*(p++) == ESC && *p != '\0') p++; /* skip escapes (e.g. '%]') */ 171 if (*(p++) == ESC && *p != '\0') p++; /* skip escapes (e.g. `%]') */
172 } while (*p != ']'); 172 } while (*p != ']');
173 return p+1; 173 return p+1;
174 default: 174 default:
@@ -200,7 +200,7 @@ static int matchbracketclass (char c, const char *p, const char *endclass) {
200 int sig = 1; 200 int sig = 1;
201 if (*(p+1) == '^') { 201 if (*(p+1) == '^') {
202 sig = 0; 202 sig = 0;
203 p++; /* skip the '^' */ 203 p++; /* skip the `^' */
204 } 204 }
205 while (++p < endclass) { 205 while (++p < endclass) {
206 if (*p == ESC) { 206 if (*p == ESC) {
@@ -342,7 +342,7 @@ static const char *match (MatchState *ms, const char *s, const char *p) {
342 case '\0': /* end of pattern */ 342 case '\0': /* end of pattern */
343 return s; /* match succeeded */ 343 return s; /* match succeeded */
344 case '$': 344 case '$':
345 if (*(p+1) == '\0') /* is the '$' the last char in pattern? */ 345 if (*(p+1) == '\0') /* is the `$' the last char in pattern? */
346 return (s == ms->src_end) ? s : NULL; /* check end of string */ 346 return (s == ms->src_end) ? s : NULL; /* check end of string */
347 else goto dflt; 347 else goto dflt;
348 default: dflt: { /* it is a pattern item */ 348 default: dflt: { /* it is a pattern item */
@@ -601,7 +601,7 @@ static int str_format (lua_State *L) {
601 break; 601 break;
602 case 'q': 602 case 'q':
603 luaI_addquoted(L, &b, arg); 603 luaI_addquoted(L, &b, arg);
604 continue; /* skip the "addsize" at the end */ 604 continue; /* skip the `addsize' at the end */
605 case 's': { 605 case 's': {
606 size_t l; 606 size_t l;
607 const char *s = luaL_check_lstr(L, arg, &l); 607 const char *s = luaL_check_lstr(L, arg, &l);
@@ -610,7 +610,7 @@ static int str_format (lua_State *L) {
610 keep original string */ 610 keep original string */
611 lua_pushvalue(L, arg); 611 lua_pushvalue(L, arg);
612 luaL_addvalue(&b); 612 luaL_addvalue(&b);
613 continue; /* skip the "addsize" at the end */ 613 continue; /* skip the `addsize' at the end */
614 } 614 }
615 else { 615 else {
616 sprintf(buff, form, s); 616 sprintf(buff, form, s);
diff --git a/ltests.c b/ltests.c
index a8d46fc4..b570011b 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 1.69 2001/02/20 18:18:00 roberto Exp roberto $ 2** $Id: ltests.c,v 1.70 2001/02/21 16:51:25 roberto Exp roberto $
3** Internal Module for Debugging of the Lua Implementation 3** Internal Module for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -473,7 +473,7 @@ static int equal (lua_State *L) {
473 473
474/* 474/*
475** {====================================================== 475** {======================================================
476** function to test the API with C. It interprets a kind of "assembler" 476** function to test the API with C. It interprets a kind of assembler
477** language with calls to the API, so the test can be driven by Lua code 477** language with calls to the API, so the test can be driven by Lua code
478** ======================================================= 478** =======================================================
479*/ 479*/
diff --git a/ltm.c b/ltm.c
index 48f353f1..43bdc0f8 100644
--- a/ltm.c
+++ b/ltm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltm.c,v 1.66 2001/02/09 20:22:29 roberto Exp roberto $ 2** $Id: ltm.c,v 1.67 2001/02/20 18:15:33 roberto Exp roberto $
3** Tag methods 3** Tag methods
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -50,7 +50,7 @@ static int luaI_checkevent (lua_State *L, const char *name, int t) {
50 50
51 51
52/* events in LUA_TNIL are all allowed, since this is used as a 52/* events in LUA_TNIL are all allowed, since this is used as a
53* 'placeholder' for "default" fallbacks 53* `placeholder' for default fallbacks
54*/ 54*/
55/* ORDER LUA_T, ORDER TM */ 55/* ORDER LUA_T, ORDER TM */
56static const lu_byte luaT_validevents[NUM_TAGS][TM_N] = { 56static const lu_byte luaT_validevents[NUM_TAGS][TM_N] = {
diff --git a/lvm.c b/lvm.c
index ca26e95a..8db50ad7 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 1.169 2001/02/12 13:04:19 roberto Exp roberto $ 2** $Id: lvm.c,v 1.170 2001/02/20 18:15:33 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -237,13 +237,13 @@ static int luaV_strlessthan (const TString *ls, const TString *rs) {
237 for (;;) { 237 for (;;) {
238 int temp = strcoll(l, r); 238 int temp = strcoll(l, r);
239 if (temp != 0) return (temp < 0); 239 if (temp != 0) return (temp < 0);
240 else { /* strings are equal up to a '\0' */ 240 else { /* strings are equal up to a `\0' */
241 size_t len = strlen(l); /* index of first '\0' in both strings */ 241 size_t len = strlen(l); /* index of first `\0' in both strings */
242 if (len == lr) /* r is finished? */ 242 if (len == lr) /* r is finished? */
243 return 0; /* l is equal or greater than r */ 243 return 0; /* l is equal or greater than r */
244 else if (len == ll) /* l is finished? */ 244 else if (len == ll) /* l is finished? */
245 return 1; /* l is smaller than r (because r is not finished) */ 245 return 1; /* l is smaller than r (because r is not finished) */
246 /* both strings longer than `len'; go on comparing (after the '\0') */ 246 /* both strings longer than `len'; go on comparing (after the `\0') */
247 len++; 247 len++;
248 l += len; ll -= len; r += len; lr -= len; 248 l += len; ll -= len; r += len; lr -= len;
249 } 249 }
@@ -600,7 +600,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) {
600 luaD_error(L, "`for' limit must be a number"); 600 luaD_error(L, "`for' limit must be a number");
601 if (tonumber(top-3)) 601 if (tonumber(top-3))
602 luaD_error(L, "`for' initial value must be a number"); 602 luaD_error(L, "`for' initial value must be a number");
603 pc += -jmp; /* "jump" to loop end (delta is negated here) */ 603 pc += -jmp; /* `jump' to loop end (delta is negated here) */
604 goto forloop; /* do not increment index */ 604 goto forloop; /* do not increment index */
605 } 605 }
606 case OP_FORLOOP: { 606 case OP_FORLOOP: {
@@ -626,7 +626,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) {
626 setnvalue(top-3, -1); /* initial index */ 626 setnvalue(top-3, -1); /* initial index */
627 setnilvalue(top-2); 627 setnilvalue(top-2);
628 setnilvalue(top-1); 628 setnilvalue(top-1);
629 pc += -jmp; /* "jump" to loop end (delta is negated here) */ 629 pc += -jmp; /* `jump' to loop end (delta is negated here) */
630 /* go through */ 630 /* go through */
631 } 631 }
632 case OP_LFORLOOP: { 632 case OP_LFORLOOP: {