From 98e72b671166eea18bbd808787460a7f69304340 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 27 Dec 2007 21:03:41 +0000 Subject: [PATCH] --- ase/awk/parse.c | 6 +++--- ase/awk/tree.c | 16 ++++++++-------- ase/doc/en/awk-lang.man | 30 +++++++++++++++--------------- ase/test/awk/err-003.out | 2 +- ase/test/awk/err-004.out | 2 +- ase/test/awk/err-005.out | 2 +- ase/test/awk/err-006.out | 2 +- ase/test/awk/err-009.out | 2 +- ase/test/awk/err-013.awk | 1 + ase/test/awk/err-013.out | 2 +- ase/test/awk/err-017.out | 2 +- ase/test/awk/err-018.out | 2 +- ase/test/awk/err-019.out | 2 +- ase/test/awk/err-020.out | 2 +- ase/test/awk/err-021.out | 2 +- ase/test/awk/err-022.out | 2 +- 16 files changed, 39 insertions(+), 38 deletions(-) diff --git a/ase/awk/parse.c b/ase/awk/parse.c index c94214cb..28fc3792 100644 --- a/ase/awk/parse.c +++ b/ase/awk/parse.c @@ -5491,7 +5491,7 @@ static int deparse (ase_awk_t* awk) else { len = ase_awk_longtostr ((ase_long_t)i, - 10, ASE_T("__global"), tmp, ASE_COUNTOF(tmp)); + 10, ASE_T("__g"), tmp, ASE_COUNTOF(tmp)); ASE_ASSERT (len != (ase_size_t)-1); if (ase_awk_putsrcstrx (awk, tmp, len) == -1) { @@ -5516,7 +5516,7 @@ static int deparse (ase_awk_t* awk) else { len = ase_awk_longtostr ((ase_long_t)i, - 10, ASE_T("__global"), tmp, ASE_COUNTOF(tmp)); + 10, ASE_T("__g"), tmp, ASE_COUNTOF(tmp)); ASE_ASSERT (len != (ase_size_t)-1); if (ase_awk_putsrcstrx (awk, tmp, len) == -1) { @@ -5658,7 +5658,7 @@ static int deparse_func (ase_awk_pair_t* pair, void* arg) for (i = 0; i < afn->nargs; ) { n = ase_awk_longtostr (i++, 10, - ASE_T("__param"), df->tmp, df->tmp_len); + ASE_T("__p"), df->tmp, df->tmp_len); ASE_ASSERT (n != (ase_size_t)-1); if (ase_awk_putsrcstrx (df->awk, df->tmp, n) == -1) return -1; if (i >= afn->nargs) break; diff --git a/ase/awk/tree.c b/ase/awk/tree.c index d4092fb2..c20cccd5 100644 --- a/ase/awk/tree.c +++ b/ase/awk/tree.c @@ -334,7 +334,7 @@ static int print_expression (ase_awk_t* awk, ase_awk_nde_t* nde) n = ase_awk_longtostr ( px->id.idxa, 10, ASE_NULL, tmp, ASE_COUNTOF(tmp)); - PUT_SRCSTR (awk, ASE_T("__param")); + PUT_SRCSTR (awk, ASE_T("__p")); PUT_SRCSTRX (awk, tmp, n); ASE_ASSERT (px->idx == ASE_NULL); @@ -348,7 +348,7 @@ static int print_expression (ase_awk_t* awk, ase_awk_nde_t* nde) ASE_ASSERT (px->id.idxa != (ase_size_t)-1); ASE_ASSERT (px->idx != ASE_NULL); - PUT_SRCSTR (awk, ASE_T("__param")); + PUT_SRCSTR (awk, ASE_T("__p")); n = ase_awk_longtostr ( px->id.idxa, 10, ASE_NULL, awk->tmp.fmt, ASE_COUNTOF(awk->tmp.fmt)); @@ -406,7 +406,7 @@ static int print_expression (ase_awk_t* awk, ase_awk_nde_t* nde) ase_char_t tmp[ASE_SIZEOF(ase_long_t)*8+2]; ase_size_t n; - PUT_SRCSTR (awk, ASE_T("__global")); + PUT_SRCSTR (awk, ASE_T("__g")); n = ase_awk_longtostr ( px->id.idxa, 10, ASE_NULL, tmp, ASE_COUNTOF(tmp)); @@ -444,7 +444,7 @@ static int print_expression (ase_awk_t* awk, ase_awk_nde_t* nde) ase_char_t tmp[ASE_SIZEOF(ase_long_t)*8+2]; ase_size_t n; - PUT_SRCSTR (awk, ASE_T("__global")); + PUT_SRCSTR (awk, ASE_T("__g")); n = ase_awk_longtostr ( px->id.idxa, 10, ASE_NULL, tmp, ASE_COUNTOF(tmp)); @@ -470,7 +470,7 @@ static int print_expression (ase_awk_t* awk, ase_awk_nde_t* nde) if (px->id.idxa != (ase_size_t)-1) { - PUT_SRCSTR (awk, ASE_T("__local")); + PUT_SRCSTR (awk, ASE_T("__l")); n = ase_awk_longtostr ( px->id.idxa, 10, ASE_NULL, awk->tmp.fmt, ASE_COUNTOF(awk->tmp.fmt)); @@ -491,7 +491,7 @@ static int print_expression (ase_awk_t* awk, ase_awk_nde_t* nde) if (px->id.idxa != (ase_size_t)-1) { - PUT_SRCSTR (awk, ASE_T("__local")); + PUT_SRCSTR (awk, ASE_T("__l")); n = ase_awk_longtostr ( px->id.idxa, 10, ASE_NULL, awk->tmp.fmt, ASE_COUNTOF(awk->tmp.fmt)); @@ -623,7 +623,7 @@ static int print_statement (ase_awk_t* awk, ase_awk_nde_t* p, int depth) for (i = 0; i < px->nlocals - 1; i++) { - PUT_SRCSTR (awk, ASE_T("__local")); + PUT_SRCSTR (awk, ASE_T("__l")); n = ase_awk_longtostr ( i, 10, ASE_NULL, awk->tmp.fmt, ASE_COUNTOF(awk->tmp.fmt)); @@ -631,7 +631,7 @@ static int print_statement (ase_awk_t* awk, ase_awk_nde_t* p, int depth) PUT_SRCSTR (awk, ASE_T(", ")); } - PUT_SRCSTR (awk, ASE_T("__local")); + PUT_SRCSTR (awk, ASE_T("__l")); n = ase_awk_longtostr ( i, 10, ASE_NULL, awk->tmp.fmt, ASE_COUNTOF(awk->tmp.fmt)); diff --git a/ase/doc/en/awk-lang.man b/ase/doc/en/awk-lang.man index c305e66c..89bb7e0f 100644 --- a/ase/doc/en/awk-lang.man +++ b/ase/doc/en/awk-lang.man @@ -39,8 +39,8 @@ BEGIN { { } BEGIN { - local __local0; - __local0 = 20; + local __l0; + __l0 = 20; } Local variable declaration requires ASE_AWK_EXPLICIT, though. @@ -67,16 +67,16 @@ BEGIN { | A global variable is visible after it is declared to the remaining part of the program. x inside fn is x named variable while x in BEGIN is a global variable. - global __global17; + global __g17; function fn () { x = 20; return x; } BEGIN { - __global17 = 30; + __g17 = 30; print fn (); - print __global17; + print __g17; } |- | global x; @@ -96,20 +96,20 @@ BEGIN { } | A local variable can shade a global variable and a local variable at outer scope. - global __global17; + global __g17; BEGIN { - local __local0, __local1; - __global17 = 1; + local __l0, __l1; + __g17 = 1; { - __local0 = 2; + __l0 = 2; { - __local1 = 3; - print __local1; + __l1 = 3; + print __l1; } - print __local0; + print __l0; } - print __global17; + print __g17; } |}} @@ -138,9 +138,9 @@ A parameter name can shade a enclosing function name. The following table shows } | 50 is printed. The parameter f in fn doesn't affect the named variable f in BEGIN. The deparsed output shows this clearly. - function fn (__param0) + function fn (__p0) { - __param0 = 20; + __p0 = 20; } BEGIN { f = 50; diff --git a/ase/test/awk/err-003.out b/ase/test/awk/err-003.out index 142c6dad..2998420a 100644 --- a/ase/test/awk/err-003.out +++ b/ase/test/awk/err-003.out @@ -3,4 +3,4 @@ BEGIN { abc = 10; } -RUN ERROR: CODE [98] LINE [3] map 'abc' not assignable with a scalar +RUN ERROR: CODE [99] LINE [3] map 'abc' not assignable with a scalar diff --git a/ase/test/awk/err-004.out b/ase/test/awk/err-004.out index 9b766b92..7ecedb49 100644 --- a/ase/test/awk/err-004.out +++ b/ase/test/awk/err-004.out @@ -2,4 +2,4 @@ BEGIN { delete ARGC; } -RUN ERROR: CODE [90] LINE [2] variable 'ARGC' not deletable +RUN ERROR: CODE [91] LINE [2] variable 'ARGC' not deletable diff --git a/ase/test/awk/err-005.out b/ase/test/awk/err-005.out index 72c4358c..88bff8b6 100644 --- a/ase/test/awk/err-005.out +++ b/ase/test/awk/err-005.out @@ -3,4 +3,4 @@ BEGIN { delete iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix; } -RUN ERROR: CODE [90] LINE [3] variable 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii...' not deletable +RUN ERROR: CODE [91] LINE [3] variable 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii...' not deletable diff --git a/ase/test/awk/err-006.out b/ase/test/awk/err-006.out index 3155deb8..eb08ba09 100644 --- a/ase/test/awk/err-006.out +++ b/ase/test/awk/err-006.out @@ -2,4 +2,4 @@ BEGIN { helpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxhelphelp (); } -RUN ERROR: CODE [88] LINE [2] function 'helpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxhel...' not found +RUN ERROR: CODE [89] LINE [2] function 'helpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxhel...' not found diff --git a/ase/test/awk/err-009.out b/ase/test/awk/err-009.out index 6c73cb05..96f694b7 100644 --- a/ase/test/awk/err-009.out +++ b/ase/test/awk/err-009.out @@ -1 +1 @@ -PARSE ERROR: CODE [59] LINE [9] function 'abc' redefined +PARSE ERROR: CODE [53] LINE [13] 'abc' not a valid function name diff --git a/ase/test/awk/err-013.awk b/ase/test/awk/err-013.awk index 1b53c80f..f0422a70 100644 --- a/ase/test/awk/err-013.awk +++ b/ase/test/awk/err-013.awk @@ -1,3 +1,4 @@ function abc (abc) { + abc (); # invalid as abc is the parameter in this context } diff --git a/ase/test/awk/err-013.out b/ase/test/awk/err-013.out index 328e050c..30b648de 100644 --- a/ase/test/awk/err-013.out +++ b/ase/test/awk/err-013.out @@ -1 +1 @@ -PARSE ERROR: CODE [59] LINE [1] function 'abc' redefined +PARSE ERROR: CODE [53] LINE [3] 'abc' not a valid function name diff --git a/ase/test/awk/err-017.out b/ase/test/awk/err-017.out index ee6804e4..82efcf63 100644 --- a/ase/test/awk/err-017.out +++ b/ase/test/awk/err-017.out @@ -1 +1 @@ -PARSE ERROR: CODE [65] LINE [1] '+' not a valid parameter name +PARSE ERROR: CODE [66] LINE [1] '+' not a valid parameter name diff --git a/ase/test/awk/err-018.out b/ase/test/awk/err-018.out index 6a8991c7..fe048c82 100644 --- a/ase/test/awk/err-018.out +++ b/ase/test/awk/err-018.out @@ -1 +1 @@ -PARSE ERROR: CODE [66] LINE [1] '+' not a valid variable name +PARSE ERROR: CODE [67] LINE [1] '+' not a valid variable name diff --git a/ase/test/awk/err-019.out b/ase/test/awk/err-019.out index 6e7c754e..ef881643 100644 --- a/ase/test/awk/err-019.out +++ b/ase/test/awk/err-019.out @@ -1 +1 @@ -PARSE ERROR: CODE [66] LINE [3] '+' not a valid variable name +PARSE ERROR: CODE [67] LINE [3] '+' not a valid variable name diff --git a/ase/test/awk/err-020.out b/ase/test/awk/err-020.out index 52a0ade1..fc6aab28 100644 --- a/ase/test/awk/err-020.out +++ b/ase/test/awk/err-020.out @@ -2,4 +2,4 @@ BEGIN { print abc > "123\0abc"; } -RUN ERROR: CODE [114] LINE [2] i/o name containing a null character +RUN ERROR: CODE [115] LINE [2] i/o name containing a null character diff --git a/ase/test/awk/err-021.out b/ase/test/awk/err-021.out index 0be3032a..2de186f8 100644 --- a/ase/test/awk/err-021.out +++ b/ase/test/awk/err-021.out @@ -3,4 +3,4 @@ BEGIN { split ("a b c",xx); } -RUN ERROR: CODE [99] LINE [3] cannot change a scalar value to a map +RUN ERROR: CODE [100] LINE [3] cannot change a scalar value to a map diff --git a/ase/test/awk/err-022.out b/ase/test/awk/err-022.out index 38c1e945..288bc184 100644 --- a/ase/test/awk/err-022.out +++ b/ase/test/awk/err-022.out @@ -1 +1 @@ -PARSE ERROR: CODE [63] LINE [1] duplicate global variable 'ARGV' +PARSE ERROR: CODE [64] LINE [1] duplicate global variable 'ARGV'