aboutsummaryrefslogtreecommitdiffstats
path: root/pbx/ael
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2008-09-04 23:31:41 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2008-09-04 23:31:41 +0000
commit98ba3dd3c079084c2b7335f85eca8d0470d73981 (patch)
tree6e9128503dcdac3b3dc1251eaae76dea98c30aca /pbx/ael
parent6f2838ce5bd6d8e681a41879e6c734d63e55a25e (diff)
Merged revisions 141094 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r141094 | murf | 2008-09-04 17:15:07 -0600 (Thu, 04 Sep 2008) | 70 lines (closes issue #13357) Reported by: pj Tested by: murf (closes issue #13416) Reported by: yarns Tested by: murf If you find this message overly verbose, relax, it's probably not meant for you. This message is meant for probably only two people in the whole world: me, or the poor schnook that has to maintain this code because I'm either dead or unavailable at the moment. This fix solves two reports, both having to do with embedding a function call in a ${} construct. It was tricky because the funccall syntax has parenthesis () in it. And up till now, the 'word' token in the flex stuff didn't allow that, because it would tend to steal the LP and RP tokens. To be truthful, the "word" token was the trickiest, most unstable thing in the whole lexer. I was lucky it made this long without complaints. I had to choose every character in the pattern with extreme care, and I knew that someday I'd have to revisit it. Well, the day has come. So, my brilliant idea (and I'm being modest), was to use the surrounding ${} construct to make a state machine and capture everything in it, no matter what it contains. But, I have to now treat the word token like I did with comments, in that I turn the whole thing into a state-machine sort of spec, with new contexts "curlystate", "wordstate", and "brackstate". Wait a minute, "brackstate"? Yes, well, it didn't take very many regression tests to point out if I do this for ${} constructs, I also have to do it with the $[] constructs, too. I had to create a separate pcbstack2 and pcbstack3 because these constructs can occur inside macro argument lists, and when we have two state machines operating on the same structures we'd get problems otherwise. I guess I could have stopped at pcbstack2 and had the brackstate stuff share it, but it doesn't hurt to be safe. So, the pcbpush and pcbpop routines also now have versions for "2" and "3". I had to add the {KEYWORD} construct to the initial pattern for "word", because previously word would match stuff like "default7", because it was a longer match than the keyword "default". But, not any more, because the word pattern only matches only one or two characters now, and it will always lose. So, I made it the winner again by making an optional match on any of the keywords before it's normal pattern. I added another regression test to make sure we don't lose this in future edits, and had to fix just one regression, where it no longer reports a 'cascaded' error, which I guess is a plus. I've given some thought as to whether to apply these fixes to 1.4 and the 1.6.x releases, vs trunk; I decided to put it in 1.4 because one of the bug reports was against 1.4; and it is unexpected that AEL cannot handle this situation. It actually reduced the amount of useless "cascade" error messages that appeared in the regressions (by one line, ehhem). There is a possible side-effect in that it does now do more careful checking of what's in those ${} constructs, as far as matching parens, and brackets are concerned. Some users may find a an insidious problem and correct it this way. This should be exceedingly rare, I hope. ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@141115 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx/ael')
-rw-r--r--pbx/ael/ael-test/ael-vtest25/extensions.ael8
-rw-r--r--pbx/ael/ael-test/ref.ael-test639
-rw-r--r--pbx/ael/ael-test/ref.ael-vtest257
3 files changed, 34 insertions, 20 deletions
diff --git a/pbx/ael/ael-test/ael-vtest25/extensions.ael b/pbx/ael/ael-test/ael-vtest25/extensions.ael
new file mode 100644
index 000000000..f6d19d7b3
--- /dev/null
+++ b/pbx/ael/ael-test/ael-vtest25/extensions.ael
@@ -0,0 +1,8 @@
+context test11 {
+ 841 => {
+ &test234("testing", ${CUT(EXTEN,,3)});
+ jump ${DB(uri/${uri_string})};
+ Set(line=${DB(uri/${uri_string})});
+ jump ${line};
+ }
+}
diff --git a/pbx/ael/ael-test/ref.ael-test6 b/pbx/ael/ael-test/ref.ael-test6
index 968c7c71e..4b46c085a 100644
--- a/pbx/ael/ael-test/ref.ael-test6
+++ b/pbx/ael/ael-test/ref.ael-test6
@@ -2,23 +2,22 @@
(If you find progress and other non-error messages irritating, you can use -q to suppress them)
(You can use the -w option to dump extensions.conf format to extensions.conf.aeldump)
-LOG: lev:2 file:pbx_ael.c line:113 func: pbx_load_module Starting AEL load process.
-LOG: lev:4 file:ael.flex line:288 func: ael_yylex File=./extensions.ael, line=165, column=49: Mismatched '}' in expression!
-LOG: lev:4 file:ael.y line:772 func: ael_yyerror ==== File: ./extensions.ael, Line 165, Cols: 51-51: Error: syntax error, unexpected '=', expecting ')'
-LOG: lev:4 file:ael.flex line:288 func: ael_yylex File=./extensions.ael, line=174, column=49: Mismatched '}' in expression!
-LOG: lev:4 file:ael.y line:772 func: ael_yyerror ==== File: ./extensions.ael, Line 174, Cols: 51-51: Error: syntax error, unexpected '=', expecting ')'
-LOG: lev:4 file:ael.flex line:288 func: ael_yylex File=./extensions.ael, line=222, column=41: Mismatched '}' in expression!
-LOG: lev:4 file:ael.y line:772 func: ael_yyerror ==== File: ./extensions.ael, Line 222, Cols: 43-43: Error: syntax error, unexpected '=', expecting ')'
-LOG: lev:4 file:ael.y line:772 func: ael_yyerror ==== File: ./extensions.ael, Line 291, Cols: 21-28: Error: syntax error, unexpected word, expecting '(' or ';' or '=' or ':'
-LOG: lev:4 file:ael.y line:772 func: ael_yyerror ==== File: ./extensions.ael, Line 291, Cols: 32-32: Error: syntax error, unexpected '|', expecting '(' or ';' or '=' or ':'
-LOG: lev:2 file:pbx_ael.c line:126 func: pbx_load_module AEL load process: parsed config file name './extensions.ael'.
-LOG: lev:3 file:pval.c line:671 func: check_macro_returns Warning: file ./extensions.ael, line 116-125: The macro dialout does not end with a return; I will insert one.
-LOG: lev:3 file:pval.c line:671 func: check_macro_returns Warning: file ./extensions.ael, line 129-182: The macro stdexten does not end with a return; I will insert one.
-LOG: lev:3 file:pval.c line:671 func: check_macro_returns Warning: file ./extensions.ael, line 184-191: The macro uvm does not end with a return; I will insert one.
-LOG: lev:3 file:pval.c line:671 func: check_macro_returns Warning: file ./extensions.ael, line 193-200: The macro bvm does not end with a return; I will insert one.
-LOG: lev:3 file:pval.c line:671 func: check_macro_returns Warning: file ./extensions.ael, line 202-207: The macro checkdnd does not end with a return; I will insert one.
-LOG: lev:3 file:pval.c line:671 func: check_macro_returns Warning: file ./extensions.ael, line 209-216: The macro checkcf does not end with a return; I will insert one.
-LOG: lev:3 file:pval.c line:671 func: check_macro_returns Warning: file ./extensions.ael, line 218-230: The macro checkcfb does not end with a return; I will insert one.
-LOG: lev:3 file:pval.c line:671 func: check_macro_returns Warning: file ./extensions.ael, line 688-694: The macro check-psd-exists does not end with a return; I will insert one.
-LOG: lev:4 file:pbx_ael.c line:139 func: pbx_load_module Sorry, but 5 syntax errors and 0 semantic errors were detected. It doesn't make sense to compile.
-LOG: lev:4 file:ael2_parse line:531 func: main 0 contexts, 0 extensions, 0 priorities
+LOG: lev:2 file:pbx_ael.c line:115 func: pbx_load_module Starting AEL load process.
+LOG: lev:4 file:ael.flex line:437 func: ael_yylex File=./extensions.ael, line=165, column=49: Mismatched '}' in expression!
+LOG: lev:4 file:ael.y line:777 func: ael_yyerror ==== File: ./extensions.ael, Line 165, Cols: 52-52: Error: syntax error, unexpected '=', expecting ')'
+LOG: lev:4 file:ael.flex line:437 func: ael_yylex File=./extensions.ael, line=174, column=49: Mismatched '}' in expression!
+LOG: lev:4 file:ael.y line:777 func: ael_yyerror ==== File: ./extensions.ael, Line 174, Cols: 52-52: Error: syntax error, unexpected '=', expecting ')'
+LOG: lev:4 file:ael.flex line:437 func: ael_yylex File=./extensions.ael, line=222, column=41: Mismatched '}' in expression!
+LOG: lev:4 file:ael.y line:777 func: ael_yyerror ==== File: ./extensions.ael, Line 222, Cols: 44-44: Error: syntax error, unexpected '=', expecting ')'
+LOG: lev:4 file:ael.y line:777 func: ael_yyerror ==== File: ./extensions.ael, Line 291, Cols: 22-33: Error: syntax error, unexpected word, expecting '(' or ';' or '=' or ':'
+LOG: lev:2 file:pbx_ael.c line:128 func: pbx_load_module AEL load process: parsed config file name './extensions.ael'.
+LOG: lev:3 file:pval.c line:672 func: check_macro_returns Warning: file ./extensions.ael, line 116-125: The macro dialout does not end with a return; I will insert one.
+LOG: lev:3 file:pval.c line:672 func: check_macro_returns Warning: file ./extensions.ael, line 129-182: The macro stdexten does not end with a return; I will insert one.
+LOG: lev:3 file:pval.c line:672 func: check_macro_returns Warning: file ./extensions.ael, line 184-191: The macro uvm does not end with a return; I will insert one.
+LOG: lev:3 file:pval.c line:672 func: check_macro_returns Warning: file ./extensions.ael, line 193-200: The macro bvm does not end with a return; I will insert one.
+LOG: lev:3 file:pval.c line:672 func: check_macro_returns Warning: file ./extensions.ael, line 202-207: The macro checkdnd does not end with a return; I will insert one.
+LOG: lev:3 file:pval.c line:672 func: check_macro_returns Warning: file ./extensions.ael, line 209-216: The macro checkcf does not end with a return; I will insert one.
+LOG: lev:3 file:pval.c line:672 func: check_macro_returns Warning: file ./extensions.ael, line 218-230: The macro checkcfb does not end with a return; I will insert one.
+LOG: lev:3 file:pval.c line:672 func: check_macro_returns Warning: file ./extensions.ael, line 688-694: The macro check-psd-exists does not end with a return; I will insert one.
+LOG: lev:4 file:pbx_ael.c line:144 func: pbx_load_module Sorry, but 4 syntax errors and 0 semantic errors were detected. It doesn't make sense to compile.
+LOG: lev:4 file:ael2_parse line:520 func: main 0 contexts, 0 extensions, 0 priorities
diff --git a/pbx/ael/ael-test/ref.ael-vtest25 b/pbx/ael/ael-test/ref.ael-vtest25
new file mode 100644
index 000000000..c1be413bf
--- /dev/null
+++ b/pbx/ael/ael-test/ref.ael-vtest25
@@ -0,0 +1,7 @@
+
+
+[test11]
+exten => 841,1,Gosub(test234,s,1("testing", ${CUT(EXTEN,,3)}))
+exten => 841,2,Goto(${DB(uri/${uri_string})},1)
+exten => 841,3,Set(line=${DB(uri/${uri_string})})
+exten => 841,4,Goto(${line},1)