From 6024f0aad968b84b203500278fe8876ff3ac4e35 Mon Sep 17 00:00:00 2001 From: Sunil Shetye Date: Thu, 14 Jun 2018 21:44:17 +0530 Subject: handle part() call --- Makefile | 3 ++- js/Linear/SOM_f.js | 2 +- js/Misc/CBLOCK.js | 6 +++--- js/Misc/CBLOCK4.js | 6 +++--- js/Misc/MBLOCK.js | 6 +++--- js/Misc/MPBLOCK.js | 6 +++--- js/Misc/generic_block.js | 4 ++-- js/Misc/generic_block2.js | 4 ++-- js/Misc/generic_block3.js | 4 ++-- js/NonLinear/LOOKUP_c.js | 32 ++++++++++++++++---------------- js/Sinks/WFILE_f.js | 4 ++-- js/Sinks/WRITEC_f.js | 2 +- js/Sources/CURVE_c.js | 30 +++++++++++++++--------------- js/Sources/READAU_f.js | 2 +- js/Sources/READC_f.js | 2 +- js/Sources/RFILE_f.js | 4 ++-- sci2jslex.py | 9 +++++---- sci2jsyacc.py | 20 +++++++++++++------- 18 files changed, 77 insertions(+), 69 deletions(-) diff --git a/Makefile b/Makefile index 9ccf57d3..63589dd6 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,9 @@ all: $(JSFILES) js/%.js: macros/%.sci sci2jsyacc.py parsetab.py sci2jslex.py Makefile ./sci2jslex.py $< > $@ + #./sci2jslex.py $< > $@ 2>&1 && ./sci2jsyacc.py $< >> $@ 2>&1 -parsetab.py: sci2jsyacc.py sci2jslex.py Makefile +parsetab.py: sci2jsyacc.py sci2jslex.py @rm -f $@* parser.out ./sci2jsyacc.py /dev/null > /dev/null diff --git a/js/Linear/SOM_f.js b/js/Linear/SOM_f.js index 98787095..2698e173 100644 --- a/js/Linear/SOM_f.js +++ b/js/Linear/SOM_f.js @@ -177,7 +177,7 @@ LexToken(OPENSQBRACKET,'[',1,1660) LexToken(VAR,'str',1,1661) LexToken(SEMICOLON,';',1,1665) LexToken(OPENBRACKET,'(',1,1667) -LexToken(VAR,'part',1,1668) +LexToken(PART,'part',1,1668) LexToken(OPENBRACKET,'(',1,1672) LexToken(VAR,'labs',1,1673) LexToken(OPENBRACKET,'(',1,1677) diff --git a/js/Misc/CBLOCK.js b/js/Misc/CBLOCK.js index 51f5a1c4..6019edb3 100644 --- a/js/Misc/CBLOCK.js +++ b/js/Misc/CBLOCK.js @@ -366,7 +366,7 @@ LexToken(NUMBER,'1',1,2445) LexToken(CLOSEBRACKET,')',1,2446) LexToken(EOL,'\n',1,2447) LexToken(IF,'if',1,2461) -LexToken(VAR,'part',1,2464) +LexToken(PART,'part',1,2464) LexToken(OPENBRACKET,'(',1,2468) LexToken(VAR,'impli',1,2469) LexToken(COMMA,',',1,2474) @@ -433,7 +433,7 @@ LexToken(VAR,'depu',1,2808) LexToken(CLOSEBRACKET,')',1,2812) LexToken(EOL,'\n',1,2813) LexToken(IF,'if',1,2827) -LexToken(VAR,'part',1,2830) +LexToken(PART,'part',1,2830) LexToken(OPENBRACKET,'(',1,2834) LexToken(VAR,'depu',1,2835) LexToken(COMMA,',',1,2839) @@ -463,7 +463,7 @@ LexToken(VAR,'dept',1,2965) LexToken(CLOSEBRACKET,')',1,2969) LexToken(EOL,'\n',1,2970) LexToken(IF,'if',1,2984) -LexToken(VAR,'part',1,2987) +LexToken(PART,'part',1,2987) LexToken(OPENBRACKET,'(',1,2991) LexToken(VAR,'dept',1,2992) LexToken(COMMA,',',1,2996) diff --git a/js/Misc/CBLOCK4.js b/js/Misc/CBLOCK4.js index 56512219..e2418c48 100644 --- a/js/Misc/CBLOCK4.js +++ b/js/Misc/CBLOCK4.js @@ -391,7 +391,7 @@ LexToken(NUMBER,'1',1,2653) LexToken(CLOSEBRACKET,')',1,2654) LexToken(EOL,'\n',1,2655) LexToken(IF,'if',1,2669) -LexToken(VAR,'part',1,2672) +LexToken(PART,'part',1,2672) LexToken(OPENBRACKET,'(',1,2676) LexToken(VAR,'impli',1,2677) LexToken(COMMA,',',1,2682) @@ -463,7 +463,7 @@ LexToken(VAR,'depu',1,3042) LexToken(CLOSEBRACKET,')',1,3046) LexToken(EOL,'\n',1,3047) LexToken(IF,'if',1,3065) -LexToken(VAR,'part',1,3068) +LexToken(PART,'part',1,3068) LexToken(OPENBRACKET,'(',1,3072) LexToken(VAR,'depu',1,3073) LexToken(COMMA,',',1,3077) @@ -493,7 +493,7 @@ LexToken(VAR,'dept',1,3223) LexToken(CLOSEBRACKET,')',1,3227) LexToken(EOL,'\n',1,3228) LexToken(IF,'if',1,3246) -LexToken(VAR,'part',1,3249) +LexToken(PART,'part',1,3249) LexToken(OPENBRACKET,'(',1,3253) LexToken(VAR,'dept',1,3254) LexToken(COMMA,',',1,3258) diff --git a/js/Misc/MBLOCK.js b/js/Misc/MBLOCK.js index 8de360d4..4862a6e8 100644 --- a/js/Misc/MBLOCK.js +++ b/js/Misc/MBLOCK.js @@ -1409,7 +1409,7 @@ LexToken(END,'end',1,11560) LexToken(EOL,'\n',1,11563) LexToken(VAR,'lhs_txt',1,11584) LexToken(ASSIGNMENT,'=',1,11591) -LexToken(VAR,'part',1,11592) +LexToken(PART,'part',1,11592) LexToken(OPENBRACKET,'(',1,11596) LexToken(VAR,'lhs_txt',1,11597) LexToken(COMMA,',',1,11604) @@ -1425,7 +1425,7 @@ LexToken(CLOSEBRACKET,')',1,11624) LexToken(EOL,'\n',1,11625) LexToken(VAR,'lab_txt',1,11646) LexToken(ASSIGNMENT,'=',1,11653) -LexToken(VAR,'part',1,11654) +LexToken(PART,'part',1,11654) LexToken(OPENBRACKET,'(',1,11658) LexToken(VAR,'lab_txt',1,11659) LexToken(COMMA,',',1,11666) @@ -1441,7 +1441,7 @@ LexToken(CLOSEBRACKET,')',1,11686) LexToken(EOL,'\n',1,11687) LexToken(VAR,'rhs_txt',1,11708) LexToken(ASSIGNMENT,'=',1,11715) -LexToken(VAR,'part',1,11716) +LexToken(PART,'part',1,11716) LexToken(OPENBRACKET,'(',1,11720) LexToken(VAR,'rhs_txt',1,11721) LexToken(COMMA,',',1,11728) diff --git a/js/Misc/MPBLOCK.js b/js/Misc/MPBLOCK.js index e2a81e16..ece97a18 100644 --- a/js/Misc/MPBLOCK.js +++ b/js/Misc/MPBLOCK.js @@ -1383,7 +1383,7 @@ LexToken(END,'end',1,11551) LexToken(EOL,'\n',1,11554) LexToken(VAR,'lhs_txt',1,11575) LexToken(ASSIGNMENT,'=',1,11582) -LexToken(VAR,'part',1,11583) +LexToken(PART,'part',1,11583) LexToken(OPENBRACKET,'(',1,11587) LexToken(VAR,'lhs_txt',1,11588) LexToken(COMMA,',',1,11595) @@ -1399,7 +1399,7 @@ LexToken(CLOSEBRACKET,')',1,11615) LexToken(EOL,'\n',1,11616) LexToken(VAR,'lab_txt',1,11637) LexToken(ASSIGNMENT,'=',1,11644) -LexToken(VAR,'part',1,11645) +LexToken(PART,'part',1,11645) LexToken(OPENBRACKET,'(',1,11649) LexToken(VAR,'lab_txt',1,11650) LexToken(COMMA,',',1,11657) @@ -1415,7 +1415,7 @@ LexToken(CLOSEBRACKET,')',1,11677) LexToken(EOL,'\n',1,11678) LexToken(VAR,'rhs_txt',1,11699) LexToken(ASSIGNMENT,'=',1,11706) -LexToken(VAR,'part',1,11707) +LexToken(PART,'part',1,11707) LexToken(OPENBRACKET,'(',1,11711) LexToken(VAR,'rhs_txt',1,11712) LexToken(COMMA,',',1,11719) diff --git a/js/Misc/generic_block.js b/js/Misc/generic_block.js index 5899af37..722bf699 100644 --- a/js/Misc/generic_block.js +++ b/js/Misc/generic_block.js @@ -397,7 +397,7 @@ LexToken(VAR,'depu',1,2738) LexToken(CLOSEBRACKET,')',1,2742) LexToken(EOL,'\n',1,2743) LexToken(IF,'if',1,2757) -LexToken(VAR,'part',1,2760) +LexToken(PART,'part',1,2760) LexToken(OPENBRACKET,'(',1,2764) LexToken(VAR,'depu',1,2765) LexToken(COMMA,',',1,2769) @@ -427,7 +427,7 @@ LexToken(VAR,'dept',1,2895) LexToken(CLOSEBRACKET,')',1,2899) LexToken(EOL,'\n',1,2900) LexToken(IF,'if',1,2914) -LexToken(VAR,'part',1,2917) +LexToken(PART,'part',1,2917) LexToken(OPENBRACKET,'(',1,2921) LexToken(VAR,'dept',1,2922) LexToken(COMMA,',',1,2926) diff --git a/js/Misc/generic_block2.js b/js/Misc/generic_block2.js index 131a36f9..086daaee 100644 --- a/js/Misc/generic_block2.js +++ b/js/Misc/generic_block2.js @@ -413,7 +413,7 @@ LexToken(VAR,'depu',1,2837) LexToken(CLOSEBRACKET,')',1,2841) LexToken(EOL,'\n',1,2842) LexToken(IF,'if',1,2856) -LexToken(VAR,'part',1,2859) +LexToken(PART,'part',1,2859) LexToken(OPENBRACKET,'(',1,2863) LexToken(VAR,'depu',1,2864) LexToken(COMMA,',',1,2868) @@ -443,7 +443,7 @@ LexToken(VAR,'dept',1,2994) LexToken(CLOSEBRACKET,')',1,2998) LexToken(EOL,'\n',1,2999) LexToken(IF,'if',1,3013) -LexToken(VAR,'part',1,3016) +LexToken(PART,'part',1,3016) LexToken(OPENBRACKET,'(',1,3020) LexToken(VAR,'dept',1,3021) LexToken(COMMA,',',1,3025) diff --git a/js/Misc/generic_block3.js b/js/Misc/generic_block3.js index c05ab038..8d484b0e 100644 --- a/js/Misc/generic_block3.js +++ b/js/Misc/generic_block3.js @@ -472,7 +472,7 @@ LexToken(VAR,'depu',1,3269) LexToken(CLOSEBRACKET,')',1,3273) LexToken(EOL,'\n',1,3274) LexToken(IF,'if',1,3288) -LexToken(VAR,'part',1,3291) +LexToken(PART,'part',1,3291) LexToken(OPENBRACKET,'(',1,3295) LexToken(VAR,'depu',1,3296) LexToken(COMMA,',',1,3300) @@ -502,7 +502,7 @@ LexToken(VAR,'dept',1,3426) LexToken(CLOSEBRACKET,')',1,3430) LexToken(EOL,'\n',1,3431) LexToken(IF,'if',1,3445) -LexToken(VAR,'part',1,3448) +LexToken(PART,'part',1,3448) LexToken(OPENBRACKET,'(',1,3452) LexToken(VAR,'dept',1,3453) LexToken(COMMA,',',1,3457) diff --git a/js/NonLinear/LOOKUP_c.js b/js/NonLinear/LOOKUP_c.js index 7d402e4c..cdf42a30 100644 --- a/js/NonLinear/LOOKUP_c.js +++ b/js/NonLinear/LOOKUP_c.js @@ -6279,7 +6279,7 @@ LexToken(CLOSEBRACKET,')',1,29693) LexToken(EOL,'\n',1,29694) LexToken(VAR,'x1',1,29708) LexToken(ASSIGNMENT,'=',1,29710) -LexToken(VAR,'part',1,29711) +LexToken(PART,'part',1,29711) LexToken(OPENBRACKET,'(',1,29715) LexToken(VAR,'xa',1,29716) LexToken(COMMA,',',1,29718) @@ -6292,7 +6292,7 @@ LexToken(CLOSEBRACKET,')',1,29725) LexToken(EOL,'\n',1,29726) LexToken(VAR,'x2',1,29740) LexToken(ASSIGNMENT,'=',1,29742) -LexToken(VAR,'part',1,29743) +LexToken(PART,'part',1,29743) LexToken(OPENBRACKET,'(',1,29747) LexToken(VAR,'xa',1,29748) LexToken(COMMA,',',1,29750) @@ -6308,7 +6308,7 @@ LexToken(CLOSEBRACKET,')',1,29766) LexToken(EOL,'\n',1,29767) LexToken(VAR,'y1',1,29781) LexToken(ASSIGNMENT,'=',1,29783) -LexToken(VAR,'part',1,29784) +LexToken(PART,'part',1,29784) LexToken(OPENBRACKET,'(',1,29788) LexToken(VAR,'ya',1,29789) LexToken(COMMA,',',1,29791) @@ -6321,7 +6321,7 @@ LexToken(CLOSEBRACKET,')',1,29798) LexToken(EOL,'\n',1,29799) LexToken(VAR,'y2',1,29813) LexToken(ASSIGNMENT,'=',1,29815) -LexToken(VAR,'part',1,29816) +LexToken(PART,'part',1,29816) LexToken(OPENBRACKET,'(',1,29820) LexToken(VAR,'ya',1,29821) LexToken(COMMA,',',1,29823) @@ -6368,7 +6368,7 @@ LexToken(END,'end',1,29992) LexToken(EOL,'\n',1,29995) LexToken(VAR,'x11',1,30008) LexToken(ASSIGNMENT,'=',1,30011) -LexToken(VAR,'part',1,30012) +LexToken(PART,'part',1,30012) LexToken(OPENBRACKET,'(',1,30016) LexToken(VAR,'x1',1,30017) LexToken(COMMA,',',1,30019) @@ -6381,7 +6381,7 @@ LexToken(CLOSEBRACKET,')',1,30027) LexToken(EOL,'\n',1,30028) LexToken(VAR,'x12',1,30042) LexToken(ASSIGNMENT,'=',1,30045) -LexToken(VAR,'part',1,30046) +LexToken(PART,'part',1,30046) LexToken(OPENBRACKET,'(',1,30050) LexToken(VAR,'x1',1,30051) LexToken(COMMA,',',1,30053) @@ -6426,7 +6426,7 @@ LexToken(END,'end',1,30221) LexToken(EOL,'\n',1,30224) LexToken(VAR,'x21',1,30237) LexToken(ASSIGNMENT,'=',1,30240) -LexToken(VAR,'part',1,30241) +LexToken(PART,'part',1,30241) LexToken(OPENBRACKET,'(',1,30245) LexToken(VAR,'x2',1,30246) LexToken(COMMA,',',1,30248) @@ -6439,7 +6439,7 @@ LexToken(CLOSEBRACKET,')',1,30256) LexToken(EOL,'\n',1,30257) LexToken(VAR,'x22',1,30271) LexToken(ASSIGNMENT,'=',1,30274) -LexToken(VAR,'part',1,30275) +LexToken(PART,'part',1,30275) LexToken(OPENBRACKET,'(',1,30279) LexToken(VAR,'x2',1,30280) LexToken(COMMA,',',1,30282) @@ -6484,7 +6484,7 @@ LexToken(END,'end',1,30450) LexToken(EOL,'\n',1,30453) LexToken(VAR,'y11',1,30466) LexToken(ASSIGNMENT,'=',1,30469) -LexToken(VAR,'part',1,30470) +LexToken(PART,'part',1,30470) LexToken(OPENBRACKET,'(',1,30474) LexToken(VAR,'y1',1,30475) LexToken(COMMA,',',1,30477) @@ -6497,7 +6497,7 @@ LexToken(CLOSEBRACKET,')',1,30485) LexToken(EOL,'\n',1,30486) LexToken(VAR,'y12',1,30500) LexToken(ASSIGNMENT,'=',1,30503) -LexToken(VAR,'part',1,30504) +LexToken(PART,'part',1,30504) LexToken(OPENBRACKET,'(',1,30508) LexToken(VAR,'y1',1,30509) LexToken(COMMA,',',1,30511) @@ -6542,7 +6542,7 @@ LexToken(END,'end',1,30679) LexToken(EOL,'\n',1,30682) LexToken(VAR,'y21',1,30695) LexToken(ASSIGNMENT,'=',1,30698) -LexToken(VAR,'part',1,30699) +LexToken(PART,'part',1,30699) LexToken(OPENBRACKET,'(',1,30703) LexToken(VAR,'y2',1,30704) LexToken(COMMA,',',1,30706) @@ -6555,7 +6555,7 @@ LexToken(CLOSEBRACKET,')',1,30714) LexToken(EOL,'\n',1,30715) LexToken(VAR,'y22',1,30729) LexToken(ASSIGNMENT,'=',1,30732) -LexToken(VAR,'part',1,30733) +LexToken(PART,'part',1,30733) LexToken(OPENBRACKET,'(',1,30737) LexToken(VAR,'y2',1,30738) LexToken(COMMA,',',1,30740) @@ -6619,7 +6619,7 @@ LexToken(VAR,'find',1,30990) LexToken(OPENBRACKET,'(',1,30994) LexToken(VAR,'TA',1,30995) LexToken(COMPARISON,'==',1,30997) -LexToken(VAR,'part',1,30999) +LexToken(PART,'part',1,30999) LexToken(OPENBRACKET,'(',1,31003) LexToken(VAR,'x11',1,31004) LexToken(COMMA,',',1,31007) @@ -6665,7 +6665,7 @@ LexToken(VAR,'find',1,31128) LexToken(OPENBRACKET,'(',1,31132) LexToken(VAR,'TA',1,31133) LexToken(COMPARISON,'==',1,31135) -LexToken(VAR,'part',1,31137) +LexToken(PART,'part',1,31137) LexToken(OPENBRACKET,'(',1,31141) LexToken(VAR,'x21',1,31142) LexToken(COMMA,',',1,31145) @@ -6711,7 +6711,7 @@ LexToken(VAR,'find',1,31266) LexToken(OPENBRACKET,'(',1,31270) LexToken(VAR,'TA',1,31271) LexToken(COMPARISON,'==',1,31273) -LexToken(VAR,'part',1,31275) +LexToken(PART,'part',1,31275) LexToken(OPENBRACKET,'(',1,31279) LexToken(VAR,'y11',1,31280) LexToken(COMMA,',',1,31283) @@ -6757,7 +6757,7 @@ LexToken(VAR,'find',1,31404) LexToken(OPENBRACKET,'(',1,31408) LexToken(VAR,'TA',1,31409) LexToken(COMPARISON,'==',1,31411) -LexToken(VAR,'part',1,31413) +LexToken(PART,'part',1,31413) LexToken(OPENBRACKET,'(',1,31417) LexToken(VAR,'y21',1,31418) LexToken(COMMA,',',1,31421) diff --git a/js/Sinks/WFILE_f.js b/js/Sinks/WFILE_f.js index 085cb023..c07e226c 100644 --- a/js/Sinks/WFILE_f.js +++ b/js/Sinks/WFILE_f.js @@ -470,7 +470,7 @@ LexToken(COMPARISON,'~=',1,3572) LexToken(DQSTRING,'""',1,3576) LexToken(LOGICAL,'&',1,3578) LexToken(OPENBRACKET,'(',1,3581) -LexToken(VAR,'part',1,3582) +LexToken(PART,'part',1,3582) LexToken(OPENBRACKET,'(',1,3586) LexToken(VAR,'frmt1',1,3587) LexToken(COMMA,',',1,3592) @@ -479,7 +479,7 @@ LexToken(CLOSEBRACKET,')',1,3595) LexToken(COMPARISON,'~=',1,3597) LexToken(DQSTRING,'"("',1,3602) LexToken(LOGICAL,'|',1,3604) -LexToken(VAR,'part',1,3606) +LexToken(PART,'part',1,3606) LexToken(OPENBRACKET,'(',1,3610) LexToken(VAR,'frmt1',1,3611) LexToken(COMMA,',',1,3616) diff --git a/js/Sinks/WRITEC_f.js b/js/Sinks/WRITEC_f.js index 5f47b46f..a8abc815 100644 --- a/js/Sinks/WRITEC_f.js +++ b/js/Sinks/WRITEC_f.js @@ -613,7 +613,7 @@ LexToken(EOL,'\n',1,4221) LexToken(EOL,'\n',1,4222) LexToken(VAR,'frmt1',1,4235) LexToken(ASSIGNMENT,'=',1,4240) -LexToken(VAR,'part',1,4241) +LexToken(PART,'part',1,4241) LexToken(OPENBRACKET,'(',1,4245) LexToken(VAR,'frmt1',1,4246) LexToken(COMMA,',',1,4251) diff --git a/js/Sources/CURVE_c.js b/js/Sources/CURVE_c.js index 8c7e3973..dc704261 100644 --- a/js/Sources/CURVE_c.js +++ b/js/Sources/CURVE_c.js @@ -6233,7 +6233,7 @@ LexToken(CLOSEBRACKET,')',1,29335) LexToken(EOL,'\n',1,29336) LexToken(VAR,'x1',1,29350) LexToken(ASSIGNMENT,'=',1,29352) -LexToken(VAR,'part',1,29353) +LexToken(PART,'part',1,29353) LexToken(OPENBRACKET,'(',1,29357) LexToken(VAR,'xa',1,29358) LexToken(COMMA,',',1,29360) @@ -6246,7 +6246,7 @@ LexToken(CLOSEBRACKET,')',1,29367) LexToken(EOL,'\n',1,29368) LexToken(VAR,'x2',1,29382) LexToken(ASSIGNMENT,'=',1,29384) -LexToken(VAR,'part',1,29385) +LexToken(PART,'part',1,29385) LexToken(OPENBRACKET,'(',1,29389) LexToken(VAR,'xa',1,29390) LexToken(COMMA,',',1,29392) @@ -6262,7 +6262,7 @@ LexToken(CLOSEBRACKET,')',1,29408) LexToken(EOL,'\n',1,29409) LexToken(VAR,'y1',1,29423) LexToken(ASSIGNMENT,'=',1,29425) -LexToken(VAR,'part',1,29426) +LexToken(PART,'part',1,29426) LexToken(OPENBRACKET,'(',1,29430) LexToken(VAR,'ya',1,29431) LexToken(COMMA,',',1,29433) @@ -6275,7 +6275,7 @@ LexToken(CLOSEBRACKET,')',1,29440) LexToken(EOL,'\n',1,29441) LexToken(VAR,'y2',1,29455) LexToken(ASSIGNMENT,'=',1,29457) -LexToken(VAR,'part',1,29458) +LexToken(PART,'part',1,29458) LexToken(OPENBRACKET,'(',1,29462) LexToken(VAR,'ya',1,29463) LexToken(COMMA,',',1,29465) @@ -6322,7 +6322,7 @@ LexToken(END,'end',1,29634) LexToken(EOL,'\n',1,29637) LexToken(VAR,'x11',1,29650) LexToken(ASSIGNMENT,'=',1,29653) -LexToken(VAR,'part',1,29654) +LexToken(PART,'part',1,29654) LexToken(OPENBRACKET,'(',1,29658) LexToken(VAR,'x1',1,29659) LexToken(COMMA,',',1,29661) @@ -6335,7 +6335,7 @@ LexToken(CLOSEBRACKET,')',1,29669) LexToken(EOL,'\n',1,29670) LexToken(VAR,'x12',1,29684) LexToken(ASSIGNMENT,'=',1,29687) -LexToken(VAR,'part',1,29688) +LexToken(PART,'part',1,29688) LexToken(OPENBRACKET,'(',1,29692) LexToken(VAR,'x1',1,29693) LexToken(COMMA,',',1,29695) @@ -6395,7 +6395,7 @@ LexToken(CLOSEBRACKET,')',1,29895) LexToken(EOL,'\n',1,29896) LexToken(VAR,'x22',1,29910) LexToken(ASSIGNMENT,'=',1,29913) -LexToken(VAR,'part',1,29914) +LexToken(PART,'part',1,29914) LexToken(OPENBRACKET,'(',1,29918) LexToken(VAR,'x2',1,29919) LexToken(COMMA,',',1,29921) @@ -6440,7 +6440,7 @@ LexToken(END,'end',1,30089) LexToken(EOL,'\n',1,30092) LexToken(VAR,'y11',1,30105) LexToken(ASSIGNMENT,'=',1,30108) -LexToken(VAR,'part',1,30109) +LexToken(PART,'part',1,30109) LexToken(OPENBRACKET,'(',1,30113) LexToken(VAR,'y1',1,30114) LexToken(COMMA,',',1,30116) @@ -6453,7 +6453,7 @@ LexToken(CLOSEBRACKET,')',1,30124) LexToken(EOL,'\n',1,30125) LexToken(VAR,'y12',1,30139) LexToken(ASSIGNMENT,'=',1,30142) -LexToken(VAR,'part',1,30143) +LexToken(PART,'part',1,30143) LexToken(OPENBRACKET,'(',1,30147) LexToken(VAR,'y1',1,30148) LexToken(COMMA,',',1,30150) @@ -6498,7 +6498,7 @@ LexToken(END,'end',1,30318) LexToken(EOL,'\n',1,30321) LexToken(VAR,'y21',1,30334) LexToken(ASSIGNMENT,'=',1,30337) -LexToken(VAR,'part',1,30338) +LexToken(PART,'part',1,30338) LexToken(OPENBRACKET,'(',1,30342) LexToken(VAR,'y2',1,30343) LexToken(COMMA,',',1,30345) @@ -6511,7 +6511,7 @@ LexToken(CLOSEBRACKET,')',1,30353) LexToken(EOL,'\n',1,30354) LexToken(VAR,'y22',1,30368) LexToken(ASSIGNMENT,'=',1,30371) -LexToken(VAR,'part',1,30372) +LexToken(PART,'part',1,30372) LexToken(OPENBRACKET,'(',1,30376) LexToken(VAR,'y2',1,30377) LexToken(COMMA,',',1,30379) @@ -6575,7 +6575,7 @@ LexToken(VAR,'find',1,30629) LexToken(OPENBRACKET,'(',1,30633) LexToken(VAR,'TA',1,30634) LexToken(COMPARISON,'==',1,30636) -LexToken(VAR,'part',1,30638) +LexToken(PART,'part',1,30638) LexToken(OPENBRACKET,'(',1,30642) LexToken(VAR,'x11',1,30643) LexToken(COMMA,',',1,30646) @@ -6621,7 +6621,7 @@ LexToken(VAR,'find',1,30767) LexToken(OPENBRACKET,'(',1,30771) LexToken(VAR,'TA',1,30772) LexToken(COMPARISON,'==',1,30774) -LexToken(VAR,'part',1,30776) +LexToken(PART,'part',1,30776) LexToken(OPENBRACKET,'(',1,30780) LexToken(VAR,'x21',1,30781) LexToken(COMMA,',',1,30784) @@ -6667,7 +6667,7 @@ LexToken(VAR,'find',1,30905) LexToken(OPENBRACKET,'(',1,30909) LexToken(VAR,'TA',1,30910) LexToken(COMPARISON,'==',1,30912) -LexToken(VAR,'part',1,30914) +LexToken(PART,'part',1,30914) LexToken(OPENBRACKET,'(',1,30918) LexToken(VAR,'y11',1,30919) LexToken(COMMA,',',1,30922) @@ -6713,7 +6713,7 @@ LexToken(VAR,'find',1,31043) LexToken(OPENBRACKET,'(',1,31047) LexToken(VAR,'TA',1,31048) LexToken(COMPARISON,'==',1,31050) -LexToken(VAR,'part',1,31052) +LexToken(PART,'part',1,31052) LexToken(OPENBRACKET,'(',1,31056) LexToken(VAR,'y21',1,31057) LexToken(COMMA,',',1,31060) diff --git a/js/Sources/READAU_f.js b/js/Sources/READAU_f.js index f91cccfb..51948b8b 100644 --- a/js/Sources/READAU_f.js +++ b/js/Sources/READAU_f.js @@ -441,7 +441,7 @@ LexToken(CLOSEBRACKET,')',1,3380) LexToken(EOL,'\n',1,3381) LexToken(VAR,'frmt1',1,3398) LexToken(ASSIGNMENT,'=',1,3403) -LexToken(VAR,'part',1,3404) +LexToken(PART,'part',1,3404) LexToken(OPENBRACKET,'(',1,3408) LexToken(VAR,'frmt1',1,3409) LexToken(COMMA,',',1,3414) diff --git a/js/Sources/READC_f.js b/js/Sources/READC_f.js index f6c44614..a2c7413e 100644 --- a/js/Sources/READC_f.js +++ b/js/Sources/READC_f.js @@ -952,7 +952,7 @@ LexToken(CLOSEBRACKET,')',1,6273) LexToken(EOL,'\n',1,6274) LexToken(VAR,'frmt1',1,6291) LexToken(ASSIGNMENT,'=',1,6297) -LexToken(VAR,'part',1,6299) +LexToken(PART,'part',1,6299) LexToken(OPENBRACKET,'(',1,6303) LexToken(VAR,'frmt1',1,6304) LexToken(COMMA,',',1,6309) diff --git a/js/Sources/RFILE_f.js b/js/Sources/RFILE_f.js index 0c37bbd3..d423d84a 100644 --- a/js/Sources/RFILE_f.js +++ b/js/Sources/RFILE_f.js @@ -548,7 +548,7 @@ LexToken(COMPARISON,'~=',1,3949) LexToken(DQSTRING,'""',1,3953) LexToken(LOGICAL,'&',1,3955) LexToken(OPENBRACKET,'(',1,3958) -LexToken(VAR,'part',1,3959) +LexToken(PART,'part',1,3959) LexToken(OPENBRACKET,'(',1,3963) LexToken(VAR,'frmt1',1,3964) LexToken(COMMA,',',1,3969) @@ -557,7 +557,7 @@ LexToken(CLOSEBRACKET,')',1,3972) LexToken(COMPARISON,'~=',1,3974) LexToken(DQSTRING,'"("',1,3979) LexToken(LOGICAL,'|',1,3981) -LexToken(VAR,'part',1,3984) +LexToken(PART,'part',1,3984) LexToken(OPENBRACKET,'(',1,3988) LexToken(VAR,'frmt1',1,3989) LexToken(COMMA,',',1,3994) diff --git a/sci2jslex.py b/sci2jslex.py index a3d973c7..bb8e945d 100755 --- a/sci2jslex.py +++ b/sci2jslex.py @@ -23,6 +23,7 @@ syntaxtokens = { 'for': 'FOR', 'function': 'FUNCTION', 'if': 'IF', + 'part': 'PART', 'resume': 'RESUME', 'return': 'RETURN', 'scicos': 'SCICOS', @@ -259,14 +260,14 @@ def t_TRANSPOSE(t): if afterarray: afterarray = False return t - t.lexer.begin('qstring') + t.lexer.push_state('qstring') qstring = t.value def t_begin_dqstring(t): r'"' global afterarray, dqstring afterarray = False - t.lexer.begin('dqstring') + t.lexer.push_state('dqstring') dqstring = t.value def t_qstring_COMMENT(t): @@ -300,7 +301,7 @@ def t_dqstring_quote(t): def t_qstring_end(t): r"'" global qstring - t.lexer.begin('INITIAL') + t.lexer.pop_state() qstring += t.value t.type = 'QSTRING' t.value = qstring @@ -309,7 +310,7 @@ def t_qstring_end(t): def t_dqstring_end(t): r'"' global dqstring - t.lexer.begin('INITIAL') + t.lexer.pop_state() dqstring += t.value t.type = 'DQSTRING' t.value = dqstring diff --git a/sci2jsyacc.py b/sci2jsyacc.py index 4f348864..daeeec23 100755 --- a/sci2jsyacc.py +++ b/sci2jsyacc.py @@ -19,7 +19,7 @@ start = 'functionblock' # define functionblock def p_functionblock_function_statementblock_endfunction(p): - 'functionblock : emptystatementblock FUNCTION lterm ASSIGNMENT VAR OPENBRACKET list CLOSEBRACKET EOL statementblock ENDFUNCTION EOL' + 'functionblock : emptystatementblock FUNCTION lterm ASSIGNMENT VAR OPENBRACKET list CLOSEBRACKET EOL statementblock ENDFUNCTION emptystatementblock' p[0] = str(p[5]) # end define functionblock @@ -45,6 +45,7 @@ def p_emptystatementblock_eol(p): def p_statement_assignment(p): '''statement : assignment EOL + | assignment SEMICOLON | function EOL''' p[0] = str(p[1]) + '\n' @@ -163,16 +164,17 @@ def p_assignment_expression(p): def p_ltermarraylist_ltermarraylist_semicolon_var(p): '''ltermarraylist : ltermarraylist SEMICOLON VAR - | ltermarraylist COMMA VAR - | VAR SEMICOLON VAR - | VAR COMMA VAR''' + | ltermarraylist COMMA VAR''' p[0] = str(p[1]) + ',' + str(p[3]) def p_ltermarraylist_ltermarraylist_var(p): - '''ltermarraylist : ltermarraylist VAR - | VAR VAR''' + 'ltermarraylist : ltermarraylist VAR' p[0] = str(p[1]) + ',' + str(p[2]) +def p_ltermarraylist_var(p): + 'ltermarraylist : VAR' + p[0] = str(p[1]) + # end define ltermarraylist # define termarraylist @@ -376,6 +378,11 @@ def p_term_index(p): else: p[0] = str(p[1]) + str(p[2]) + str(p[3]) + str(p[4]) +# A(2,3) +def p_term_part_parameters(p): + 'term : PART OPENBRACKET expression COMMA expression COLON expression CLOSEBRACKET' + p[0] = p[1] + p[2] + p[3] + p[4] + p[5] + ',' + p[7] + p[8] + # A(2,3) def p_term_function_parameters(p): '''term : termvar OPENBRACKET list CLOSEBRACKET @@ -401,7 +408,6 @@ def p_term_prevar(p): | PREVAR_FLOAT''' p[0] = str(p[1]) -# A def p_term_termvar(p): 'term : termvar' p[0] = str(p[1]) -- cgit