From 5c46f718ed6c2c37b92a28d2e46bacf306118978 Mon Sep 17 00:00:00 2001 From: Tak Date: Sat, 5 Jun 2010 00:45:41 +0800 Subject: [PATCH 001/276] Fill in more icon types. --- .../Completion/UnityScriptEditorCompletion.boo | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/UnityScript.MonoDevelop/Completion/UnityScriptEditorCompletion.boo b/src/UnityScript.MonoDevelop/Completion/UnityScriptEditorCompletion.boo index 04145f0..5eff1fe 100644 --- a/src/UnityScript.MonoDevelop/Completion/UnityScriptEditorCompletion.boo +++ b/src/UnityScript.MonoDevelop/Completion/UnityScriptEditorCompletion.boo @@ -114,8 +114,14 @@ class UnityScriptEditorCompletion(CompletionTextEditorExtension): def GetIconForMember(member as IEntity): match member.EntityType: + case EntityType.BuiltinFunction: + return Stock.Method + case EntityType.Constructor: + return Stock.Method case EntityType.Method: return Stock.Method + case EntityType.Local: + return Stock.Field case EntityType.Field: return Stock.Field case EntityType.Property: From 482a167b325d58811c410d25a94b41e8a5252672 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 11 Jun 2010 12:33:05 -0300 Subject: [PATCH 002/276] monodevelop adding moved to boo-md-addins project --- default.build | 46 +--- src/UnityScript.MonoDevelop/.monolipse | 29 --- .../CommandHandlers/withAtomicUndoOn.boo | 14 - .../Completion/CompletionFinder.boo | 29 --- .../Completion/ResolveMonoBehaviourType.boo | 23 -- .../UnityScriptEditorCompletion.boo | 133 ---------- .../Completion/UnityScriptTypeResolver.boo | 55 ---- .../Icons/UnityScriptFile128.png | Bin 15202 -> 0 bytes .../Icons/UnityScriptFile32.png | Bin 4340 -> 0 bytes .../Icons/UnityScriptProject.png | Bin 8408 -> 0 bytes .../Icons/UnityScriptProject32.png | Bin 4917 -> 0 bytes .../ProjectModel/DomConversionVisitor.boo | 244 ------------------ .../UnityScriptCodeDomProvider.boo | 19 -- .../ProjectModel/UnityScriptCodeGenerator.boo | 14 - .../UnityScriptCompilationParameters.boo | 6 - .../ProjectModel/UnityScriptCompiler.boo | 103 -------- .../UnityScriptLanguageBinding.boo | 54 ---- .../ProjectModel/UnityScriptParser.boo | 37 --- .../UnityScriptProjectParameters.boo | 6 - .../Templates/ConsoleProject.xpt.xml | 41 --- .../Templates/EmptyUnityScriptFile.xft.xml | 19 -- .../UnityScript.MonoDevelop.addin.xml | 88 ------- .../UnityScript.MonoDevelop.booproj | 72 ------ .../UnityScriptFiles.boo | 5 - .../UnityScriptSyntaxMode.xml | 231 ----------------- 25 files changed, 1 insertion(+), 1267 deletions(-) delete mode 100644 src/UnityScript.MonoDevelop/.monolipse delete mode 100644 src/UnityScript.MonoDevelop/CommandHandlers/withAtomicUndoOn.boo delete mode 100644 src/UnityScript.MonoDevelop/Completion/CompletionFinder.boo delete mode 100644 src/UnityScript.MonoDevelop/Completion/ResolveMonoBehaviourType.boo delete mode 100644 src/UnityScript.MonoDevelop/Completion/UnityScriptEditorCompletion.boo delete mode 100644 src/UnityScript.MonoDevelop/Completion/UnityScriptTypeResolver.boo delete mode 100644 src/UnityScript.MonoDevelop/Icons/UnityScriptFile128.png delete mode 100644 src/UnityScript.MonoDevelop/Icons/UnityScriptFile32.png delete mode 100644 src/UnityScript.MonoDevelop/Icons/UnityScriptProject.png delete mode 100644 src/UnityScript.MonoDevelop/Icons/UnityScriptProject32.png delete mode 100644 src/UnityScript.MonoDevelop/ProjectModel/DomConversionVisitor.boo delete mode 100644 src/UnityScript.MonoDevelop/ProjectModel/UnityScriptCodeDomProvider.boo delete mode 100644 src/UnityScript.MonoDevelop/ProjectModel/UnityScriptCodeGenerator.boo delete mode 100644 src/UnityScript.MonoDevelop/ProjectModel/UnityScriptCompilationParameters.boo delete mode 100644 src/UnityScript.MonoDevelop/ProjectModel/UnityScriptCompiler.boo delete mode 100644 src/UnityScript.MonoDevelop/ProjectModel/UnityScriptLanguageBinding.boo delete mode 100644 src/UnityScript.MonoDevelop/ProjectModel/UnityScriptParser.boo delete mode 100644 src/UnityScript.MonoDevelop/ProjectModel/UnityScriptProjectParameters.boo delete mode 100644 src/UnityScript.MonoDevelop/Templates/ConsoleProject.xpt.xml delete mode 100644 src/UnityScript.MonoDevelop/Templates/EmptyUnityScriptFile.xft.xml delete mode 100644 src/UnityScript.MonoDevelop/UnityScript.MonoDevelop.addin.xml delete mode 100644 src/UnityScript.MonoDevelop/UnityScript.MonoDevelop.booproj delete mode 100644 src/UnityScript.MonoDevelop/UnityScriptFiles.boo delete mode 100644 src/UnityScript.MonoDevelop/UnityScriptSyntaxMode.xml diff --git a/default.build b/default.build index 06ca6fd..fb45e1a 100755 --- a/default.build +++ b/default.build @@ -6,7 +6,7 @@ - + @@ -141,50 +141,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/UnityScript.MonoDevelop/.monolipse b/src/UnityScript.MonoDevelop/.monolipse deleted file mode 100644 index 9aa3d35..0000000 --- a/src/UnityScript.MonoDevelop/.monolipse +++ /dev/null @@ -1,29 +0,0 @@ - - boo - library - - - /UnityScript/src/UnityScript.Lang - - - /UnityScript/src/UnityScript - - - /MonoDevelop/bin/MonoDevelop.Core.dll - - - /MonoDevelop/bin/MonoDevelop.Ide.dll - - - /MonoDevelop/bin/MonoDevelop.Projects.dll - - - /MonoDevelop/bin/Mono.TextEditor.dll - - - /MonoDevelop/AddIns/MonoDevelop.SourceEditor2.dll - - - /UnityScript/bin - - \ No newline at end of file diff --git a/src/UnityScript.MonoDevelop/CommandHandlers/withAtomicUndoOn.boo b/src/UnityScript.MonoDevelop/CommandHandlers/withAtomicUndoOn.boo deleted file mode 100644 index 21b8728..0000000 --- a/src/UnityScript.MonoDevelop/CommandHandlers/withAtomicUndoOn.boo +++ /dev/null @@ -1,14 +0,0 @@ -namespace UnityScript.MonoDevelop.CommandHandlers - -import Boo.Lang.Compiler -import Boo.Lang.Compiler.Ast -import Boo.Lang.PatternMatching - -macro withAtomicUndoOn(buffer as Expression): - yield [| $buffer.BeginAtomicUndo() |] - yield [| - try: - $(withAtomicUndoOn.Body) - ensure: - $buffer.EndAtomicUndo() - |] diff --git a/src/UnityScript.MonoDevelop/Completion/CompletionFinder.boo b/src/UnityScript.MonoDevelop/Completion/CompletionFinder.boo deleted file mode 100644 index 2264b5b..0000000 --- a/src/UnityScript.MonoDevelop/Completion/CompletionFinder.boo +++ /dev/null @@ -1,29 +0,0 @@ -namespace UnityScript.MonoDevelop.Completion - -import UnityScript - -import Boo.Lang.Compiler -import Boo.Lang.Compiler.Steps -import Boo.Lang.Compiler.Ast -import Boo.Lang.Compiler.IO -import Boo.Lang.Compiler.TypeSystem - -class CompletionFinder(DepthFirstVisitor): - - public static final CompletionToken = "__complete_me__" - - _type as IType - - def FindCompletionTypeFor(node as Node): - VisitAllowingCancellation(node) - return _type - - override def LeaveMemberReferenceExpression(node as MemberReferenceExpression): - if node.Name != CompletionToken: - return - - Found(node.Target.ExpressionType) - - protected def Found(type): - _type = type - Cancel() \ No newline at end of file diff --git a/src/UnityScript.MonoDevelop/Completion/ResolveMonoBehaviourType.boo b/src/UnityScript.MonoDevelop/Completion/ResolveMonoBehaviourType.boo deleted file mode 100644 index 1dc8a8c..0000000 --- a/src/UnityScript.MonoDevelop/Completion/ResolveMonoBehaviourType.boo +++ /dev/null @@ -1,23 +0,0 @@ -namespace UnityScript.MonoDevelop.Completion - -import UnityScript - -import Boo.Lang.Compiler -import Boo.Lang.Compiler.Steps -import Boo.Lang.Compiler.Ast -import Boo.Lang.Compiler.IO -import Boo.Lang.Compiler.TypeSystem - -class ResolveMonoBehaviourType(AbstractCompilerStep): - override def Run(): - type = FindReferencedType("UnityEngine.MonoBehaviour") - (Parameters as UnityScriptCompilerParameters).ScriptBaseType = type or object - - def FindReferencedType(typeName as string): - for reference in Parameters.References: - assemblyRef = reference as Boo.Lang.Compiler.TypeSystem.Reflection.IAssemblyReference - if assemblyRef is null: - continue - type = assemblyRef.Assembly.GetType(typeName) - if type is not null: - return type diff --git a/src/UnityScript.MonoDevelop/Completion/UnityScriptEditorCompletion.boo b/src/UnityScript.MonoDevelop/Completion/UnityScriptEditorCompletion.boo deleted file mode 100644 index 5eff1fe..0000000 --- a/src/UnityScript.MonoDevelop/Completion/UnityScriptEditorCompletion.boo +++ /dev/null @@ -1,133 +0,0 @@ -namespace UnityScript.MonoDevelop.Completion - -import System.Collections.Generic - -import UnityScript -import UnityScript.MonoDevelop -import UnityScript.MonoDevelop.ProjectModel - -import MonoDevelop.Core -import MonoDevelop.Projects -import MonoDevelop.Projects.Dom.Parser -import MonoDevelop.Ide.Gui -import MonoDevelop.Ide.Gui.Content -import MonoDevelop.Ide.CodeCompletion - -import Boo.Lang.Compiler -import Boo.Lang.Compiler.Steps -import Boo.Lang.Compiler.Ast -import Boo.Lang.Compiler.IO -import Boo.Lang.Compiler.TypeSystem -import Boo.Lang.PatternMatching - -class UnityScriptEditorCompletion(CompletionTextEditorExtension): - - _dom as ProjectDom - _resolver as UnityScriptTypeResolver - _project as DotNetProject - - override def Initialize(): - super() - _dom = ProjectDomService.GetProjectDom(Document.Project) or ProjectDomService.GetFileDom(Document.FileName) - InstallUnityScriptSyntaxModeIfNeeded() - _resolver = UnityScriptTypeResolver() - _project = Document.Project as DotNetProject - InitializeProjectReferences() - - def InitializeProjectReferences(): - if _project is null: - return - - for reference in _project.References: - if ReferenceType.Project != reference.ReferenceType: - _resolver.AddReference(reference.Reference) - - def InstallUnityScriptSyntaxModeIfNeeded(): - view = Document.GetContent[of MonoDevelop.SourceEditor.SourceEditorView]() - return if view is null - - mimeType = UnityScriptParser.MimeType - return if view.Document.SyntaxMode.MimeType == mimeType - - mode = Mono.TextEditor.Highlighting.SyntaxModeService.GetSyntaxMode(mimeType) - if mode is not null: - view.Document.SyntaxMode = mode - else: - LoggingService.LogWarning(GetType() + " could not get SyntaxMode for mimetype '" + mimeType + "'.") - - override def ExtendsEditor(doc as MonoDevelop.Ide.Gui.Document, editor as IEditableTextBuffer): - return IsUnityScriptFile(doc.Name) - - override def HandleCodeCompletion(context as CodeCompletionContext, completionChar as char): -# print "HandleCodeCompletion(${context.ToString()}, ${completionChar.ToString()})" - - match completionChar.ToString(): - case ' ': - lineText = GetLineText(context.TriggerLine).TrimStart() - if not lineText.StartsWith("import "): - return null - - return ImportCompletionDataFor('') - - case '.': - lineText = GetLineText(context.TriggerLine) - lineLength = lineText.Length - lineText = lineText.TrimStart() - trimmedLength = lineLength - lineText.Length - if lineText.StartsWith("import "): - nameSpace = lineText[len("import "):context.TriggerLineOffset-(2+trimmedLength)].Trim() - return ImportCompletionDataFor(nameSpace) - - result = null as CompletionDataList - text = string.Format ("{0}{1} {2}", Document.TextEditor.GetText (0, context.TriggerOffset), - CompletionFinder.CompletionToken, - Document.TextEditor.GetText (context.TriggerOffset, Document.TextEditor.TextLength)) - # print text - _resolver.Input.Clear() - _resolver.Input.Add(StringInput("completion text", text)) - - result = CompletionDataList() - - _resolver.ResolveAnd() do (type as IType): - resultHash = Dictionary[of string,string]() - for member in type.GetMembers(): - # print member - resultHash[member.Name] = GetIconForMember(member) - for pair in resultHash: - result.Add(pair.Key, pair.Value) - - return result - - otherwise: - return null - - def ImportCompletionDataFor(nameSpace as string): -# print "ImportCompletionDataFor(${nameSpace})" - - result = CompletionDataList() - for member in _dom.GetNamespaceContents(nameSpace, true, true): - result.Add(member.Name, member.StockIcon) - return result - - def GetLineText(line as int): - return Document.TextEditor.GetLineText(line) - - def GetIconForMember(member as IEntity): - match member.EntityType: - case EntityType.BuiltinFunction: - return Stock.Method - case EntityType.Constructor: - return Stock.Method - case EntityType.Method: - return Stock.Method - case EntityType.Local: - return Stock.Field - case EntityType.Field: - return Stock.Field - case EntityType.Property: - return Stock.Property - case EntityType.Event: - return Stock.Event - otherwise: - return Stock.Literal - \ No newline at end of file diff --git a/src/UnityScript.MonoDevelop/Completion/UnityScriptTypeResolver.boo b/src/UnityScript.MonoDevelop/Completion/UnityScriptTypeResolver.boo deleted file mode 100644 index daab522..0000000 --- a/src/UnityScript.MonoDevelop/Completion/UnityScriptTypeResolver.boo +++ /dev/null @@ -1,55 +0,0 @@ -namespace UnityScript.MonoDevelop.Completion - -import UnityScript - -import System - -import Boo.Lang.Environments -import Boo.Lang.Compiler -import Boo.Lang.Compiler.Steps -import Boo.Lang.Compiler.Ast -import Boo.Lang.Compiler.IO -import Boo.Lang.Compiler.TypeSystem - -class UnityScriptTypeResolver: - - _compiler = UnityScriptCompiler() - - def constructor(): - pipeline = UnityScriptCompiler.Pipelines.AdjustBooPipeline(Boo.Lang.Compiler.Pipelines.Compile()) - pipeline.InsertAfter(UnityScript.Steps.Parse, ResolveMonoBehaviourType()) - pipeline.BreakOnErrors = false - - _compiler.Parameters.ScriptMainMethod = "Awake" - _compiler.Parameters.Pipeline = pipeline - imports = _compiler.Parameters.Imports - imports.Add("UnityEngine") - imports.Add("System.Collections") - - Input: - get: return Parameters.Input - - References: - get: return Parameters.References - - Parameters: - private get: return _compiler.Parameters - - def AddReference(reference as string): - References.Add(Parameters.LoadAssembly(reference, true)) - - def ResolveAnd(action as Action of IType): - context = _compiler.Run() - #DumpErrors(context.Errors) - - Environments.With(context) do: - finder = CompletionFinder() - type = finder.FindCompletionTypeFor(context.CompileUnit) - if type is null: - return - action(type) - - private def DumpErrors(errors as CompilerErrorCollection): - for error in errors: - print error - \ No newline at end of file diff --git a/src/UnityScript.MonoDevelop/Icons/UnityScriptFile128.png b/src/UnityScript.MonoDevelop/Icons/UnityScriptFile128.png deleted file mode 100644 index 599c4edfa56633a39a8b3bbf2230e1d13fd71472..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15202 zcmW+-by!qQ7higTrMslNyStGTkVZmEq>=7!B&1uqyJKmP7Nk>3y1Tyne#^%5+&|{t znK^ULFAkCFs`6+k#3&#T2u)Ez<^%8>@ZSfF2z>X8nT~-#C~7v+((3Bg4z3O^)((yo ziqg^)j?NC2HeW43Adls2O)D+U1ANiD^=qm35dq2X9X{ZJDLzO=2jC{qF;OC8Dn(G{ zFX3tQV#&(FlZ@m=z{SM{#NcVLK%!6F-$5FFyr!>!kT7Cu=RPS6LAIdU~FEEgFtx+c))D0UOXnzt0yP< z;+oMvu^#pyzEPQ(ZNKhLRX9q3KwGYUGp{V{4a5P$hyix51+=H|*2buL-|nI<>oFvn zKzRqtI#-VWt&ME{_qL^_-JP99r2#1e(_cEiuU37ZpgJ#KAN)j~?`}4`|I!3<83oG2 z-*5JfUn>`pP9-9Tn62)`%RjfEzCDx8QVl4Ywdpe9ZfjsW#mQvETyYgqMM@#D~EkkW5}6Q>`S)buS?c6p^$SVYL_a*@Q1die{is3R4Q@ za{#Hc31elD6hqiVEg6#u`p?XfS(3C zQksjt?K`YuU7^-*?B8;~?LSZ-u#{!;C=gR8jV^z-tw$0}W}#pn3Ej!w>EGerA=#n4 zG(gEVlW;1$*Zj-y;nx=>qFu~go?S$XG%iW)pBW$4O7pd_c;oe@s`8sZ)M$j4;_!US z5S$3cSA1VoRq$h$*qXrl&Zg#{YdhB3k9Vr6(>lM$4&?u({)4-AhoFVw1rJA9F%V@E zA`w~#;3fP*`JwcK?gt4IyH;6wart^V zs`i!km{xq5v8HdeoHn=Sb{XJq4mm4lB_c(#u=LPa9vZNkWl9UMB|;GWOw>3k_+behKL!(;ud( zTOkQ;Ga^6#$i>QG#MlfOZqsbr4cQI-q(h{mqtE5deNwp$p-m1U$qItBrtc9p{cM)-=y4kMT*VM|4z^Y}iy8kq(E6KOrH}*vo z2`zjHy@E`i%+ICK8CU3|(0ayX)~UGf;C0FYyOr(~=F}qhb~DZxF}74OwoHbKlr#7eItGVMmxr{k_ z+%D7oBhs51yEEdbxj#5;H!A(qq}2kgn)a#L&Dj%lsupTnirmZZOwS0!ZpEB)x5c(a z_}97C^*)XBLt92##?<;9az2G_Nc&U2eSY(Ln*o&s(85^3MFvU+8o)l?d-+iI#EA>7 zSlrexok+&ywMpVh#s^ge?e@ibBxd>p5aX8b)Q+4cG-}5lu40U&$QxH6RcrX;$;#mXZs?u%-_z_Ew8i`Hl}Jm`>)*_&nH*mf3yFhZhI4?v5y!zdgf2|U5A$7m$6~92&G6UN2m%U zpG#sgmEyJdIzk+(3 zU~G?2wNZ9MeUDZbPK?xa+4VM>OdrFtNyP9XqpERN2vYI<7a3MPc1gk=e)XiUCO4K< z477covixm%u(!^dV}PDgp1PNcZjZLK+=#aEvGL^QR(6Fwb%J4~Be+?*?PrfjYo|rY z=;Va3xK^Rowbr8+-|6qQCewv``qGoJ^N~FIFnRZD_L(~?8XuZ= zY}U|UYDXE*or62%jk|YfLd$M3-j!QOv*d1MR%Gm7q%tlu9z1b z;s&p)i)X9;U!d-JS2L^fcZi|EQ?Cg(@fgww@#*nnVQ67TIRavWf`7%GUk;v2q^CYl z(d7`l7QBvC6X3J^-TygSn4C$Q$xppZP3p1pDSA1C9ud{74D}7Y>mK#s<}|+k_;k|i zzUoeP_HzS6ZO4bgpW)5=q3%X=y5uQ|C@JX;9xmIyxxNbsYI6EkU&@ce-Ow@Bszn{rvNn!a7tE z{0Qq`Kv{mDVHhC&@J4Jp&y6;-NRW429`Iwe7m)q{3q3Vy>HdXGKD%)TJG+}OqOl)U znE_J=8tU+yAWQ^`cM>cCX&2kWpKivvr^LG7puPPTyLf@cd-%)Cd&Q@27&l(Nja_R$ zclP)FFQ8|B?mEiKF(#21hJl5y+!M{h>@WZn4!n6W2 zQ-!ssENxY3X`#0EpT_3mxcNVSW`~ODmQOF#l^7?cralS#K3*HIO@PzJAou6BQwDB- z4qWM;|EBhIKCOHE`+YiF@6vqn6K5#e)Wv5R4m8)TB}GlK=yhZfNI@9pFcCyoEy1a( zs>)^8t=){v%F04~dA^QpWv^<9aG`@aSW-mSTBz){P^r2WHymjDZjo>$&F z0Hbg~1mfU^ofsGxJlMIpuh7S=J{T@_yI4-?J9pto#JsySABrdUpYXO_sH!Tf(k!?A zVx#AYz*+-L=MV4yr?bF6Jv2nOJoj75U}f3b+gtd?t84D;Zq|fD0Z%qR1oO+<$4cFc zq*|0MCHPi&2$aHy6hsTWcHMit&#hY4{GO(OEeqN>!|=Q$63IckdPS##DWZ31-3lvP zX>q9OnfnP^kq)%#41D|*M$b@Vg7#m9B(cM-;wNG>KA9_m6WV;lgz+C+Gl zl}9F?G;%JFGu1{a|@Mi55iMMDJ>hhS?} z-^drPsgsCKY_UqF8CKFgv)M`uQm5o4WRpxawc$(}L-g5Ea%=P# z5K;Pi+IDc=`E`+ep9IcbH@ba0_9rr1LQKy6jJ2&B=$&_;;dSpAUfPM->QQLDfNUplcY+DiUh%K@gkRc_Mlz zYJmCgLPZ_B)kYgTbIk_*Pa6^y<>fXi1aO~>jEo+qr7>ROX%x9ZF)$n`P)v|-zT#-y zDfVjz4su~i`QWc}J&=-|oZKNC#`EbuDgo=`kJ*D5)PEM)6kxhKbM}B$7zqOdgBMix z&f2})x99zEG&HoEN8U1!&*Lc)#nD;9>0j-&&^3~UF}*KdgIkWR`0RT1=Pf-iC(<@H z2hwouK4Z@9Q40uABv_cK6^EXeUK}-%i`PgT`l#y`JhJP6ZloI{WbOcFrA-9bDOr>| zma%sGhu1rY#n*@Z+@_{B8((1c%gTzr-P|;lzBn} zgOTEl`EBQG*6dq!?mkn`A+dJEs5gKmOW&6oc!({aDG9qYPVPDnvVD3D|0H@dr#YpT z#o=TLJ=;g7-Gqe3ZI5T8u1w+k=%vi8ugBfGVLTQW-`d#Ous&Rlv0u8@uE2QQ7@oyr zUfQ^$K8@3Qkj-Csy$hg(Y0o9wc1CVfyO(C%SHP0sm#&+~3RqmG(U zDFYWXv-9UoBE%S4ge=zc^76i;8%j*D^+T9>FBc183Je_L%#4PB>%ZxggV_@HTd%IL zVdgc?)lcP!gvPVNAjjZv2+{fPG4{8g)z#g9C_K?(W64Idr{v*!DYUh2Do4qRlCh<% zy*tABcz6y6>Js?)Tc%S|J}xiM%dM>1AG&o+#O3N3`|kR^WYD6Ln|i^5Qlo|&K%Yxy z4}3NQH`Xp1a$kis!#^ku#oPkz^bnxA6(nz1U5jg^+6V(k3JMEtDFZf#;8yOxM62v9;Sma)`0Z-OpB|9a{pqY zt1@_mvT30gHoP6mGG?NSC^D64V!H`vLU__?0!o=-o8y5!Aq9qA5Wib>>CvnIJem|X z#|)Ojox1w@;lqdGoA+uxQ3N42kpAo9FLLu!)?L8ew_v*VT>mSOYS;z2b`B_Bi`3bCk}KFu;)B&24jdN zCU9C8Z0y73%Q#GKvJu|Ta(R<^=t^}ZT$y%<9Xy1n&&_FVpKtXGIPZX&n3&Yn)g=Vt z%!7L=z?3G0h{_z4DUKH6lcjE|{IvN~f?+FS!{w4Z3fr-AXeh=6SHil4|eScmre6W-B*FNkjpMfEcBXkAcBc z-1`YoYcxmQMhRisxD{3l?|i- zD<~^Kp)rup78aD=_h3>nXWX-%J2ruoNFQu!{Zb}uY-~#zS=oknYQhJjhyjg_jf?W{ zjBc~~xBd};;g4~c1kg!qFlH{Z_SzuPVMBD7N(sM9+`~x}!87Sy8=r57HkK?5CRU`s zb!IPRmVqSJyL}g%gb6a7>ghIY#c7MJ#@@rg1%8UxQ z=ya_M7>u+vxak0vsXBVdI zj2TF1W>)syI+yBHJ&VXYjEoEf8alc({@?po{Ux^WWND)23r8ok@05oyxT&lO4(^^V zmcn97tExCPqk!B)h{%?T`to?wKb_yt;dRXbAr~VZ9UXOSGn7-oP>-7D1v_+T5Xh!Bx5d_x}}z1|bjQ^v7HOcGduHPGfnP73V!s{cu&4Qf)-(`OG+W4l+<8kG*NqP6p% zb_<{zk4}AE%RCr|vMswj_r7Bn7kBeN!e@C+ZA3B{2SaCNQBm{r_z+S7O!o~Zr26^> z4v%w_f#G3kTv>)FSZ!@dup|W`PX*3L404gFpJi=$B>Z0kR@N-xbTx1X25C3vSL}yJ zgUlD3Pq;OOIb@hpXL*ZsYSu4eV{ceR84)-h8Fc4V_}6$+F<~{Zzp?N4I_bN|Vx7jC z8o{};rWzQNm^7FkX5%^5lJR(RK)M&N5Y~0uuuD)-g?3Dp7(0#G_r}wMH^eW&f4BcC z=Z9mO{ThvO zd?mGooY~l)OqL#1cy2H3g9nglw-e;wNhUL+^qNfT7Y7!V)F2`R4v!XaeO+#a0b&Ls zkrJ$Mwm^QhKNSvj86o5W+t}DJFfwu~(n&}%T9})gTf(+}h6J1x;O41jh}bv+HI8)H z3DW~62zn$BBQhn8dHi|06zmb#K!|EJdls9`8J8loPK<~CP9$W(*c%Uc7FPb%(+B=F zSDX}9gRs(428MDo2Vx89BN&-O#vK9lD5W}^SvuTorp7>rkcUi%^!Q3sX^Dua`+JWV zVnHrtT{BDw{P(muTT4Sj(v?{VsDNQ8x?lt)2o$*QIxT2`2hHsAF%2;Adj857Xfa+2 zk{+L#BTGW{@x2Ed`#e}=v9Q3;BHv%_P4w6Aj%~RLNotwFk~mqRNzYOxCbV}8`M~G; zU2?Y8PJt0&3B{aw_9nWJS;nA*1jM{vJOXhIXtQ{312jVs$PVq{o--Y~iQ>f`8E6!Lcm6PMiWZX| zS%^dcL60y@)}Cx<)OC=;XKipivZ@(Y-BvKBOWfHTAn*ZL)N&L;Ld1a*&`!Sc7xrrZ zH<*RFg+KVW$>6-~h;73Dm8z|reIE18iSue3n98DObE19)shr_HsJe7CF9fPNEIdD?XUAOo0PZEiV$ci;qDWKz#C)M;M36@zgHZHnt0WPr zIN!)V=w$8UU3(e3prNgYTrykc%N`b3F!C>Hm4JUL6Df@H{E0_9VOLkPgHYU0r2F;J zHZzbZDya27q{7_H%xulx-9U{K2L*JV%tI=kZU?^zYxWJ>np3ZDoy-?>-Y;@p8nE zf22Yvq81xHxo>w)Vf(rGBpC=Hf9F@uq@2%aw32nKHB-NB1B88slk?w7OU-=T5XWA- z6w8=I!Y(BoB6`O8L_&YAyE`05^zQBL?a;4Zzq-n7%1|3S7dT-}b9X%s9lQp=7g+?aiFHnNMa3-Vd_-Bjq9>NgI<}@FI?Xo+pT&`MDiz?-AV4o@j^l7p_2!b@O>RAtFC5C zkx@+bB1*c+9N+MmaI4%`IkS>_DTMUr6&EAMvl+y#t{MU4K^=E+Zw3IAE_>s>xv$ss z1A~Ksri22d=qqfB=mIoIr0B@#ia|TyDHO3~G(s4NYG@S_BY-?Z`anlc?pI40v`!Aa zPH%ARzgY;}7mP?O&7Fc#Ox#RvoWhaCLPka=6t=9i3z?3Pu(PwXH-zPmZvO=WgOXEH z<|_?aPK{E>Z02VXJLE%(W6npQx+9>UX72nTI1lr5Tm;b7-)Qzu9e}yh zMSd8$T8g8=+-h6GK8*!UFD^z{jHQ?l$7Mwny(_{+#b+5vQWFgw7?9y$K`QAl^X!-f z4jOVvKXN$mo&~;PN;JJsT-&bKkWJ`HG6VtQUQJF>e<};^+=R3CIy}DmZQe za=+bDy@mhB$mKec5}Y6cbjSDaQGp5&XSX62y~tiV!WCv=VZL|MP`5uO0&hW-W%04L zoGDUjD{L5do_O+xc?q4~RrkKYe5HAHyMJVdQMaF$}3Vat-f2 zs3RWq9e59COEBbOi9`GPq#Q}3XUyqLmg?mjEGIG^{Ox;QZmoKbz);s2!5Cu+B#@Q9 zzJ5)%uzNKzkM*?mPe`8)*w_PYeswNH{CO*Wv3+-YwpqXKak@U;+?2r{H~HV(09Tf6 zqS|{HX_yyx=>@7W$(1x%T3jZLi;?=_^Js7XuV0XamT$umHNFr%&paZ%Zbaef-v0Zk zpmZ2J{LUNFvf)PpYJ9u%f4fte5_|f}CUr&EeN$DDDMbVdS~?oH)TZt5VRb%n5 zxuFiJW+jA}EytvLYz882Itxkl|Jk!HHoD|Ps?{BuL*%nxjUZ~M9%lDH?c2@j)nXfU zNq?#F@C9s_o;0~(RHsw~=kjp6D6&<9!IXoct)(TO7wv#-r~Q%r$TI10M*r`nr6och zYfK4KTPi1^>~!Xjl^&FwoC&jMhWjv-v zlc`gq#SZt}6Dt6dZhWdU8#KqKKWt{C$ij)h!^1xwyqukm^xDb^)!k~TH~6dCLV^cqkyTMhcsi=loz}$TA@GU zL`r;kl#d;h&TSR6KY7yZ`>>m;+w=twS1=;4ax;viy2ZDqva*s0n7^#;LiNjhNg}tA z51V-thWX4ML&+>rm-pT2!cZ)U`;R8sa_Rfp)$8J7y3V>w)=Ix8ySYDqBrs(|5VeRJ z=+ppgrdezZ2mvOrCD^bjrkk$q(0T~G1{X55Ii(H25Lm{fa1k`~%yjX4O+e&!%OM2? zQW1|E#JT&f?dR7GQ>M2!`+RA4J4tGPf$;Ok!o&OTpo_fT91B3^G!P;4z5h*1TZ&KX1E`+b{EESm;^pq&MEqeNRh^AZP6+0R{i5SeNoO zs;V9d1=EbxTie(S{nMbXyAO9?V*4vqCB#XI<^OW^#!H{^6V)ZELaP+`^&xRM@llE_EoaXH+W{8+~cRg<}6FBs$K4(AU#hCt8GeVc?t)Da5 zSr|$WfpTm9cOWw91dHNp479$@kPSk{MaTpb6&*cuY7bY^5>E1t?EI>?rs%36Vs&+$&cQ_zo4zSk^SA>>@)z|>;U*YSs{eu_nvbb zhle^Mm@qjx8G2$ryAQS&fm*jMcl!zhtdY}xwUzAwR<$JL-=fFPj*tB$_V0o?KEcBB za+C$t+`#+RMeZDCt6}uYPd&y4jr#mFvKpHFJpn9Tn9{ zumWZagP8`;1l)OuTqaP;+=H(y8v96^aROArd)DsnoN ztbl=m0d#+A#ScRTve9(MYaMsNfB%}j4JJpk&wr>>4)I4VDk|cwtE)SnE7L5=85;%W znvgP20AbE6Y=l3tZ`u1%OjTO7oRX9j+}hg8#tECV{rxvTT8E2!ep8cdw8*sn2xAcg zJ9GcQs17x4n_9^}7#`N+cFAgHZtnA>J=d>aK!!3qUCsRJ?3{)L(QmY#x%Yj#^))m! zJnqt!bF5oHLC+OtI9YAGx<6iOXqcUyMamhA1lZR1Wqu+S_PokQT>DutAvYNa8b>DF zJ`PTNqRC$)7+7b&3)t3`&;bj^NxQgk#b}S(!1v?Z&n`Es-1biBwp3xXV1w;z51C`nawcNjX& zuYcsz_!&xiz#gz7VZ3{8t%%)RQG(eTP+x6v*eKiT52ueM1bmgYoVhJW3QP6OV(aeH6^Gxd2g!6o0q74sc4>%2V&OdkD!wuRoxMM?V|A#&n@o>l z*FD{xiHiXO?kIrdx~Ax{1+uXV3d}VOKg77T2sf%?9v^H<#Y*6M(A=oX*`Km`h@3P> z{5-VSnzJpTrWDh{_X9Rvx67-kivKsqy7#GGRO8$n$ELKO882iOtc9mq!fgSB$V;y0 zUV78oD9Adk(MATLx~OQ-8z@tn(SXo8QD5m=O|Pn`7}!tQi$@k-pNQScDi=`e`d_xx z_$iltm-=so9|0|PLZDV$&HVH+f^y8Mw4x$($INOs**5R`8n>WZ_ z78dIxJ{M>JFe>{hYPyAd&o_JfCl`bTQzVs@gDl}sPMZB-&0!-`&?h$l{lg3}F&xVADe8R13Z2AE{<@|LRIBs(RbM z9W^QpgdK~qvAq+2T2f0$OS8s!*)siv^e#C_;z)yIWtAaRN~@5jgr?fC?NTLvSh_t4 zh9f(M02~_|o0CMZ_Hos7KYM`_LY-5C1(})*VrD`qvpE=$FThh$CAlxCRV9LmaWTUfgG z<-v%-e2x$`zyQYdKtJp0K@Y*q67j@-czE#G&vwToA&Hg@Ml=O{NkVQ*h+G_LBoMaf z)IS!K(_=F2yAdijyk_YxgtAn99%R`(jE`%*(kLQECV#;W*I|KkPPce=PNuDhLP=ma zy~rd(7Z(@PLFlf-xR^HPFcARc6cz)Fy&WK-SQ$+dG_Xio{V+q2lmHyE3(v{@bFbyz zBOD=txL}sC((39Vz-_uXD9JSg9NWbPD~vC;wt$HMXahjPggUVxeufO4uC7_z*mG5& zRlSdt()j#Dg=+%65J_Rt3wnKdS_x&5nl-hIsJDS8h z2u4>B=JsU8{rSHY+6f5>DU7}_1=be`C@B91DKCLD*JZ0I=6~CBm0ws0-{F2X1hAW0 z&nwI0jUI9p6%~ckS(2GLr^VcsDfkTmx3mG+sOxK<=j#&j8B1in{?3H$SOp12hDxJ} zk5lx;Sn5iYW6op0elTyKz{56n6oO?1lUbe8!h&0k1=DrO09(C zVrP4v_m^W`BjS%L16YFQN-Y=MQsDCPa&>+EC{}}J3N|)$K#~YyPy`<`$7ELn$Yxwh z%FGOGowOv4B*K#)LO3KDvmoPN1*4{g@(ZTEl139nQ7wO;%&o_Eihp?&4elIP-NnTP zL;QMLn!s*vyw+5j({`SPW`LfG5R%pqE8L|~$%iq$>)d) z9l@gJaiIGsaYLu2efLG``T-4IhH}pkNxO-^xm_g!tH1z!hU@7O;#vf2zgkBQ~gM2NQwTMmPgTC(}Q;mv=A%G500%S!z zl($0a4tk#Cqkd_zx=ODvgcZZvHa=Ie{Km+}(5ncxCM%?H62uk&gg+lucd&7@vQ~Z4 z@mBy!C7oJM2n^gKb&&%TB7`u)xa$duhiC3~YE3rGREbu$kNem4;jX&l3~|bd_&bk} zF>GC+1Bg81MCNP9ASmj!!Fl%$6)||f3gJ8zv^f7;ederjgOKBky*-`y>qUI-Vzb>! zPhwJ1#{jsJDuy8{O~4eEPBjhGvk_ko7#?_dKMU%yfBeucEw7fevqJ;;#Pq3s@Wxq- z8k%shWGzc{et(!0E-jfMF_jlQ-6pPEN{x!mER`e;+;s6!{`iU87=bhU{riD!YNEi0 zk^7(W@%U@rXI*Mv7i+hiQY?&&V0>f}hPNc-I8WH0Gij=IQmG@5z3+MpR_-GuL zK|Dc`K}@n`<1U@DJ1bV2u`LioCj8OrMret8{`&^!IEf3fHjd+oL#%9#wiHDq_U*|_ zePM@E?|ue)VNg&IQ{475x8-=6m*3{B%Oep21qy6pVj_p@KlK%+u>=3biz5^S z86gDRuJwpmHTWr1buGbbElyN_z%uAn^Si{6k(WKlsY(*JjVqBcznwR9xNs{dSC8PU zh-An|()Bs-4NC=-~#IK{G6$oQ8(R zWNt(QR8(3~BkiP!tn|KVL>-uDd%F-IpZ1;D2bXk_Nr$6J=ZcN0BiH@-2HXunOk|E^ zD6gC;0z2by@8-crWn#k9NL0$b%%k&SL~uLuuLj5rrWJrNIATx74Lz|W{Puql;QZU| zNrS7xUrj4EVE&;>*?j9PF9mXvq>~dC6H|q{k!Ez%FQv~`=>3Vb(ZWG$EOI7cci=6t zPIxVCbr35n>k7e!@BZ=p{Kwx(Q~}x)T=yVUio9qtA5Bfoqu)jEb02}+oD0~7C;rt? z`N!-An_u7w(qcZ&;VkX(T0nSY2UPg$K_=hQ(#jB^pQDtoh9AGQamUl#7gqZZe&O^y zH-$PL0u!bBb&|vuWp&Y$~OuG_6QFzDrY~| z=p!!tjowr;Y*azx>(j&jX-#$Ym-cA}KgJ}9Vw}1N7z%uR{EyxuIrBi5nDUWGraP>U z?!EXzF=Ryot*KJ%3#CWM_c(beiBgO5_5#mN#72AgdbwN3W^5=2GG%e8*2j;xr_t;p zJ+MX`cE=xTV6Ev70%0ipE(Qrg%gV|ok#Xo^;s2 z3J>+-UA>A#(MAHy+wC$7NirWej}(h7*ER{pD!<(#g13s=+Pr4wuHz5vaA+zNS-3(7 zk`e2jo>$~nQ#qo{iS)UVOSvkVVc%{r?Kb7SbEjuHpC)BUgI5oZi1i?SBNxl<^7)|^ zhHM1Se*RpI?=g*MZroq!>5RmC^9tes|p}%1ShlH-Y)ataI3+Pn5 zL+5EOlpYD0T;RqxYb0}ulze@ckV*Y1P3mLYkT}evBg}?{!>8$fMm%j8jY#Cq{;h!W z@<1{{K|nuzxs4uZ?pwH?(2Z-BaTP&_-Cf@NJ$LIF3%4h09ho1n z=X#s;ke(v0$qe5(I6akn4Py`%>a@SslhJo1Yy#psF=fx13XoZ_?_7aY*OPEE> z`h4n-EXl=%<8xW ztO|H?msFhIlDJ#00_y6He>a)gyRH`qUSFQMWo1iL)hE0x$b4k^;eTsyy0?I*^_Vyc z0(y}P0pP`+E9`zcK8-V`Hhe67GLMUYE=*R7y!#xnZqKG*6XIirdNUucY8|a9tp4GH z&v6&;S@-LOe5N=$JS?ja+sF7+R&3AIzzrib5LTgCsxi?3jH7av0O!@!l=xf8*ltu3 z9&J!su(~Eq*K`Sf>ZG)X?=9l^Xk*?O{R zh=&qOjPWP8Nki2X{anGqh4YZbzRm|49PYWX;)MnlR6x;n&+KqpTW+cmyV=3F6WXWRens#t|&p{2Qz=fDKfHJ)D~hZN>H8uqzJgxI6nz=I&6bVCcM zbd>u*fo>-<(UsE9bhUM8L5~#BC$8l)Ezkck#Mo3RP+g^EPZ(MdmSaA^0ig+pD=&a| zaX)$dZ(m>cp@A?tkvICY&`Gr2m6TS7BOBaXA7hhL$pJcn!@50Jl9Qb3mAg- zJxGOf{2eER&pNw(pPEUvwPTSyI4&ntO@+dshLIXQZjpbfCty= zffxI2{=erv26_j=&^Jtz*}g{bbu#vs?)r+=xL<{5is|3X`+rPHNy(`v)Z>U*tH=ha zu@7br-Eo`?ix@_j5|)N=(rkd#7+xgx8uW=nSkl2?MrvKhmntp-KFpQEUhL!W`Oe<_-K;OVo0ea~BARt5B&u zIw>SD;c;_?JbnI@Ycsd_J|3X!C9Dah^>S=lynm%%!@ABf0nLZfKx+13)Fm-PmKv<4 z+D@8R{1OrpIG2uYs0fpr9$r&=NtDXk-lH1y!n%OFBC{KiBxb91T~u?PYYp1_o3B<{~f_;IDt}oO?$$1wC*C+6o`}?3P=!}fHqvHBnqveGWTLzcJn#`XQqhItlhg-mS1hmD?d&;o8K_@4v1CAoR{~2e^~%2 M%Bsp#OPK`y5A}>=Z2$lO diff --git a/src/UnityScript.MonoDevelop/Icons/UnityScriptFile32.png b/src/UnityScript.MonoDevelop/Icons/UnityScriptFile32.png deleted file mode 100644 index fda9a0d7500b83078886f2e408c22d91d6a6b398..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4340 zcmVOz@Z0f2-7z;ux~O9+4z06=<WDR*FRcSTFz- zW=q650N5=6FiBTtNC2?60Km==3$g$R3;-}uh=nNt1bYBr$Ri_o0EC$U6h`t_Jn<{8 z5a%iY0C<_QJh>z}MS)ugEpZ1|S1ukX&Pf+56gFW3VVXcL!g-k)GJ!M?;PcD?0HBc- z5#WRK{dmp}uFlRjj{U%*%WZ25jX z{P*?XzTzZ-GF^d31o+^>%=Ap99M6&ogks$0k4OBs3;+Bb(;~!4V!2o<6ys46agIcq zjPo+3B8fthDa9qy|77CdEc*jK-!%ZRYCZvbku9iQV*~a}ClFY4z~c7+0P?$U!PF=S z1Au6Q;m>#f??3%Vpd|o+W=WE9003S@Bra6Svp>fO002awfhw>;8}z{#EWidF!3EsG z3;bXU&9EIRU@z1_9W=mEXoiz;4lcq~xDGvV5BgyU zp1~-*fe8db$Osc*A=-!mVv1NJjtCc-h4>-CNCXm#Bp}I%6j35eku^v$Qi@a{RY)E3 zJ#qp$hg?Rwkvqr$GJ^buyhkyVfwECO)C{#lxu`c9ghrwZ&}4KmnvWKso6vH!8a<3Q zq36)6Xb;+tK10Vaz~~qUGsJ8#F2=(`u{bOVlVi)VBCHIn#u~6ztOL7=^<&SmcLWlF zMZgI*1b0FpVIDz9SWH+>*hr`#93(Um+6gxa1B6k+CnA%mOSC4s5&6UzVlpv@SV$}* z))J2sFA#f(L&P^E5{W}HC%KRUNwK6<(h|}}(r!{C=`5+6G)NjFlgZj-YqAG9lq?`C z$c5yc>d>VnA`E_*3F2Qp##d8RZb=H01_mm@+|Cqnc9PsG(F5HIG_C zt)aG3uTh7n6Et<2In9F>NlT@zqLtGcXcuVrX|L#Xx)I%#9!{6gSJKPrN9dR61N3(c z4Tcqi$B1Vr8Jidf7-t!G7_XR2rWwr)$3XQ?}=hpK0&Z&W{| zep&sA23f;Q!%st`QJ}G3cbou<7-yIK2z4nfCCCtN2-XOGSWo##{8Q{ATurxr~;I`ytDs%xbip}RzP zziy}Qn4Z2~fSycmr`~zJ=lUFdFa1>gZThG6M+{g7vkW8#+YHVaJjFF}Z#*3@$J_By zLtVo_L#1JrVVB{Ak-5=4qt!-@Mh}c>#$4kh<88)m#-k<%CLtzEP3leVno>={htGUuD;o7bD)w_sX$S}eAxwzy?UvgBH(S?;#HZiQMoS*2K2 zT3xe7t(~nU*1N5{rxB;QPLocnp4Ml>u<^FZwyC!nu;thW+pe~4wtZn|Vi#w(#jeBd zlf9FDx_yoPJqHbk*$%56S{;6Kv~mM9!g3B(KJ}#RZ#@)!hR|78Dq|Iq-afF%KE1Brn_fm;Im z_u$xr8UFki1L{Ox>G0o)(&RAZ;=|I=wN2l97;cLaHH6leTB-XXa*h%dBOEvi`+x zi?=Txl?TadvyiL>SuF~-LZ;|cS}4~l2eM~nS7yJ>iOM;atDY;(?aZ^v+mJV$@1Ote z62cPUlD4IWOIIx&SmwQ~YB{nzae3Pc;}r!fhE@iwJh+OsDs9zItL;~pu715HdQEGA zUct(O!LkCy1<%NCg+}G`0PgpNm-?d@-hMgNe6^V+j6x$b<6@S<$+<4_1hi}Ti zncS4LsjI}fWY1>OX6feMEuLErma3QLmkw?X+1j)X-&VBk_4Y;EFPF_I+q;9dL%E~B zJh;4Nr^(LEJ3myURP{Rblsw%57T)g973R8o)DE9*xN#~;4_o$q%o z4K@u`jhx2fBXC4{U8Qn{*%*B$Ge=nny$HAYq{=vy|sI0 z_vss+H_qMky?OB#|JK!>IX&II^LlUh#rO5!7TtbwC;iULyV-Xq?ybB}ykGP{?LpZ? z-G|jbTmIbG@7#ZCz;~eY(cDM(28Dyq{*m>M4?_iynUBkc4TkHUI6gT!;y-fz>HMcd z&t%Ugo)`Y2{>!cx7B7DI)$7;J(U{Spm-3gBzioV_{p!H$8L!*M!p0uH$#^p{Ui4P` z?ZJ24cOCDe-w#jZd?0@)|7iKK^;6KN`;!@ylm7$*nDhK&GcDTy000JJOGiWi{{a60 z|De66lK=n!32;bRa{vGf6951U69E94oEQKA00(qQO+^RU3JVJ=1ONx0Hvj+zCP_p= zR9M5^S8Hq(=M_D(>owk8<8&K#lMvH&se>97ds%2Cid46X-yEv z-cF*PYvRimnEW3yRY`m~p~Zgu}E7z*w6d5hrjcqmB{07#0Wz_M%< z78atQzzvtnO}E=EUA)-QxNFz0>u$Guy%1vZ!i5WUpGBbH-#z^4?q|QUVZ-{5Ow%eT znO_W-%S8Z^meG*SnwVGUf!FJW+wDR;9!D$|liJ(cLGmd{k}!R_0HAJG5qR(1`(l1c zi8SBur`PM19=QL0Xc-Njfeeay|ZT-jYhe8 z^=c}L!oI!)Ps}{rWfZFU_v5uEUmP(XuTu z1K!%&%5XT$>c?tmm=>o}GF44uM$a;9m<-)_A8R*0PLfQg(`;*NV<;5jtZP4$$q2`B zD1;F0?d>cJhq-w1VwRRZNPlrL{XReaem{LaAALR_gTWy03=EPab6W*peDSv&9v=SL zYzVmb?c294C#@jKCpK+nIQ%8nZrsSGre^-(jpIE2=9~P}+f6+A)*rdx-h27ur=R&a zA4Wz-7!HR?lKuVt8)ikKtE;Oy=aCRX@QF>E8488i(9m#K0`9Kg!$9B*OeFeAlCfBf z;j%LJ_9lemIPB}|+msi2C=_x5_@b(+$|p%|*|LS9P>6>P9lDD|I9$f>tX@Ns-0|cN zR#sNhwrycqmM~3|w{PFB%r^?2<;$0^nvp^XK_LV;ZQjDt(o*iU;BjDiq?$>bOli9VKD=Vd|SFaX#c6PoIiA2_s zq?9|ANaEF3U&G;s!E*)U8KrfEV^6jUtznv@p-09d$i zp?hd(XhAZWyc`S$A0SBp()4YbNMHXQw6(UPwXF?3-Q6fI_T#nJUx#6s$Y!(DG)2(HYv$*1RTeK?bxtP3x;XJFbrn23=~b148y?S z;Na;ezxUnm0~o)n*7HFR27^{S9-oRtBE?IVEP2GVY}%G3nU)D%H;~aYP*s(wlq@Nl zCJhb@{B_T>^|eP1AKDK<&$}b~lqTjOMN$4?7}LpRm?rd$PF2$+J!@bzIdbdwvDnk^ zoN8_bKma1Ij_5PY1~7U%-rExh1j;kIPEFOMjIK))6BA?2%}qOxy?peo+;`5bTC)GZ zl*x(7F#_ePs!6geXIop(?fK0MFB}D60}P0=P$# iqyqd8%=LMWUjGCo>2z+x^)&VX0000KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-ePrx>>xFPTiH1=E+A$W$=bG8>s^ zm=Bn5Rah$aDtr}@$`X}2l~$F0mFKEdRdZE8)p@E5RI61Ft6o-prbbn>P~)iy)E2AN zsU20jsWz_8Qg>31P|s0cqrPALg8E|(vWA65poU1JRAaZs8I2(p#xiB`SVGovRs-uS zYnV-9TeA7=Om+qP8+I>yOjAR1s%ETak!GFdam@h^# z)@rS0t$wXH+Irf)+G6c;?H29p+V6F6oj{!|o%K3xI`?%6x;DB|x`n#ibhIR?(H}Q3Gzd138Ei2)WAMz7W9Vy`X}HnwgyEn!VS)>mv$8&{hQn>w4zwy3R}t;BYlZQm5)6pty=DfLrs+A-|>>;~;Q z_F?uV_HFjh9n2gO9o9Q^JA86v({H5aB!kjoO6 zc9$1ZZKsN-Zl8L~mE{`ly3)1N^`o1+o7}D0ZPeY&J;i;i`%NyJ8_8Y6J?}yE@b_5a zam?eLr<8@mESk|3$_SkmS{wQ>%qC18))9_|&j{ZT zes8AvOzF(F2#DZEY>2oYX&IRp`F#{ADl)1r>QS^)ba8a|EY_^#S^HO&t^Rgqwv=MZThqqEWH8 zxJo>d=ABlR_Bh=;eM9Tw|Ih34~oTE|= zX_mAr*D$vzw@+p(E0Yc6dFE}(8oqt`+R{gE3x4zjX+Sb3_cYE^= zgB=w+-tUy`ytONMS8KgRef4hA?t0j zufM;t32jm~jUGrkaOInTZ`zyfns>EuS}G30LFK_G-==(f<51|K&cocp&EJ`SxAh3? zNO>#LI=^+SEu(FqJ)ynt=!~PC9bO$rzPJB=?=j6w@a-(u02P7 zaQ)#(uUl{HW%tYNS3ItC^iAtK(eKlL`f9+{bJzISE?u8_z3;~C8@FyI-5j_jy7l;W z_U#vU3hqqYU3!mrul&B+{ptt$59)uk{;_4iZQ%G|z+lhASr6|H35TBkl>gI*;nGLU zN7W-nBaM%pA0HbH8olyl&XeJ%vZoWz%6?Y=dFykl=imL}`%BMQ{Mhgd`HRoLu6e2R za__6DuR6yg#~-}Tc|Gx_{H@O0eebyMy5GmWADJlpK>kqk(fVV@r_fLLKIeS?{4e)} z^ZO;zpECde00d`2O+f$vv5tKEQIh}w03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(` z>RI+y?e7jKeZ#YO-C74=C(K~#9!tVi)G11`D5bF5?a*}tijv5BKOqF1^BLct`g)~9k|YR%P*7D>)y^1e zZ)$ApxOi#kS4XwWz4*mh!T) zc2SaUA%yrj=eRsN3dXdLa&vR93Z6K(44 z7yJGGRq=Sd+~IHtnx;Y1vXAQ+Y+js%SJ?YqQzxs;WZMG)R(^VR(8NQG!N~+fx<}hkLK&q-z3zfPzx-h8j90 zj(x#kaH*zg%L9SHt&$|Q*zI<=s;UTw!ytqpo=BwZnQ3`*&SA6J3Y<>o^3X)6mx5kD z0EAGG8)UrYB}tN8qA0fd{r-+%Ft}WxLOT_xpK}hz7&zyM#bO|YfFzgkY$MJv4ETJ$ z)sg7LHgG=UjpA&5KUd?aAVQ!5I3{D-Cfi)i&GUZbblN*Ljg{H$c0toLFr5MVbfD(C z!t8eYElksLHB}4G1OUD2g8*<&=jvu~!+>ru7`hHa*P$~FB}IXoJs!{B83qrEq9|mG z<12Yq*Y#OlE6Y+%p4ZowP&6nC%Q$DX0yqdbC)Y*voO8gK^uEtuSX5eG{)D2$0bD)D zbIxHH1~g5BVHj|^T*&i!F+MhS^?L!q?auA+dh_3wS$P8mb8CQ zQDVy!C3|+V4AylWj4?=(gnX|Tl~q+}Y-~i+yk;CZdJH>W{v`xTaHSMy=sLV!@5-}h z&Qhi`Bip6ol{|lAay*A1NMKAuO)$7pl*LCvp#&_CaL&Owhpy|;G!23v!0mRUyu2I@ z4Gow#Zyp*O8sN>(huiJOu@k58-oBs0FmwolG%c%4#Ff%=MfjG!e$moxj4s#S5_8?bE75O6fFy5Jl1B@wk>>9v$crvV?&+-T1k= zJswY>ZPAi7e!s6-V~kTmM9zuGG?i#f3m2D^w)gd&?TCazaOLD65D1{It`4oOt!Qp; zMp;=Ia&vPbiXxb%r9!~+tSrko_`#oW;JtStNm9n&R+I!*u37_1fZzT0HyPk)nu`2< z-D!Z{ezK?s2$0N@m-Pn|$z zWhEZ?(wETK)QFmz8sz2WL6&7O#-Qsu48wq;ssOjDIbwMcqhlewzH=wS;fV|b8DsEx zytwDy`|!!B6Zq|Kf0JsW%+<)@bU2skjOWGU>NufU0HBmYmK|U$cJ0P13L2Z5?kKM) zfA;L@Pux@E&?;uuty_ohJoXs!JRVquj$s&36ve7EGU^30UU?Ek5%27K4@bH`ge+&4 z;kvG4)op9hwy+g4<#5>TFbrd|a3TZ-H>!L--{(%9I{D629uPSvkR;ojIyzNVP~XtB zy1J@r%h08P0%1yT%{fORk-&xx8}Qg;kHO`1rFg<@D=6qy8Y)Q=@yVHf?0S7CbY0H? zK+{x|l~-Wn#*L6f0aex2C@n2TZ*MOq(;f%soVwk)9r*>mccx|n%IDb2s;Y{*`i5I; zYO1!53=I}e&9j#0*RNlX&6_vF<#K`P41yp`o|J+LG(}+Pr|EeCOy}6OYZuO(?#VFT zTIL(>+K9&bS{R0oyu3WL%%4A{K_XBU1^K>$4yLIz5{@7ijn2LjoXPmwy85M6)z#ZZ zhKGyE490hMc4G76kHg_`z|f79VOdW~&67|NY8p=|MfZ`Tc>C9HU@C*Fih_CbThV#v zdQeJI8K_Ws;I86T~u3ByM65PNa<8owT$1e zVFNa8+624JW_ru=G|BF9nj}3+2`DjviX{}hy5kj$3=Kg{V}3)|;c&We@4a6}p}!!N z1_7YCxfwY*IT-+O^FL2TMR0{I%dp!Wa|1wARn*kfwbj?vy*x2KS~-*PcinXt9)J9C z*le~G5s{h7!)(n*@_6^X19<=70od&J44^co;g*#hShez&X-!i_MFlD=D>K4?5CTO> zAm5wUQBdH6+vC3Wc34wY1S_kW>+9=(84ic4kjAp5J<9&U3>Q6(1HCRlw=e{s;c6i z`@VvJ--q+(&VyT3AR(ZFfSlZ16c-mmRaFpT0%GzB0n@bFU}g29KOa5v&a468hJoUe z(yH3}`fagjq}8g>G)+srhQnd3Tel8>`^|46o`{|W_c4ps>s>Ac{3ai2Q*ECEXipMZ>mX? zTwpd?86YG*PY3}B#jf4EaJuId91cf@4j{=k-2cFX2$q*XRaDs08Y&~%#1KMIURH*t zd5t)*{{Tc$FdHoZu}cF86csNj4+dw`4jb_K3QGzL3%8Gq3@=V66zjuV#()3&--pZP zf~IM(+wB?Y&Fsi1KzP!4lCkDV8VHgkd5~X`VF8+w>1WlA%9!*_-vgfJh{cUu@rwk&z)d9L@{^%P;WZ;fEiA zKi>;QRUk<;ncny`8Qmg6hr^L7m<+=}PEKxkJQVsb!!WMY4s+z?d3}XG|8t6xSd-0o z&N)8+`7hw9r=LQO%LPqiaM(rD=p-SfB0MQ8q@H7WeF{K=AYj*?xA4yI-Zs-GnIuY0 z)39;l7qD#UO#m^Qqv`50Pj<5=(YCa-ptQ6UeSLk9BnhG@K$N8a8Mt`y(2VV{VHn8G z&Gq_xzGpQ}y)&C2$utf1jZNsdZ7mM{{*O>K4MMWQGn*3za1KEbA=_*KOpl0yko0~s z3^-3-3rMmA-2h&E@dYS~GTH4BbLrRC)#Jg39)ip1fTAcf0FeBdbAS*O78atVr3F1b zJrD#6Z+>CVxpU`!tm`bh9-uP@k0-C7prGKt4V~RJlNu|@GWvSY;)(BWnp9zup5)-* zMzW<&YiD7RUt0d-K=Rtj)uCx>MytyW4nYv`;6q=aVvbyHv2k#%;o>dg(oTD&M zR8m}2^dA?_^)DBuOjE5CHT6wGge%Vx(qj0UwZ*j6*U->}0Xc9so zC;8_2=eIynwQC08$dMx$92|tIBy3)<_n#b2r<^XA0f0ydA)Ip_iG;`Bd-r!=ziZeY_vYiNC%*^7Fj9SkD2kYv2;sTsevZY97s2bvo%KYjtE&s5D1uUoSS&{K zy!qd<+Z}rniFiCc1h`cL5JGTiU|{IYy{|vgy0GnSe_;SDsokf?Wi%4OcOTz`EnBt# zbL6>f$Hu$w#?oagpejlRr`YXweDMAu?B26?*3UZE-;a|gPePWHeF-Iq$744KE33YE z#o;I+1Q#z}9D4iBykKcx@H~3^&(G>vUESRn9UX-w)KWsBDhhGu=6uWHaOPc65u%jh+`0aN zH}~#-c&U-Me?sYY!}4aqFM_fg&)*GUP2$ zlpqKKo_zAj8wP?+mhjL+52K5ZGiHZ@={h-raw2#(TTFyAh2>AqYao z3b5Pl!~{2?J=_1z% znRZVo6hc>5m)TXO$r5(E9q~kTpFj!E$+2e#z^cnFrI#@VRaKElBvKyl>+9`%W6$f~ zxNXhtr+kHhv=nLbf)x%=KKUeGeDTHW0>I_42NRha^!9J6$d~U9QP}OV{I_O9KP_u~_8T9qT(+4qh6_ zi$o$w7gMYO%D#R3ke}~GYisMA{!X694G`1k@;aN%hFC2Alfl7D-9~b*v3c|6>jwY;E?&HNHWm#ZTim|1F%$}w8ioN$ z5+Mo_L`j4!Ne~1PhYlUY@#7~jGBN@H@OV7a^7NICieLqfA3uRJXHG+sqzpdjKi7wr z)`b`vyo6U@ebrn6G=112PmGO?KA|d!%T@=vY15_~*29=}e15*Sec6g{=jZ3I&@@dY zAVk-7%`kK#2ttBT8aR5Sd#S1>kdu>(ii!%fwY6d4!i8vQX+)`kMv3=XtX#*8kPVRv}AMNT;RZX{~0Bf`44c+XX?A&BRh$)R4 zhQR^O4TIz& zfF~=;lG3tzzu$LINyL5DxGX*GYMKU{%?7X6i-v{+gj$Wyc8TJcEP40a228C=|N0udnybbYMO;0Ia5En&t;U5JlW{Q~OWj@z~$% zjAa!!(>F~Th5@J3iNeA{G&MD$y}cca7cas7gYV;~&-{2sfi(SDHk+-#x37P(s;a~3 zmyV5&ezpKuAXHb^HrF@Qzk9B~ui$DiZ^f_$h((^k%1ZS0^`(T9D>roVt4EK1bT4Dt zwB2RbRR_$49|$4n>pOdl3gUKeUOrS+Nllxt1gs=Ua5|lEI2=eM5;$@E_^gbVBnjb( z&_2#NY?735Uh@u->oqc-NFilw3Pv7E8dQN&^q=(=H!+0sUBQ=en) zFq_@R4kNBH?SRweoYB*tNeE<(O}kyLt*u+y+|s%+$Ca~C*I8367B3nZ9wZZ?5aRI| z01iqsTiV$k<`*U$UB`|eTh17p_T4>87yZ-#u;Mp;6rJwL^!MFvx7}Y@7%V9%Yb&p) zSRu={HqLotI6UDU86H9;Jb^?akt%#<0|+4ms;2#{_iXP!a6bJrSXIH(E7SEgKmgqT%oaqLBzBS$?~xr)M407^gIS z^ESYk0>+HLd;roxNdFr?pARD=BPc5?LnIs#e13mVm6NlC5Yl$Kr{_P< zoIUfH&KT5W)o1qV1|~vd(6s-908D+~>2!fHEvXg(HrWPAmhFx6n(NQ?_fK57aK1O& u5J3=-{B8t5IRC7_`uvx5Q2akX{&xV3x8eX4ZH^QG0000StO&>uS)ve< z0AYj>5AR{$W90N^4L=L-RlQUJ&DC0@ZjPh;=*jPLSYvv5M~MFBAl0-BNIsH15C~g000{K(ZT*W zKal6<?_01!^k@7iDG<<3=fuAC~28EsPoqkpK{9 zG%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~laM4*8xut5h5!4#~(4xGUqyucR% zVFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH;SjXJF*pt9;1XPc>u?taU>Kgl z7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj>4+3jBE`sZqynizYLQ(?Bl0bB z6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3rpmWi5G!I>XmZEFX8nhlgfVQHi z(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPzlc-O$C3+J1#CT#lv5;6stS0Uu z9wDA3UMCI{Uz12A4#|?_P6{CkNG+sOq(0IRX`DyT~9-sA|ffUF>w zk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3apE5$3psG>Lsh-pbs)#zDT1jo7 zc2F-(3)vyY4>O^>2$gY-Gd%Qm(Z8eYv>2*=jns=cMJ`N z4THx>VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA514ONSSt1^d=-((5|uiYR+WC0 z=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6TaXrs|dqbIl~?uTdNHFy_3W~^@< zVyraYW!!5#VPa`A+oZ&##pJ#z&6I1JX1dX|({#+t$SmBf*sRIyjyctwYo1}g*}U8Q zjfJH}oW)9uHjBrW+LnCF1(r>g_pF#!K2~{F^;XxcN!DEJEbDF7S8PxlSDOr*I-AS3 zsI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJcaVfH2VZT8O{%p4LO);n}Nd~$Sk z%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD%mlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_%;TM>o2SC_kmoO6c3xRt`@J4d zvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B%zNWq+-#xw~e%5}Oeh2)X`#bu} z{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx1&sx}1}_Xg6+#RN4Ot&@lW)Km z@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHXZ>IT7>CCnWh~P(Th`1kV8JQRP zeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlxwsLl7tZHmhY-8-3xPZ8-xPf?w z_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT<=mpV7v|~C%bs^USv6UZd^m-e z5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qUN<5P0omQ3hINdvaL;7fjPeygd zGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!lNmb5F^Ft;eTPi8AClMUo~=55Lw zlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@C~gS@r~shUu{a>bfJ1`^^VQ7&C1OKHDNXF zTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJzrV5xZBjOk9!NTH<(q(S+MDf~ zceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2;PCq@=ncR8zO#GQ^T~S@VXG71P zKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U{ozQjTW{-S_si{9Jg#)~P3t?+ z@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7?H6|n?o8ZWdXIRo{Jz@#>IeD{ z>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik)gwkDjgOrl9~%uCz4Bzvli{bb zrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq@2jb=I>#f&AH2?aJ@Kaet zy{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXb;6dMjBKsq=800?PGL_t(o z!@XB~aFo>*|K0Dgo6U<&0=tmin8$A1&5|Wc5+K=xBqT9BLPC(%qSQX7PU~QywAwnQ z9c>3429?_Ba{$Zqj}BAO5vO*FC@_@>N)1VX*r_8;0Amc2-N0s_-{YSCvB~O!h-lm2 z%$;xUx!?WHx##@OIrn4uFCjBC6VYh&I(g;%`AhQ)3cd`WD-gVL*V{v9-un2u^m!E; z3VSp!I%Rs_Zv zh=>3%RaIdy7?7MIwcgv?o2FB^Ri#U7Y5@SPt?m0b*TiXsr0Y6Dp%6l$5Hp+2Shczf zNdxv=0cL? z9smdgE`K@)>gxS?^NkZ|YwzgMHRZqz<3phk4j(=OtJOlft}|WJk@Rme)<&ZdovXWX z^-2)Bu3<@C1Ah7RPE=P{BP%P5Bw1$ves{R^z0nKjZy18w+QoSDjT2~YZC}B4<$$JX zBuNrQA`u+x?S<89fv)Qe07OZIC`*te2}Yw4&%f{@#zrqf5Cp{IactYRZKfW8h@dJ8 zTpriD8*;$6uo``R|3E`SQw!tTK~>dg`sD1`v17%K|~Y` z2HD}mhhZ|A5Rb>9sVX#G2j?7|a}W`-v$OH!Q@_CeXZOKm%0z}K6UUCdhD0n5gVBIX zAAX3nJw2E+XAUwDuPfrf=D!usG>m8bSN5!qNvabc=hPtalH36 z$g+%3D1<$`cO#KVz+^HZBO?PQlL?&bShsE+g~L-UGb`)4;dAc}l{uWr5V$KmRf$+^ zkO?1^QpOm<;VE!R#wo3&CM6&MM1UlT$jQk;EE>gq-`R+tJ@S)eAE4=XKww}91Olk3 zsRbvaJof%MEmeqeva<&xktxW6OoG4|z>>tu%1*j^2Gbv$uK6=UFqTXvRnt&Yy)cn=v$WR{Q8M0M>8#M$yHQa~DTPFG7}O0>C6mLZQu$si`S&BA7BvkYpJG zW8lPL$}quTkRga7E{%`l()bueQG%*!7#SI!wl}>Ijf{+tud0eUZ@+ze|EW`3OG?Xt zITkAbVDtBXR9f$EppxQZDtDH1o6Sc1_diFU1&XTEyt(tp<#LhTZl_0o{umJvan4hN zi0BW`JVUlZ8&yt{p@~zy19# zvK1DR+wCTc#X=K-$+Ue$MBUxpNx_oo^$1K+}Ga=YE+bUNvt4fm$@%)oB9lgs7eZnvAdy4N;dN0L>my8!?j zH$PNX@As3_=_HTG!)MQ)O?&q2xv3GyPn;yH)k5><&nK(JLZ|vqrP4rY#S)cXX^Em&-+!UN5&; zt+aRV-ZTPU>xIh`0kYfe9 zC7;hn8K%tKv^sDj^sK!TFCKUSzM4g|eLi28uIe#a7Gnbg16|`Ey#Fn`-A+wS&8)L? z75sibj7DQ>uh+W(g21385~!G8iGRL51f$UaL6F`X92~f<%2$okgZ($Z75f{P;>7E{ z*U4*YYND#Dnlw#ABoYDV9OdQZ=;-Lcs+B7-8H(VWU;k>VK}nJXB7!K2zaAJE*qoJ> zfk-5N>(}y<(lVSM8AkV-wf7C5dv_0kAc`Wuk|keJ6okWJe4YG-3-(Tt+Mwg(ylheIWHiGEvh(;s%fr-mdRTYvXfiXq^7y-x6o;lN4SXhX$v9T}i zfg8c=_097yZCr8r(&hD$NT?|iiDXO$0}upp)7i6UeuMuN%F4<.+)\((?\d+),(?\d+)\):\s+(?.+?):\s+(?.+)/: - result.Append(BuildError( - FileName: fileName[0].Value, - Line: int.Parse(lineNumber[0].Value), - Column: int.Parse(column[0].Value), - IsWarning: code[0].Value.StartsWith("BCW"), - ErrorNumber: code[0].Value, - ErrorText: message[0].Value)) - - case /(?.+):\s+(?.+)/: - result.Append( - BuildError( - ErrorNumber: code[0].Value, - ErrorText: message[0].Value)) - - otherwise: - unrecognized = len(line) > 0 \ - and not line.StartsWith("Successfully compiled '") - - if unrecognized: print "Unrecognized compiler output:", line - - return result diff --git a/src/UnityScript.MonoDevelop/ProjectModel/UnityScriptLanguageBinding.boo b/src/UnityScript.MonoDevelop/ProjectModel/UnityScriptLanguageBinding.boo deleted file mode 100644 index 7c27971..0000000 --- a/src/UnityScript.MonoDevelop/ProjectModel/UnityScriptLanguageBinding.boo +++ /dev/null @@ -1,54 +0,0 @@ -namespace UnityScript.MonoDevelop.ProjectModel - -import MonoDevelop.Core -import MonoDevelop.Projects -import System.Xml - -import UnityScript.MonoDevelop - -class UnityScriptLanguageBinding(IDotNetLanguageBinding): - - ProjectStockIcon: - get: return "md-unityscript-project" - - SingleLineCommentTag: - get: return "//" - - BlockCommentStartTag: - get: return "/*" - - BlockCommentEndTag: - get: return "*/" - - Refactorer: - get: return null - - Parser: - get: return null - - Language: - get: return "UnityScript" - - def IsSourceCodeFile(fileName as string): - return IsUnityScriptFile(fileName) - - def GetFileName(baseName as string): - return baseName + ".us" - - def GetCodeDomProvider(): - return UnityScriptCodeDomProvider() - - def CreateProjectParameters(projectOptions as XmlElement): - return UnityScriptProjectParameters() - - def CreateCompilationParameters(projectOptions as XmlElement): - return UnityScriptCompilationParameters() - - def GetSupportedClrVersions(): - return (ClrVersion.Net_1_1, ClrVersion.Net_2_0, ClrVersion.Clr_2_1, ClrVersion.Net_4_0) - - def Compile(items as ProjectItemCollection, - config as DotNetProjectConfiguration, - selector as ConfigurationSelector, - progressMonitor as IProgressMonitor): - return UnityScriptCompiler(config, selector, items, progressMonitor).Run() diff --git a/src/UnityScript.MonoDevelop/ProjectModel/UnityScriptParser.boo b/src/UnityScript.MonoDevelop/ProjectModel/UnityScriptParser.boo deleted file mode 100644 index 0c75a80..0000000 --- a/src/UnityScript.MonoDevelop/ProjectModel/UnityScriptParser.boo +++ /dev/null @@ -1,37 +0,0 @@ -namespace UnityScript.MonoDevelop.ProjectModel - -import System.IO - -import MonoDevelop.Projects.Dom -import MonoDevelop.Projects.Dom.Parser - -import UnityScript.MonoDevelop - -class UnityScriptParser(AbstractParser): - - public static final MimeType = "text/x-unityscript" - - def constructor(): - super("UnityScript", MimeType) - - override def CanParse(fileName as string): - return IsUnityScriptFile(fileName) - - override def Parse(dom as ProjectDom, fileName as string, content as string): - result = ParseUnityScript(fileName, content) - - document = ParsedDocument(fileName) - document.CompilationUnit = CompilationUnit(fileName) - - result.CompileUnit.Accept(DomConversionVisitor(document.CompilationUnit)) - - return document - -def ParseUnityScript(fileName as string, content as string): - compiler = UnityScript.UnityScriptCompiler() - compiler.Parameters.ScriptMainMethod = "Awake" - compiler.Parameters.ScriptBaseType = object - compiler.Parameters.Pipeline = UnityScript.UnityScriptCompiler.Pipelines.Parse() - compiler.Parameters.Input.Add(Boo.Lang.Compiler.IO.StringInput(fileName, content)) - return compiler.Run() - \ No newline at end of file diff --git a/src/UnityScript.MonoDevelop/ProjectModel/UnityScriptProjectParameters.boo b/src/UnityScript.MonoDevelop/ProjectModel/UnityScriptProjectParameters.boo deleted file mode 100644 index 5b29e5b..0000000 --- a/src/UnityScript.MonoDevelop/ProjectModel/UnityScriptProjectParameters.boo +++ /dev/null @@ -1,6 +0,0 @@ -namespace UnityScript.MonoDevelop.ProjectModel - -import MonoDevelop.Projects - -class UnityScriptProjectParameters(ProjectParameters): - pass \ No newline at end of file diff --git a/src/UnityScript.MonoDevelop/Templates/ConsoleProject.xpt.xml b/src/UnityScript.MonoDevelop/Templates/ConsoleProject.xpt.xml deleted file mode 100644 index f374759..0000000 --- a/src/UnityScript.MonoDevelop/Templates/ConsoleProject.xpt.xml +++ /dev/null @@ -1,41 +0,0 @@ - - diff --git a/src/UnityScript.MonoDevelop/Templates/EmptyUnityScriptFile.xft.xml b/src/UnityScript.MonoDevelop/Templates/EmptyUnityScriptFile.xft.xml deleted file mode 100644 index 8074708..0000000 --- a/src/UnityScript.MonoDevelop/Templates/EmptyUnityScriptFile.xft.xml +++ /dev/null @@ -1,19 +0,0 @@ - - diff --git a/src/UnityScript.MonoDevelop/UnityScript.MonoDevelop.addin.xml b/src/UnityScript.MonoDevelop/UnityScript.MonoDevelop.addin.xml deleted file mode 100644 index fc09d71..0000000 --- a/src/UnityScript.MonoDevelop/UnityScript.MonoDevelop.addin.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/UnityScript.MonoDevelop/UnityScript.MonoDevelop.booproj b/src/UnityScript.MonoDevelop/UnityScript.MonoDevelop.booproj deleted file mode 100644 index a88607c..0000000 --- a/src/UnityScript.MonoDevelop/UnityScript.MonoDevelop.booproj +++ /dev/null @@ -1,72 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {FCFE96D7-4BDB-4EE9-BD11-E3E263E1DE38} - Library - UnityScript.MonoDevelop - false - UnityScript.MonoDevelop - - - true - full - bin\Debug - prompt - false - - false - - - none - bin\Release - prompt - false - - false - - - - - monodevelop - False - - - monodevelop - False - - - monodevelop-core-addins - False - - - monodevelop - False - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/UnityScript.MonoDevelop/UnityScriptFiles.boo b/src/UnityScript.MonoDevelop/UnityScriptFiles.boo deleted file mode 100644 index 7b1c977..0000000 --- a/src/UnityScript.MonoDevelop/UnityScriptFiles.boo +++ /dev/null @@ -1,5 +0,0 @@ -namespace UnityScript.MonoDevelop - -def IsUnityScriptFile(fileName as string): - return System.IO.Path.GetExtension(fileName).ToLower() in (".us", ".js") - diff --git a/src/UnityScript.MonoDevelop/UnityScriptSyntaxMode.xml b/src/UnityScript.MonoDevelop/UnityScriptSyntaxMode.xml deleted file mode 100644 index 05e6c9e..0000000 --- a/src/UnityScript.MonoDevelop/UnityScriptSyntaxMode.xml +++ /dev/null @@ -1,231 +0,0 @@ - - - - // - /* - */ - " - ' - - # - /// - // - - - /* - */ - - - - @" - " - - - - " - " - - - - ' - ' - - - CSharpNumber - - - this - super - - - - as - is - new - sizeof - typeof - - - - else - if - switch - case - default - - - - do - for - in - while - - - - break - continue - goto - return - - - - yield - partial - - - - try - throw - catch - finally - - - - true - false - null - - - - abstract - event - override - final - static - virtual - - public - protected - private - internal - - - - boolean - byte - char - Date - double - enum - float - int - long - sbyte - short - struct - uint - ushort - ulong - Object - String - Regex - Number - Function - Array - var - - - - void - - - - package - import - - - - get - set - add - remove - value - - - - class - interface - function - - - - ref - out - - - - - explicit - implicit - - operator - - - - checked - unchecked - fixed - lock - - - - - pragma - - - - - - TODO - FIXME - HACK - UNDONE - - - - - - - - - < - > - - - - - - " - " - - - c - code - example - exception - list - para - param - paramref - permission - remarks - returns - see - seealso - summary - value - type - name - cref - item - term - description - listheader - - - - From dfb5e39a664482d495f22817c5f497a0c12e7ea3 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 11 Jun 2010 12:33:39 -0300 Subject: [PATCH 003/276] redundant bitwise or rule --- src/UnityScript/UnityScript.g | 1 - 1 file changed, 1 deletion(-) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 47c49ad..6700d64 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -1453,7 +1453,6 @@ sum returns [Expression e] ( add:ADD { op=add; bOperator = BinaryOperatorType.Addition; } | sub:SUBTRACT { op=sub; bOperator = BinaryOperatorType.Subtraction; } | - bitor:BITWISE_OR { op=bitor; bOperator = BinaryOperatorType.BitwiseOr; } | eo:EXCLUSIVE_OR { op=eo; bOperator = BinaryOperatorType.ExclusiveOr; } ) r=term From ab7cca512f9e07da8b9cadb1283fc95b778b400f Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 11 Jun 2010 12:33:58 -0300 Subject: [PATCH 004/276] code cleanup --- src/UnityScript/UnityScriptCompiler.boo | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/UnityScript/UnityScriptCompiler.boo b/src/UnityScript/UnityScriptCompiler.boo index ac9016b..296ef17 100755 --- a/src/UnityScript/UnityScriptCompiler.boo +++ b/src/UnityScript/UnityScriptCompiler.boo @@ -14,32 +14,32 @@ class UnityScriptCompiler: def Run(compileUnit as Boo.Lang.Compiler.Ast.CompileUnit): return _compiler.Run(compileUnit) - class Pipelines: + static class Pipelines: - static def RawParsing(): + def RawParsing(): pipeline = CompilerPipeline() pipeline.Add(UnityScript.Steps.PreProcess()) pipeline.Add(UnityScript.Steps.Parse()) return pipeline - static def Parse(): + def Parse(): pipeline = RawParsing() pipeline.Add(UnityScript.Steps.ApplySemantics()) return pipeline - static def Compile(): + def Compile(): return AdjustBooPipeline(Boo.Lang.Compiler.Pipelines.Compile()) - static def CompileToMemory(): + def CompileToMemory(): return AdjustBooPipeline(Boo.Lang.Compiler.Pipelines.CompileToMemory()) - static def CompileToFile(): + def CompileToFile(): return AdjustBooPipeline(Boo.Lang.Compiler.Pipelines.CompileToFile()) - static def CompileToBoo(): + def CompileToBoo(): return AdjustBooPipeline(Boo.Lang.Compiler.Pipelines.CompileToBoo()) - static def AdjustBooPipeline(pipeline as CompilerPipeline): + def AdjustBooPipeline(pipeline as CompilerPipeline): pipeline.Insert(0, UnityScript.Steps.PreProcess()) pipeline.Replace(Boo.Lang.Parser.BooParsingStep, UnityScript.Steps.Parse()) @@ -76,7 +76,8 @@ class UnityScriptCompiler: return pipeline -[Extension] def ReplaceOptional(pipeline as CompilerPipeline, optionalPipelineStepType as System.Type, step as ICompilerStep): +[Extension] +def ReplaceOptional(pipeline as CompilerPipeline, optionalPipelineStepType as System.Type, step as ICompilerStep): index = pipeline.Find(optionalPipelineStepType) if index < 0: return pipeline.RemoveAt(index) From d861d1396399bdeea5b666d2a91ed4a21a238811 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 11 Jun 2010 19:14:19 -0300 Subject: [PATCH 005/276] fix project files to work with latest md addins --- src/UnityScript.Lang/UnityScript.Lang.booproj | 46 +++++++++++++++- .../UnityScript.Tests.CSharp.csproj | 51 +++++++++++++++++- .../UnityScript.Tests.booproj | 3 +- src/UnityScript/UnityScript.booproj | 2 +- src/UnityScript/UnityScript.sln | 2 +- src/us/us.booproj | 54 ++++++++++++++++++- 6 files changed, 152 insertions(+), 6 deletions(-) diff --git a/src/UnityScript.Lang/UnityScript.Lang.booproj b/src/UnityScript.Lang/UnityScript.Lang.booproj index 9702cae..efcf4bf 100755 --- a/src/UnityScript.Lang/UnityScript.Lang.booproj +++ b/src/UnityScript.Lang/UnityScript.Lang.booproj @@ -1 +1,45 @@ - Debug AnyCPU 9.0.21022 2.0 {2784E7F4-5206-4BF9-99CD-96B1D94D0E19} Library UnityScript.Lang false UnityScript.Lang v3.5 true full bin\Debug prompt false false none bin\Release prompt false false \ No newline at end of file + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {2784E7F4-5206-4BF9-99CD-96B1D94D0E19} + Library + UnityScript.Lang + false + UnityScript.Lang + v3.5 + + + true + full + bin\Debug + prompt + false + + false + + + none + bin\Release + prompt + false + + false + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj b/src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj index 52d8426..8a1b8d5 100755 --- a/src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj +++ b/src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj @@ -1 +1,50 @@ - Debug AnyCPU 9.0.21022 2.0 {EF5AE116-19DD-42DC-847A-7BD3EE49AB01} Library UnityScript.Tests.CSharp UnityScript.Tests.CSharp v3.5 true full false bin\Debug DEBUG prompt 4 false none false bin\Release prompt 4 false \ No newline at end of file + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {EF5AE116-19DD-42DC-847A-7BD3EE49AB01} + Library + UnityScript.Tests.CSharp + UnityScript.Tests.CSharp + v3.5 + + + true + full + false + bin\Debug + DEBUG + prompt + 4 + false + + + none + false + bin\Release + prompt + 4 + false + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/UnityScript.Tests/UnityScript.Tests.booproj b/src/UnityScript.Tests/UnityScript.Tests.booproj index d1372cb..16793ba 100755 --- a/src/UnityScript.Tests/UnityScript.Tests.booproj +++ b/src/UnityScript.Tests/UnityScript.Tests.booproj @@ -1,5 +1,5 @@ - + Debug AnyCPU @@ -38,6 +38,7 @@ + diff --git a/src/UnityScript/UnityScript.booproj b/src/UnityScript/UnityScript.booproj index 46825b2..1ab379e 100755 --- a/src/UnityScript/UnityScript.booproj +++ b/src/UnityScript/UnityScript.booproj @@ -1,5 +1,5 @@ - + Debug AnyCPU diff --git a/src/UnityScript/UnityScript.sln b/src/UnityScript/UnityScript.sln index e7db1e6..59a0cfe 100644 --- a/src/UnityScript/UnityScript.sln +++ b/src/UnityScript/UnityScript.sln @@ -39,6 +39,6 @@ Global {EF5AE116-19DD-42DC-847A-7BD3EE49AB01}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = UnityScript.booproj + StartupItem = ..\us\us.booproj EndGlobalSection EndGlobal diff --git a/src/us/us.booproj b/src/us/us.booproj index a254209..8024241 100755 --- a/src/us/us.booproj +++ b/src/us/us.booproj @@ -1 +1,53 @@ - Debug AnyCPU 9.0.21022 2.0 {2C02FCE8-42AD-474F-804E-F39C5164A1DE} Exe us false us v3.5 true full bin\Debug prompt false false none bin\Release prompt false false {A4F2FB34-6254-473D-9EB4-FAF062AF1AEB} UnityScript {2784E7F4-5206-4BF9-99CD-96B1D94D0E19} UnityScript.Lang \ No newline at end of file + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {2C02FCE8-42AD-474F-804E-F39C5164A1DE} + Exe + us + false + us + v3.5 + + + true + full + bin\Debug + prompt + false + + false + + + none + bin\Release + prompt + false + + false + + + + + + + + + + + + + + + {A4F2FB34-6254-473D-9EB4-FAF062AF1AEB} + UnityScript + + + {2784E7F4-5206-4BF9-99CD-96B1D94D0E19} + UnityScript.Lang + + + \ No newline at end of file From e15be5fc94fc47428b4cba23d7bada8c1a92462e Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 11 Jun 2010 22:20:10 -0300 Subject: [PATCH 006/276] operator precedence fixes --- .../IntegrationTestFixture.boo | 36 +- .../ParserTestFixture.Generated.boo | 16 +- src/UnityScript/UnityScript.g | 348 +++++++++--------- tests/integration/shift-left-bitwise-or.js | 5 + tests/parser/plusplus-minusminus.js | 5 + tests/parser/shift-left-bitwise-or.js | 4 + 6 files changed, 222 insertions(+), 192 deletions(-) create mode 100644 tests/integration/shift-left-bitwise-or.js create mode 100644 tests/parser/plusplus-minusminus.js create mode 100644 tests/parser/shift-left-bitwise-or.js diff --git a/src/UnityScript.Tests/IntegrationTestFixture.boo b/src/UnityScript.Tests/IntegrationTestFixture.boo index 69fbedb..3aac7f9 100644 --- a/src/UnityScript.Tests/IntegrationTestFixture.boo +++ b/src/UnityScript.Tests/IntegrationTestFixture.boo @@ -6,6 +6,14 @@ import NUnit.Framework [TestFixture] class IntegrationTestFixture(AbstractIntegrationTestFixture): + [Test] + def JSCheckFloatToIntOverflow(): + RunTestCase("tests/integration/JSCheckFloatToIntOverflow.js") + + [Test] + def JSChooseOverload(): + RunTestCase("tests/integration/JSChooseOverload.js") + [Test] def accessor_2_duck(): RunTestCase("tests/integration/accessor-2-duck.js") @@ -42,14 +50,18 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): def anonymous_function_type_3(): RunTestCase("tests/integration/anonymous-function-type-3.js") - [Test] - def array_access(): - RunTestCase("tests/integration/array-access.js") - [Test] def array_Add(): RunTestCase("tests/integration/array-Add.js") + [Test] + def array_Remove(): + RunTestCase("tests/integration/array-Remove.js") + + [Test] + def array_access(): + RunTestCase("tests/integration/array-access.js") + [Test] def array_cast_2(): RunTestCase("tests/integration/array-cast-2.js") @@ -146,10 +158,6 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): def array_push(): RunTestCase("tests/integration/array-push.js") - [Test] - def array_Remove(): - RunTestCase("tests/integration/array-Remove.js") - [Test] def array_shift(): RunTestCase("tests/integration/array-shift.js") @@ -470,14 +478,6 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): def invalidil(): RunTestCase("tests/integration/invalidil.js") - [Test] - def JSCheckFloatToIntOverflow(): - RunTestCase("tests/integration/JSCheckFloatToIntOverflow.js") - - [Test] - def JSChooseOverload(): - RunTestCase("tests/integration/JSChooseOverload.js") - [Test] def length_string(): RunTestCase("tests/integration/length-string.js") @@ -554,6 +554,10 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): def script_attributes(): RunTestCase("tests/integration/script-attributes.js") + [Test] + def shift_left_bitwise_or(): + RunTestCase("tests/integration/shift-left-bitwise-or.js") + [Test] def string_append(): RunTestCase("tests/integration/string-append.js") diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index 0426607..be49a23 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -5,6 +5,10 @@ import NUnit.Framework partial class ParserTestFixture: + [Test] + def OperationInsideAParam(): + RunTestCase("tests/parser/OperationInsideAParam.js") + [Test] def attributes_1(): RunTestCase("tests/parser/attributes-1.js") @@ -145,10 +149,6 @@ partial class ParserTestFixture: def new_4(): RunTestCase("tests/parser/new-4.js") - [Test] - def OperationInsideAParam(): - RunTestCase("tests/parser/OperationInsideAParam.js") - [Test] def operators_1(): RunTestCase("tests/parser/operators-1.js") @@ -177,10 +177,18 @@ partial class ParserTestFixture: def partial_1(): RunTestCase("tests/parser/partial-1.js") + [Test] + def plusplus_minusminus(): + RunTestCase("tests/parser/plusplus-minusminus.js") + [Test] def scientific_notation(): RunTestCase("tests/parser/scientific-notation.js") + [Test] + def shift_left_bitwise_or(): + RunTestCase("tests/parser/shift-left-bitwise-or.js") + [Test] def try_1(): RunTestCase("tests/parser/try-1.js") diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 6700d64..afd5e5f 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -44,7 +44,6 @@ tokens INTERFACE="interface"; INSTANCEOF="instanceof"; NEW="new"; - NOT="not"; NULL="null"; RETURN="return"; PUBLIC="public"; @@ -101,16 +100,13 @@ tokens INCREMENT="++"; DECREMENT="--"; ADD="+"; - INPLACE_ADD="+="; SUBTRACT="-"; - INPLACE_SUBTRACT="-="; MODULUS="%"; MULTIPLY="*"; EQUALITY="=="; INEQUALITY="!="; - NOT="!"; QUESTION_MARK="?"; - ONES_COMPLEMENT="~"; + BITWISE_NOT="~"; REFERENCE_EQUALITY="==="; REFERENCE_INEQUALITY="!=="; LESS_THAN="<"; @@ -1345,84 +1341,163 @@ assignment_expression returns [Expression e] )? ; -conditional_expression returns [Expression e] +slicing_expression returns [Expression e] { + se as SlicingExpression + mce as MethodInvocationExpression + args as ExpressionCollection + memberName as IToken }: - e=logical_expression + e=atom + ( options { greedy=true; }: + ( + lbrack:LBRACK + { + se = SlicingExpression(ToLexicalInfo(lbrack)) + se.Target = e + e = se + } + slice[se] (COMMA slice[se])* + RBRACK + ) + | + ( + DOT memberName=member + { + e = MemberReferenceExpression(ToLexicalInfo(memberName), Target: e, Name: memberName.getText()) + } + ) + | + ( + lparen:LPAREN + { + mce = MethodInvocationExpression(ToLexicalInfo(lparen)) + mce.Target = e + e = mce + args = mce.Arguments + } + expression_list[args] + RPAREN + ) + )* +; + + +postfix_unary_expression returns [Expression e] +{ +}: + e=slicing_expression ( - qm:QUESTION_MARK - trueValue=logical_expression - COLON - falseValue=conditional_expression + postinc:INCREMENT { token = postinc; operator = UnaryOperatorType.PostIncrement; } | + preinc:DECREMENT { token = preinc; operator= UnaryOperatorType.PostDecrement; } + )? + { e = UnaryExpression(ToLexicalInfo(token), operator, e) if token is not null } +; + +unary_expression returns [Expression e] +{ + uOperator = UnaryOperatorType.None +}: + ( + ( + ( + sub:SUBTRACT { op = sub; uOperator = UnaryOperatorType.UnaryNegation; } | + inc:INCREMENT { op = inc; uOperator = UnaryOperatorType.Increment; } | + dec:DECREMENT { op = dec; uOperator = UnaryOperatorType.Decrement; } | + nt:NOT { op = nt; uOperator = UnaryOperatorType.LogicalNot; } | + oc:BITWISE_NOT { op = oc; uOperator = UnaryOperatorType.OnesComplement; } + ) + e=unary_expression + { e = UnaryExpression(ToLexicalInfo(op), uOperator, e) if op is not null } + ) + | e=postfix_unary_expression + ) + ( + t:AS + tr=type_reference { - e = ConditionalExpression(ToLexicalInfo(qm), - Condition: e, - TrueValue: trueValue, - FalseValue: falseValue) + e = TryCastExpression(ToLexicalInfo(t), Target: e, Type: tr) } )? ; -logical_expression returns [Expression e] +term returns [Expression e] { + op = BinaryOperatorType.None }: - e=boolean_term - ( - op:LOGICAL_OR - rhs=boolean_term + e=unary_expression + ( options { greedy = true; } : + ( + m:MULTIPLY { op=BinaryOperatorType.Multiply; token=m; } | + d:DIVISION { op=BinaryOperatorType.Division; token=d; } | + md:MODULUS { op=BinaryOperatorType.Modulus; token=md; } + ) + r=unary_expression { - e = BinaryExpression(ToLexicalInfo(op), - Operator: BinaryOperatorType.Or, - Left: e, - Right: rhs) + be = BinaryExpression(ToLexicalInfo(token)) + be.Operator = op + be.Left = e + be.Right = r + e = be } )* ; -boolean_term returns [Expression e] +sum returns [Expression e] { + bOperator = BinaryOperatorType.None; }: - e=comparison_expression - ( - op:LOGICAL_AND - rhs=comparison_expression + e=term + ( options { greedy = true; } : + ( + add:ADD { op=add; bOperator = BinaryOperatorType.Addition; } | + sub:SUBTRACT { op=sub; bOperator = BinaryOperatorType.Subtraction; } + ) + r=term { - e=BinaryExpression(ToLexicalInfo(op), - Operator: BinaryOperatorType.And, - Left: e, - Right: rhs) + be = BinaryExpression(ToLexicalInfo(op)) + be.Operator = bOperator + be.Left = e + be.Right = r + e = be + } + )* +; + +shift returns [Expression e] +{ +}: + e=sum + ( options { greedy = true;} : + ( + sl:SHIFT_LEFT { op = BinaryOperatorType.ShiftLeft; token = sl } | + sr:SHIFT_RIGHT { op = BinaryOperatorType.ShiftRight; token = sr } + ) + r=sum + { + e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) } )* ; -comparison_expression returns [Expression e] +comparison returns [Expression e] { r as Expression op = BinaryOperatorType.None; token as IToken }: - e=sum + e=shift ( options { greedy = true; } : ( ( ( - (te:EQUALITY { op = BinaryOperatorType.Equality; token = te; } ) | - (ti:INEQUALITY { op = BinaryOperatorType.Inequality; token =ti }) | + (tin:IN { op = BinaryOperatorType.Member; token = tin; } ) | (tgt:GREATER_THAN { op = BinaryOperatorType.GreaterThan; token = tgt; } ) | (tgte:GREATER_THAN_OR_EQUAL { op = BinaryOperatorType.GreaterThanOrEqual; token = tgte }) | (tlt:LESS_THAN { op = BinaryOperatorType.LessThan; token = tlt; }) | - (tlte:LESS_THAN_OR_EQUAL { op = BinaryOperatorType.LessThanOrEqual; token = tlte; }) | - (re:REFERENCE_EQUALITY { op = BinaryOperatorType.ReferenceEquality; token = re }) | - (rie:REFERENCE_INEQUALITY { op = BinaryOperatorType.ReferenceInequality; token = rie }) + (tlte:LESS_THAN_OR_EQUAL { op = BinaryOperatorType.LessThanOrEqual; token = tlte; }) ) - r=sum - ) | - ( - ( - (tin:IN { op = BinaryOperatorType.Member; token = tin; } ) | - (tnint:NOT IN { op = BinaryOperatorType.NotMember; token = tnint; }) - ) - r=expression + r=shift ) | ( tisa:INSTANCEOF @@ -1444,66 +1519,50 @@ comparison_expression returns [Expression e] )* ; -sum returns [Expression e] +equality returns [Expression e] { - bOperator = BinaryOperatorType.None; }: - e=term - ( options { greedy = true; } : + e=comparison + (options { greedy = true; }: ( - add:ADD { op=add; bOperator = BinaryOperatorType.Addition; } | - sub:SUBTRACT { op=sub; bOperator = BinaryOperatorType.Subtraction; } | - eo:EXCLUSIVE_OR { op=eo; bOperator = BinaryOperatorType.ExclusiveOr; } + (te:EQUALITY { op = BinaryOperatorType.Equality; token = te; } ) | + (ti:INEQUALITY { op = BinaryOperatorType.Inequality; token = ti }) | + (re:REFERENCE_EQUALITY { op = BinaryOperatorType.ReferenceEquality; token = re }) | + (rie:REFERENCE_INEQUALITY { op = BinaryOperatorType.ReferenceInequality; token = rie }) ) - r=term - { - be = BinaryExpression(ToLexicalInfo(op)) - be.Operator = bOperator - be.Left = e - be.Right = r - e = be - } + r=comparison + { e = BinaryExpression(ToLexicalInfo(token), op, e, r) } )* ; -term returns [Expression e] + +bitwise_and returns [Expression e] { - op = BinaryOperatorType.None }: - e=factor - ( options { greedy = true; } : - ( - m:MULTIPLY { op=BinaryOperatorType.Multiply; token=m; } | - d:DIVISION { op=BinaryOperatorType.Division; token=d; } | - md:MODULUS { op=BinaryOperatorType.Modulus; token=md; } - ) - r=factor + e=equality + (options { greedy = true; }: + token:BITWISE_AND { op = BinaryOperatorType.BitwiseAnd; } + r=equality { - be = BinaryExpression(ToLexicalInfo(token)) - be.Operator = op - be.Left = e - be.Right = r - e = be + e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) } )* ; -factor returns [Expression e] +bitwise_xor returns [Expression e] { }: - e=bitwise_or - ( options { greedy = true;} : - ( - sl:SHIFT_LEFT { op = BinaryOperatorType.ShiftLeft; token = sl } | - sr:SHIFT_RIGHT { op = BinaryOperatorType.ShiftRight; token = sr } - ) - r=bitwise_or + e=bitwise_and + (options { greedy = true; }: + token:BITWISE_XOR { op = BinaryOperatorType.ExclusiveOr; } + r=bitwise_and { e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) } )* ; + bitwise_or returns [Expression e] { }: @@ -1519,112 +1578,57 @@ bitwise_or returns [Expression e] )* ; -bitwise_xor returns [Expression e] +logical_and returns [Expression e] { }: - e=bitwise_and - (options { greedy = true; }: - token:BITWISE_XOR { op = BinaryOperatorType.ExclusiveOr; } - r=bitwise_and + e=bitwise_or + ( + op:LOGICAL_AND + rhs=bitwise_or { - e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) + e=BinaryExpression(ToLexicalInfo(op), + Operator: BinaryOperatorType.And, + Left: e, + Right: rhs) } )* ; -bitwise_and returns [Expression e] +logical_or returns [Expression e] { }: - e=unary_expression - (options { greedy = true; }: - token:BITWISE_AND { op = BinaryOperatorType.BitwiseAnd; } - r=unary_expression + e=logical_and + ( + op:LOGICAL_OR + rhs=logical_and { - e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) + e = BinaryExpression(ToLexicalInfo(op), + Operator: BinaryOperatorType.Or, + Left: e, + Right: rhs) } )* ; -unary_expression returns [Expression e] +conditional_expression returns [Expression e] { - uOperator = UnaryOperatorType.None -}: - ( - ( - ( - sub:SUBTRACT { op = sub; uOperator = UnaryOperatorType.UnaryNegation; } | - inc:INCREMENT { op = inc; uOperator = UnaryOperatorType.Increment; } | - dec:DECREMENT { op = dec; uOperator = UnaryOperatorType.Decrement; } | - nt:NOT { op = nt; uOperator = UnaryOperatorType.LogicalNot; } | - oc:ONES_COMPLEMENT { op = oc; uOperator = UnaryOperatorType.OnesComplement; } - ) - e=slicing_expression - ) | - ( - e=slicing_expression - ( - postinc:INCREMENT { op = postinc; uOperator = UnaryOperatorType.PostIncrement; } | - preinc:DECREMENT { op = preinc; uOperator= UnaryOperatorType.PostDecrement; } - )? - ) - ) - { - if op is not null: - ue = UnaryExpression(ToLexicalInfo(op)) - ue.Operator = uOperator - ue.Operand = e - e = ue - } +}: + e=logical_or ( - t:AS - tr=type_reference + qm:QUESTION_MARK + trueValue=logical_or + COLON + falseValue=conditional_expression { - ae = TryCastExpression(ToLexicalInfo(t), Target: e, Type: tr) - e = ae + e = ConditionalExpression(ToLexicalInfo(qm), + Condition: e, + TrueValue: trueValue, + FalseValue: falseValue) } )? ; -slicing_expression returns [Expression e] -{ - se as SlicingExpression - mce as MethodInvocationExpression - args as ExpressionCollection - memberName as IToken -}: - e=atom - ( options { greedy=true; }: - ( - lbrack:LBRACK - { - se = SlicingExpression(ToLexicalInfo(lbrack)) - se.Target = e - e = se - } - slice[se] (COMMA slice[se])* - RBRACK - ) - | - ( - DOT memberName=member - { - e = MemberReferenceExpression(ToLexicalInfo(memberName), Target: e, Name: memberName.getText()) - } - ) - | - ( - lparen:LPAREN - { - mce = MethodInvocationExpression(ToLexicalInfo(lparen)) - mce.Target = e - e = mce - args = mce.Arguments - } - expression_list[args] - RPAREN - ) - )* -; + literal returns [Expression e] { @@ -1870,7 +1874,7 @@ NOT: '!'; QUESTION_MARK: '?'; -ONES_COMPLEMENT: '~'; +BITWISE_NOT: '~'; REFERENCE_EQUALITY: "==="; diff --git a/tests/integration/shift-left-bitwise-or.js b/tests/integration/shift-left-bitwise-or.js new file mode 100644 index 0000000..37ecf3f --- /dev/null +++ b/tests/integration/shift-left-bitwise-or.js @@ -0,0 +1,5 @@ +/* +768 +*/ +var value = 1<<9 | 1<<8; +print(value); diff --git a/tests/parser/plusplus-minusminus.js b/tests/parser/plusplus-minusminus.js new file mode 100644 index 0000000..fe25cb7 --- /dev/null +++ b/tests/parser/plusplus-minusminus.js @@ -0,0 +1,5 @@ +/* +value = (((((a++) + (b--)) - (c++)) + ((++d) * (-e))) + (~(--f))) +*/ +value = a++ + b-- - c++ + ++d * -e + ~--f; + diff --git a/tests/parser/shift-left-bitwise-or.js b/tests/parser/shift-left-bitwise-or.js new file mode 100644 index 0000000..a0aef34 --- /dev/null +++ b/tests/parser/shift-left-bitwise-or.js @@ -0,0 +1,4 @@ +/* +value = ((1 << 9) | (1 << 8)) +*/ +value = 1<<9 | 1<<8; From 1a7580c2c3b6871a94e605dcbc753c0ee0a54ef2 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 11 Jun 2010 22:20:28 -0300 Subject: [PATCH 007/276] antlr generated files for latest operator precedence fixes --- src/UnityScript/Parser/UnityScriptLexer.boo | 3700 ++++--- src/UnityScript/Parser/UnityScriptParser.boo | 8949 +++++++++-------- .../Parser/UnityScriptTokenTypes.boo | 239 +- .../Parser/UnityScriptTokenTypes.txt | 229 +- 4 files changed, 6557 insertions(+), 6560 deletions(-) diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index faaa98b..5defaae 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -1,1854 +1,1852 @@ -// $ANTLR 2.7.5 (20050517): "src/UnityScript/UnityScript.g" -> "UnityScriptLexer.boo"$ - -namespace UnityScript.Parser -// Generate header specific to lexer Boo file -import System -import System.IO.Stream as Stream -import System.IO.TextReader as TextReader -import System.Collections.Hashtable as Hashtable -import System.Collections.Comparer as Comparer - -import antlr.TokenStreamException as TokenStreamException -import antlr.TokenStreamIOException as TokenStreamIOException -import antlr.TokenStreamRecognitionException as TokenStreamRecognitionException -import antlr.CharStreamException as CharStreamException -import antlr.CharStreamIOException as CharStreamIOException -import antlr.ANTLRException as ANTLRException -import antlr.CharScanner as CharScanner -import antlr.InputBuffer as InputBuffer -import antlr.ByteBuffer as ByteBuffer -import antlr.CharBuffer as CharBuffer -import antlr.Token as Token -import antlr.IToken as IToken -import antlr.CommonToken as CommonToken -import antlr.SemanticException as SemanticException -import antlr.RecognitionException as RecognitionException -import antlr.NoViableAltForCharException as NoViableAltForCharException -import antlr.MismatchedCharException as MismatchedCharException -import antlr.TokenStream as TokenStream -import antlr.LexerSharedInputState as LexerSharedInputState -import antlr.collections.impl.BitSet as BitSet - -class UnityScriptLexer(antlr.CharScanner, TokenStream): - public static final EOF = 1 - public static final NULL_TREE_LOOKAHEAD = 3 - public static final AS = 4 - public static final BREAK = 5 - public static final CATCH = 6 - public static final CLASS = 7 - public static final CONTINUE = 8 - public static final ELSE = 9 - public static final ENUM = 10 - public static final EXTENDS = 11 - public static final FALSE = 12 - public static final FINAL = 13 - public static final FINALLY = 14 - public static final FOR = 15 - public static final FUNCTION = 16 - public static final GET = 17 - public static final IF = 18 - public static final IMPORT = 19 - public static final IMPLEMENTS = 20 - public static final IN = 21 - public static final INTERFACE = 22 - public static final INSTANCEOF = 23 - public static final NEW = 24 - public static final NOT = 25 - public static final NULL = 26 - public static final RETURN = 27 - public static final PUBLIC = 28 - public static final PROTECTED = 29 - public static final INTERNAL = 30 - public static final OVERRIDE = 31 - public static final PARTIAL = 32 - public static final PRAGMA = 33 - public static final PRIVATE = 34 - public static final SET = 35 - public static final STATIC = 36 - public static final SUPER = 37 - public static final THIS = 38 - public static final THROW = 39 - public static final TRUE = 40 - public static final TRY = 41 - public static final TYPEOF = 42 - public static final VAR = 43 - public static final VIRTUAL = 44 - public static final WHILE = 45 - public static final YIELD = 46 - public static final SWITCH = 47 - public static final CASE = 48 - public static final DEFAULT = 49 - public static final INPLACE_DIVISION = 50 - public static final INPLACE_ADD = 51 - public static final INPLACE_SUBTRACT = 52 - public static final INPLACE_MULTIPLY = 53 - public static final ID = 54 - public static final DOUBLE_QUOTED_STRING = 55 - public static final LBRACE = 56 - public static final RBRACE = 57 - public static final LPAREN = 58 - public static final RPAREN = 59 - public static final DOT = 60 - public static final COLON = 61 - public static final COMMA = 62 - public static final LBRACK = 63 - public static final RBRACK = 64 - public static final BITWISE_OR = 65 - public static final INPLACE_BITWISE_OR = 66 - public static final BITWISE_AND = 67 - public static final BITWISE_XOR = 68 - public static final INPLACE_BITWISE_AND = 69 - public static final LOGICAL_OR = 70 - public static final LOGICAL_AND = 71 - public static final EOS = 72 - public static final ASSIGN = 73 - public static final INCREMENT = 74 - public static final DECREMENT = 75 - public static final ADD = 76 - public static final SUBTRACT = 77 - public static final MODULUS = 78 - public static final MULTIPLY = 79 - public static final EQUALITY = 80 - public static final INEQUALITY = 81 - public static final QUESTION_MARK = 82 - public static final ONES_COMPLEMENT = 83 - public static final REFERENCE_EQUALITY = 84 - public static final REFERENCE_INEQUALITY = 85 - public static final LESS_THAN = 86 - public static final LESS_THAN_OR_EQUAL = 87 - public static final SHIFT_LEFT = 88 - public static final INPLACE_SHIFT_LEFT = 89 - public static final GREATER_THAN = 90 - public static final GREATER_THAN_OR_EQUAL = 91 - public static final SHIFT_RIGHT = 92 - public static final INPLACE_SHIFT_RIGHT = 93 - public static final AT = 94 - public static final SCRIPT_ATTRIBUTE_MARKER = 95 - public static final HASH = 96 - public static final INPLACE_BITWISE_XOR = 97 - public static final EXCLUSIVE_OR = 98 - public static final DIVISION = 99 - public static final RE_LITERAL = 100 - public static final DOUBLE = 101 - public static final INT = 102 - public static final LONG = 103 - public static final DOUBLE_SUFFIX = 104 - public static final EXPONENT = 105 - public static final WHITE_SPACE = 106 - public static final DQS_ESC = 107 - public static final SQS_ESC = 108 - public static final SESC = 109 - public static final ML_COMMENT = 110 - public static final RE_CHAR = 111 - public static final RE_ESC = 112 - public static final NEWLINE = 113 - public static final ID_LETTER = 114 - public static final DIGIT = 115 - public static final HEXDIGIT = 116 - +// $ANTLR 2.7.5 (20050517): "UnityScript.g" -> "UnityScriptLexer.boo"$ + +namespace UnityScript.Parser +// Generate header specific to lexer Boo file +import System +import System.IO.Stream as Stream +import System.IO.TextReader as TextReader +import System.Collections.Hashtable as Hashtable +import System.Collections.Comparer as Comparer + +import antlr.TokenStreamException as TokenStreamException +import antlr.TokenStreamIOException as TokenStreamIOException +import antlr.TokenStreamRecognitionException as TokenStreamRecognitionException +import antlr.CharStreamException as CharStreamException +import antlr.CharStreamIOException as CharStreamIOException +import antlr.ANTLRException as ANTLRException +import antlr.CharScanner as CharScanner +import antlr.InputBuffer as InputBuffer +import antlr.ByteBuffer as ByteBuffer +import antlr.CharBuffer as CharBuffer +import antlr.Token as Token +import antlr.IToken as IToken +import antlr.CommonToken as CommonToken +import antlr.SemanticException as SemanticException +import antlr.RecognitionException as RecognitionException +import antlr.NoViableAltForCharException as NoViableAltForCharException +import antlr.MismatchedCharException as MismatchedCharException +import antlr.TokenStream as TokenStream +import antlr.LexerSharedInputState as LexerSharedInputState +import antlr.collections.impl.BitSet as BitSet + +class UnityScriptLexer(antlr.CharScanner, TokenStream): + public static final EOF = 1 + public static final NULL_TREE_LOOKAHEAD = 3 + public static final AS = 4 + public static final BREAK = 5 + public static final CATCH = 6 + public static final CLASS = 7 + public static final CONTINUE = 8 + public static final ELSE = 9 + public static final ENUM = 10 + public static final EXTENDS = 11 + public static final FALSE = 12 + public static final FINAL = 13 + public static final FINALLY = 14 + public static final FOR = 15 + public static final FUNCTION = 16 + public static final GET = 17 + public static final IF = 18 + public static final IMPORT = 19 + public static final IMPLEMENTS = 20 + public static final IN = 21 + public static final INTERFACE = 22 + public static final INSTANCEOF = 23 + public static final NEW = 24 + public static final NULL = 25 + public static final RETURN = 26 + public static final PUBLIC = 27 + public static final PROTECTED = 28 + public static final INTERNAL = 29 + public static final OVERRIDE = 30 + public static final PARTIAL = 31 + public static final PRAGMA = 32 + public static final PRIVATE = 33 + public static final SET = 34 + public static final STATIC = 35 + public static final SUPER = 36 + public static final THIS = 37 + public static final THROW = 38 + public static final TRUE = 39 + public static final TRY = 40 + public static final TYPEOF = 41 + public static final VAR = 42 + public static final VIRTUAL = 43 + public static final WHILE = 44 + public static final YIELD = 45 + public static final SWITCH = 46 + public static final CASE = 47 + public static final DEFAULT = 48 + public static final INPLACE_DIVISION = 49 + public static final INPLACE_ADD = 50 + public static final INPLACE_SUBTRACT = 51 + public static final INPLACE_MULTIPLY = 52 + public static final ID = 53 + public static final DOUBLE_QUOTED_STRING = 54 + public static final LBRACE = 55 + public static final RBRACE = 56 + public static final LPAREN = 57 + public static final RPAREN = 58 + public static final DOT = 59 + public static final COLON = 60 + public static final COMMA = 61 + public static final LBRACK = 62 + public static final RBRACK = 63 + public static final BITWISE_OR = 64 + public static final INPLACE_BITWISE_OR = 65 + public static final BITWISE_AND = 66 + public static final BITWISE_XOR = 67 + public static final INPLACE_BITWISE_AND = 68 + public static final LOGICAL_OR = 69 + public static final LOGICAL_AND = 70 + public static final EOS = 71 + public static final ASSIGN = 72 + public static final INCREMENT = 73 + public static final DECREMENT = 74 + public static final ADD = 75 + public static final SUBTRACT = 76 + public static final MODULUS = 77 + public static final MULTIPLY = 78 + public static final EQUALITY = 79 + public static final INEQUALITY = 80 + public static final QUESTION_MARK = 81 + public static final BITWISE_NOT = 82 + public static final REFERENCE_EQUALITY = 83 + public static final REFERENCE_INEQUALITY = 84 + public static final LESS_THAN = 85 + public static final LESS_THAN_OR_EQUAL = 86 + public static final SHIFT_LEFT = 87 + public static final INPLACE_SHIFT_LEFT = 88 + public static final GREATER_THAN = 89 + public static final GREATER_THAN_OR_EQUAL = 90 + public static final SHIFT_RIGHT = 91 + public static final INPLACE_SHIFT_RIGHT = 92 + public static final AT = 93 + public static final SCRIPT_ATTRIBUTE_MARKER = 94 + public static final HASH = 95 + public static final INPLACE_BITWISE_XOR = 96 + public static final NOT = 97 + public static final DIVISION = 98 + public static final RE_LITERAL = 99 + public static final DOUBLE = 100 + public static final INT = 101 + public static final LONG = 102 + public static final DOUBLE_SUFFIX = 103 + public static final EXPONENT = 104 + public static final WHITE_SPACE = 105 + public static final DQS_ESC = 106 + public static final SQS_ESC = 107 + public static final SESC = 108 + public static final ML_COMMENT = 109 + public static final RE_CHAR = 110 + public static final RE_ESC = 111 + public static final NEWLINE = 112 + public static final ID_LETTER = 113 + public static final DIGIT = 114 + public static final HEXDIGIT = 115 + static def IsDigit(ch as char): return ch >= char('0') and ch <= char('9') - def constructor(ins as Stream): - self(ByteBuffer(ins)) - - def constructor(r as TextReader): - self(CharBuffer(r)) - - def constructor(ib as InputBuffer): - self(LexerSharedInputState(ib)) - - def constructor(state as LexerSharedInputState): - super(state) - initialize() - - private def initialize(): - caseSensitiveLiterals = true - setCaseSensitive(true) - literals = Hashtable(100, 0.4, null, Comparer.Default) - literals.Add(",", 62) - literals.Add("public", 28) - literals.Add("a string", 55) - literals.Add("an identifier", 54) - literals.Add("]", 64) - literals.Add("case", 48) - literals.Add("break", 5) - literals.Add("while", 45) - literals.Add("new", 24) - literals.Add("||", 70) - literals.Add("+", 76) - literals.Add("instanceof", 23) - literals.Add("implements", 20) - literals.Add("*", 79) - literals.Add("|=", 66) - literals.Add("typeof", 42) - literals.Add("[", 63) - literals.Add(">>=", 93) - literals.Add("not", 25) - literals.Add("return", 27) - literals.Add("throw", 39) - literals.Add("var", 43) - literals.Add(")", 59) - literals.Add("==", 80) - literals.Add("null", 26) - literals.Add("protected", 29) - literals.Add("@script", 95) - literals.Add("class", 7) - literals.Add("(", 58) - literals.Add("~", 83) - literals.Add("function", 16) - literals.Add("/=", 50) - literals.Add("super", 37) - literals.Add("@", 94) - literals.Add("-=", 52) - literals.Add("set", 35) - literals.Add("+=", 51) - literals.Add("!==", 85) - literals.Add("}", 57) - literals.Add("interface", 22) - literals.Add("?", 82) - literals.Add("&", 67) - literals.Add("internal", 30) - literals.Add("final", 13) - literals.Add("yield", 46) - literals.Add("!=", 81) - literals.Add("===", 84) - literals.Add("if", 18) - literals.Add("|", 65) - literals.Add("override", 31) - literals.Add(">", 90) - literals.Add("as", 4) - literals.Add("%", 78) - literals.Add("pragma", 33) - literals.Add("catch", 6) - literals.Add("try", 41) - literals.Add("{", 56) - literals.Add("=", 73) - literals.Add("enum", 10) - literals.Add("for", 15) - literals.Add(">>", 92) - literals.Add("extends", 11) - literals.Add("private", 34) - literals.Add("default", 49) - literals.Add("--", 75) - literals.Add("<", 86) - literals.Add("false", 12) - literals.Add("this", 38) - literals.Add("static", 36) - literals.Add(">=", 91) - literals.Add("<=", 87) - literals.Add("partial", 32) - literals.Add(";", 72) - literals.Add("get", 17) - literals.Add("<<=", 89) - literals.Add("continue", 8) - literals.Add("&&", 71) - literals.Add("<<", 88) - literals.Add(".", 60) - literals.Add("finally", 14) - literals.Add("else", 9) - literals.Add("import", 19) - literals.Add("++", 74) - literals.Add(":", 61) - literals.Add("in", 21) - literals.Add("switch", 47) - literals.Add("true", 40) - literals.Add("-", 77) - literals.Add("*=", 53) - literals.Add("virtual", 44) - literals.Add("^", 68) - literals.Add("&=", 69) - - override def nextToken() as IToken: - theRetToken as IToken - :tryAgain - while true: - _token as IToken = null - _ttype = Token.INVALID_TYPE - resetText() - try: // for char stream error handling - try: // for lexical error handling - _givenValue = cached_LA1 - if ((_givenValue == char('A')) - or (_givenValue ==char('B')) - or (_givenValue ==char('C')) - or (_givenValue ==char('D')) - or (_givenValue ==char('E')) - or (_givenValue ==char('F')) - or (_givenValue ==char('G')) - or (_givenValue ==char('H')) - or (_givenValue ==char('I')) - or (_givenValue ==char('J')) - or (_givenValue ==char('K')) - or (_givenValue ==char('L')) - or (_givenValue ==char('M')) - or (_givenValue ==char('N')) - or (_givenValue ==char('O')) - or (_givenValue ==char('P')) - or (_givenValue ==char('Q')) - or (_givenValue ==char('R')) - or (_givenValue ==char('S')) - or (_givenValue ==char('T')) - or (_givenValue ==char('U')) - or (_givenValue ==char('V')) - or (_givenValue ==char('W')) - or (_givenValue ==char('X')) - or (_givenValue ==char('Y')) - or (_givenValue ==char('Z')) - or (_givenValue ==char('_')) - or (_givenValue ==char('a')) - or (_givenValue ==char('b')) - or (_givenValue ==char('c')) - or (_givenValue ==char('d')) - or (_givenValue ==char('e')) - or (_givenValue ==char('f')) - or (_givenValue ==char('g')) - or (_givenValue ==char('h')) - or (_givenValue ==char('i')) - or (_givenValue ==char('j')) - or (_givenValue ==char('k')) - or (_givenValue ==char('l')) - or (_givenValue ==char('m')) - or (_givenValue ==char('n')) - or (_givenValue ==char('o')) - or (_givenValue ==char('p')) - or (_givenValue ==char('q')) - or (_givenValue ==char('r')) - or (_givenValue ==char('s')) - or (_givenValue ==char('t')) - or (_givenValue ==char('u')) - or (_givenValue ==char('v')) - or (_givenValue ==char('w')) - or (_givenValue ==char('x')) - or (_givenValue ==char('y')) - or (_givenValue ==char('z')) - ): // 1827 - mID(true) - theRetToken = returnToken_ - elif ((_givenValue == char('0')) - or (_givenValue ==char('1')) - or (_givenValue ==char('2')) - or (_givenValue ==char('3')) - or (_givenValue ==char('4')) - or (_givenValue ==char('5')) - or (_givenValue ==char('6')) - or (_givenValue ==char('7')) - or (_givenValue ==char('8')) - or (_givenValue ==char('9')) - ): // 1827 - mINT(true) - theRetToken = returnToken_ - elif ((_givenValue == char('.'))): // 1831 - mDOT(true) - theRetToken = returnToken_ - elif ((_givenValue == char(':'))): // 1831 - mCOLON(true) - theRetToken = returnToken_ - elif ((_givenValue == char(','))): // 1831 - mCOMMA(true) - theRetToken = returnToken_ - elif ((_givenValue == char('('))): // 1831 - mLPAREN(true) - theRetToken = returnToken_ - elif ((_givenValue == char(')'))): // 1831 - mRPAREN(true) - theRetToken = returnToken_ - elif ((_givenValue == char('['))): // 1831 - mLBRACK(true) - theRetToken = returnToken_ - elif ((_givenValue == char(']'))): // 1831 - mRBRACK(true) - theRetToken = returnToken_ - elif ((_givenValue == char('{'))): // 1831 - mLBRACE(true) - theRetToken = returnToken_ - elif ((_givenValue == char('}'))): // 1831 - mRBRACE(true) - theRetToken = returnToken_ - elif ((_givenValue == char(';'))): // 1831 - mEOS(true) - theRetToken = returnToken_ - elif ((_givenValue == char('#'))): // 1831 - mHASH(true) - theRetToken = returnToken_ - elif ((_givenValue == char('%'))): // 1831 - mMODULUS(true) - theRetToken = returnToken_ - elif ((_givenValue == char('?'))): // 1831 - mQUESTION_MARK(true) - theRetToken = returnToken_ - elif ((_givenValue == char('~'))): // 1831 - mONES_COMPLEMENT(true) - theRetToken = returnToken_ - elif ((_givenValue == char('@'))): // 1831 - mAT(true) - theRetToken = returnToken_ - elif ((_givenValue == char('/'))): // 1831 - mDIVISION(true) - theRetToken = returnToken_ - elif ((_givenValue == char('\t')) - or (_givenValue ==char('\n')) - or (_givenValue ==char('\u000c')) - or (_givenValue ==char('\r')) - or (_givenValue ==char(' ')) - ): // 1827 - mWHITE_SPACE(true) - theRetToken = returnToken_ - elif ((_givenValue == char('"'))): // 1831 - mDOUBLE_QUOTED_STRING(true) - theRetToken = returnToken_ - else: // line 1969 - if ((cached_LA1==char('=')) and (cached_LA2==char('=')) and (LA(3)==char('='))): - mREFERENCE_EQUALITY(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('!')) and (cached_LA2==char('=')) and (LA(3)==char('='))): // line 2102 - mREFERENCE_INEQUALITY(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('<')) and (cached_LA2==char('<')) and (LA(3)==char('='))): // line 2102 - mINPLACE_SHIFT_LEFT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('>')) and (cached_LA2==char('>')) and (LA(3)==char('='))): // line 2102 - mINPLACE_SHIFT_RIGHT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('|')) and (cached_LA2==char('='))): // line 2102 - mINPLACE_BITWISE_OR(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('&')) and (cached_LA2==char('='))): // line 2102 - mINPLACE_BITWISE_AND(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('^')) and (cached_LA2==char('='))): // line 2102 - mINPLACE_BITWISE_XOR(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('|')) and (cached_LA2==char('|'))): // line 2102 - mLOGICAL_OR(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('&')) and (cached_LA2==char('&'))): // line 2102 - mLOGICAL_AND(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('+')) and (cached_LA2==char('+'))): // line 2102 - mINCREMENT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('-')) and (cached_LA2==char('-'))): // line 2102 - mDECREMENT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('+')) and (cached_LA2==char('='))): // line 2102 - mINPLACE_ADD(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('-')) and (cached_LA2==char('='))): // line 2102 - mINPLACE_SUBTRACT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('*')) and (cached_LA2==char('='))): // line 2102 - mINPLACE_MULTIPLY(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('=')) and (cached_LA2==char('=')) and (true)): // line 2102 - mEQUALITY(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('!')) and (cached_LA2==char('=')) and (true)): // line 2102 - mINEQUALITY(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('<')) and (cached_LA2==char('='))): // line 2102 - mLESS_THAN_OR_EQUAL(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('<')) and (cached_LA2==char('<')) and (true)): // line 2102 - mSHIFT_LEFT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('>')) and (cached_LA2==char('='))): // line 2102 - mGREATER_THAN_OR_EQUAL(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('>')) and (cached_LA2==char('>')) and (true)): // line 2102 - mSHIFT_RIGHT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('|')) and (true)): // line 2102 - mBITWISE_OR(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('&')) and (true)): // line 2102 - mBITWISE_AND(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('^')) and (true)): // line 2102 - mBITWISE_XOR(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('=')) and (true)): // line 2102 - mASSIGN(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('+')) and (true)): // line 2102 - mADD(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('-')) and (true)): // line 2102 - mSUBTRACT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('*')) and (true)): // line 2102 - mMULTIPLY(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('!')) and (true)): // line 2102 - mNOT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('<')) and (true)): // line 2102 - mLESS_THAN(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('>')) and (true)): // line 2102 - mGREATER_THAN(true) - theRetToken = returnToken_ - else: - if cached_LA1 == EOF_CHAR: - uponEOF(); returnToken_ = makeToken(Token.EOF_TYPE) - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - goto tryAgain if returnToken_ is null // found SKIP token - _ttype = returnToken_.Type - returnToken_.Type = _ttype - return returnToken_ - except e as RecognitionException: - raise TokenStreamRecognitionException(e) - except cse as CharStreamException: - if cse isa CharStreamIOException: - raise TokenStreamIOException(cast(CharStreamIOException, cse).io) - else: - raise TokenStreamException(cse.Message) - - public def mID(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = ID - - mID_LETTER(false) - while true: - _givenValue = cached_LA1 - if ((_givenValue == char('A')) - or (_givenValue ==char('B')) - or (_givenValue ==char('C')) - or (_givenValue ==char('D')) - or (_givenValue ==char('E')) - or (_givenValue ==char('F')) - or (_givenValue ==char('G')) - or (_givenValue ==char('H')) - or (_givenValue ==char('I')) - or (_givenValue ==char('J')) - or (_givenValue ==char('K')) - or (_givenValue ==char('L')) - or (_givenValue ==char('M')) - or (_givenValue ==char('N')) - or (_givenValue ==char('O')) - or (_givenValue ==char('P')) - or (_givenValue ==char('Q')) - or (_givenValue ==char('R')) - or (_givenValue ==char('S')) - or (_givenValue ==char('T')) - or (_givenValue ==char('U')) - or (_givenValue ==char('V')) - or (_givenValue ==char('W')) - or (_givenValue ==char('X')) - or (_givenValue ==char('Y')) - or (_givenValue ==char('Z')) - or (_givenValue ==char('_')) - or (_givenValue ==char('a')) - or (_givenValue ==char('b')) - or (_givenValue ==char('c')) - or (_givenValue ==char('d')) - or (_givenValue ==char('e')) - or (_givenValue ==char('f')) - or (_givenValue ==char('g')) - or (_givenValue ==char('h')) - or (_givenValue ==char('i')) - or (_givenValue ==char('j')) - or (_givenValue ==char('k')) - or (_givenValue ==char('l')) - or (_givenValue ==char('m')) - or (_givenValue ==char('n')) - or (_givenValue ==char('o')) - or (_givenValue ==char('p')) - or (_givenValue ==char('q')) - or (_givenValue ==char('r')) - or (_givenValue ==char('s')) - or (_givenValue ==char('t')) - or (_givenValue ==char('u')) - or (_givenValue ==char('v')) - or (_givenValue ==char('w')) - or (_givenValue ==char('x')) - or (_givenValue ==char('y')) - or (_givenValue ==char('z')) - ): // 1827 - mID_LETTER(false) - elif ((_givenValue == char('0')) - or (_givenValue ==char('1')) - or (_givenValue ==char('2')) - or (_givenValue ==char('3')) - or (_givenValue ==char('4')) - or (_givenValue ==char('5')) - or (_givenValue ==char('6')) - or (_givenValue ==char('7')) - or (_givenValue ==char('8')) - or (_givenValue ==char('9')) - ): // 1827 - mDIGIT(false) - else: // line 1969 - goto _loop304_breakloop - :_loop304_breakloop - _ttype = testLiteralsTable(_ttype) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mID_LETTER(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = ID_LETTER - - _givenValue = cached_LA1 - if ((_givenValue == char('_'))): // 1831 - match('_') - elif ((_givenValue == char('a')) - or (_givenValue ==char('b')) - or (_givenValue ==char('c')) - or (_givenValue ==char('d')) - or (_givenValue ==char('e')) - or (_givenValue ==char('f')) - or (_givenValue ==char('g')) - or (_givenValue ==char('h')) - or (_givenValue ==char('i')) - or (_givenValue ==char('j')) - or (_givenValue ==char('k')) - or (_givenValue ==char('l')) - or (_givenValue ==char('m')) - or (_givenValue ==char('n')) - or (_givenValue ==char('o')) - or (_givenValue ==char('p')) - or (_givenValue ==char('q')) - or (_givenValue ==char('r')) - or (_givenValue ==char('s')) - or (_givenValue ==char('t')) - or (_givenValue ==char('u')) - or (_givenValue ==char('v')) - or (_givenValue ==char('w')) - or (_givenValue ==char('x')) - or (_givenValue ==char('y')) - or (_givenValue ==char('z')) - ): // 1827 - matchRange(char('a'),char('z')) - elif ((_givenValue == char('A')) - or (_givenValue ==char('B')) - or (_givenValue ==char('C')) - or (_givenValue ==char('D')) - or (_givenValue ==char('E')) - or (_givenValue ==char('F')) - or (_givenValue ==char('G')) - or (_givenValue ==char('H')) - or (_givenValue ==char('I')) - or (_givenValue ==char('J')) - or (_givenValue ==char('K')) - or (_givenValue ==char('L')) - or (_givenValue ==char('M')) - or (_givenValue ==char('N')) - or (_givenValue ==char('O')) - or (_givenValue ==char('P')) - or (_givenValue ==char('Q')) - or (_givenValue ==char('R')) - or (_givenValue ==char('S')) - or (_givenValue ==char('T')) - or (_givenValue ==char('U')) - or (_givenValue ==char('V')) - or (_givenValue ==char('W')) - or (_givenValue ==char('X')) - or (_givenValue ==char('Y')) - or (_givenValue ==char('Z')) - ): // 1827 - matchRange(char('A'),char('Z')) - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mDIGIT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = DIGIT - - matchRange(char('0'),char('9')) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INT - - if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): - match("0x") - _cnt308 as int = 0 - while true: - if ((tokenSet_0_.member(cast(int, cached_LA1)))): - mHEXDIGIT(false) - else: - if (_cnt308 >= 1): - goto _loop308_breakloop - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt308 - :_loop308_breakloop - if ((cached_LA1==char('L') or cached_LA1==char('l'))): - _givenValue = cached_LA1 - if ((_givenValue == char('l'))): // 1831 - match('l') - elif ((_givenValue == char('L'))): // 1831 - match('L') - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if 0 == inputState.guessing: - _ttype = LONG; - else: // line 2053 - pass // 947 - elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt312 as int = 0 - while true: - if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): - mDIGIT(false) - else: - if (_cnt312 >= 1): - goto _loop312_breakloop - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt312 - :_loop312_breakloop - _givenValue = cached_LA1 - if ((_givenValue == char('L')) - or (_givenValue ==char('l')) - ): // 1827 - _givenValue = cached_LA1 - if ((_givenValue == char('l'))): // 1831 - match('l') - elif ((_givenValue == char('L'))): // 1831 - match('L') - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if 0 == inputState.guessing: - _ttype = LONG; - elif ((_givenValue == char('F')) - or (_givenValue ==char('f')) - ): // 1827 - _givenValue = cached_LA1 - if ((_givenValue == char('f'))): // 1831 - _saveIndex = text.Length - match('f') - text.Length = _saveIndex - elif ((_givenValue == char('F'))): // 1831 - _saveIndex = text.Length - match('F') - text.Length = _saveIndex - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if 0 == inputState.guessing: - _ttype = DOUBLE; - elif ((_givenValue == char('.'))): // 1831 - match('.') - mDOUBLE_SUFFIX(false) - if 0 == inputState.guessing: - _ttype = DOUBLE; - elif ((_givenValue == char('E')) - or (_givenValue ==char('e')) - ): // 1827 - mEXPONENT(false) - if 0 == inputState.guessing: - _ttype = DOUBLE; - else: // line 1969 - pass // 947 - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mHEXDIGIT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = HEXDIGIT - - _givenValue = cached_LA1 - if ((_givenValue == char('a')) - or (_givenValue ==char('b')) - or (_givenValue ==char('c')) - or (_givenValue ==char('d')) - or (_givenValue ==char('e')) - or (_givenValue ==char('f')) - ): // 1827 - matchRange(char('a'),char('f')) - elif ((_givenValue == char('A')) - or (_givenValue ==char('B')) - or (_givenValue ==char('C')) - or (_givenValue ==char('D')) - or (_givenValue ==char('E')) - or (_givenValue ==char('F')) - ): // 1827 - matchRange(char('A'),char('F')) - elif ((_givenValue == char('0')) - or (_givenValue ==char('1')) - or (_givenValue ==char('2')) - or (_givenValue ==char('3')) - or (_givenValue ==char('4')) - or (_givenValue ==char('5')) - or (_givenValue ==char('6')) - or (_givenValue ==char('7')) - or (_givenValue ==char('8')) - or (_givenValue ==char('9')) - ): // 1827 - matchRange(char('0'),char('9')) - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mDOUBLE_SUFFIX(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = DOUBLE_SUFFIX - - _cnt321 as int = 0 - while true: - if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): - mDIGIT(false) - else: - if (_cnt321 >= 1): - goto _loop321_breakloop - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt321 - :_loop321_breakloop - if ((cached_LA1==char('E') or cached_LA1==char('e'))): - mEXPONENT(false) - else: // line 2053 - pass // 947 - _givenValue = cached_LA1 - if ((_givenValue == char('f'))): // 1831 - _saveIndex = text.Length - match('f') - text.Length = _saveIndex - elif ((_givenValue == char('F'))): // 1831 - _saveIndex = text.Length - match('F') - text.Length = _saveIndex - else: // line 1969 - pass // 947 - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mEXPONENT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = EXPONENT - - _givenValue = cached_LA1 - if ((_givenValue == char('e'))): // 1831 - match('e') - elif ((_givenValue == char('E'))): // 1831 - match('E') - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _givenValue = cached_LA1 - if ((_givenValue == char('+'))): // 1831 - match('+') - elif ((_givenValue == char('-'))): // 1831 - match('-') - elif ((_givenValue == char('0')) - or (_givenValue ==char('1')) - or (_givenValue ==char('2')) - or (_givenValue ==char('3')) - or (_givenValue ==char('4')) - or (_givenValue ==char('5')) - or (_givenValue ==char('6')) - or (_givenValue ==char('7')) - or (_givenValue ==char('8')) - or (_givenValue ==char('9')) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt328 as int = 0 - while true: - if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): - mDIGIT(false) - else: - if (_cnt328 >= 1): - goto _loop328_breakloop - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt328 - :_loop328_breakloop - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mDOT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = DOT - - match('.') - if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): - mDOUBLE_SUFFIX(false) - if 0 == inputState.guessing: - _ttype = DOUBLE; - else: // line 2053 - pass // 947 - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mCOLON(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = COLON - - match(':') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mCOMMA(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = COMMA - - match(',') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mLPAREN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = LPAREN - - match('(') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mRPAREN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = RPAREN - - match(')') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mLBRACK(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = LBRACK - - match('[') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mRBRACK(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = RBRACK - - match(']') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mLBRACE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = LBRACE - - match('{') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mRBRACE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = RBRACE - - match('}') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mBITWISE_OR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = BITWISE_OR - - match('|') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINPLACE_BITWISE_OR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INPLACE_BITWISE_OR - - match("|=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mBITWISE_AND(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = BITWISE_AND - - match('&') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINPLACE_BITWISE_AND(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INPLACE_BITWISE_AND - - match("&=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mBITWISE_XOR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = BITWISE_XOR - - match('^') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINPLACE_BITWISE_XOR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INPLACE_BITWISE_XOR - - match("^=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mLOGICAL_OR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = LOGICAL_OR - - match("||") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mLOGICAL_AND(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = LOGICAL_AND - - match("&&") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mEOS(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = EOS - - match(';') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mASSIGN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = ASSIGN - - match('=') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINCREMENT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INCREMENT - - match("++") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mDECREMENT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = DECREMENT - - match("--") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mADD(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = ADD - - match('+') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mHASH(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = HASH - - match('#') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINPLACE_ADD(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INPLACE_ADD - - match("+=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mSUBTRACT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = SUBTRACT - - match('-') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINPLACE_SUBTRACT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INPLACE_SUBTRACT - - match("-=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mMODULUS(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = MODULUS - - match('%') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mMULTIPLY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = MULTIPLY - - match('*') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINPLACE_MULTIPLY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INPLACE_MULTIPLY - - match("*=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mEQUALITY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = EQUALITY - - match("==") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINEQUALITY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INEQUALITY - - match("!=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mNOT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = NOT - - match('!') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mQUESTION_MARK(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = QUESTION_MARK - - match('?') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mONES_COMPLEMENT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = ONES_COMPLEMENT - - match('~') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mREFERENCE_EQUALITY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = REFERENCE_EQUALITY - - match("===") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mREFERENCE_INEQUALITY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = REFERENCE_INEQUALITY - - match("!==") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mLESS_THAN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = LESS_THAN - - match('<') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mLESS_THAN_OR_EQUAL(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = LESS_THAN_OR_EQUAL - - match("<=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mSHIFT_LEFT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = SHIFT_LEFT - - match("<<") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINPLACE_SHIFT_LEFT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INPLACE_SHIFT_LEFT - - match("<<=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mGREATER_THAN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = GREATER_THAN - - match('>') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mGREATER_THAN_OR_EQUAL(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = GREATER_THAN_OR_EQUAL - - match(">=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mSHIFT_RIGHT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = SHIFT_RIGHT - - match(">>") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINPLACE_SHIFT_RIGHT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INPLACE_SHIFT_RIGHT - - match(">>=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mAT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = AT - - match('@') - if ((cached_LA1==char('s'))): - match("script") - if 0 == inputState.guessing: - _ttype = SCRIPT_ATTRIBUTE_MARKER; - else: // line 2053 - pass // 947 - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mDIVISION(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = DIVISION - - synPredMatched376 as bool = false - if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m376 as int = mark() - synPredMatched376 = true - ++inputState.guessing - try: - match("/*") - except x as RecognitionException: - synPredMatched376 = false - rewind(_m376) - --inputState.guessing - if synPredMatched376: - mML_COMMENT(false) - if 0 == inputState.guessing: - _ttype = Token.SKIP; - elif ((cached_LA1==char('/')) and (true)): // line 2102 - match('/') - _givenValue = cached_LA1 - if ((_givenValue == char('/'))): // 1831 - match('/') - while true: - if ((tokenSet_1_.member(cast(int, cached_LA1)))): - match(tokenSet_1_) - else: - goto _loop381_breakloop - :_loop381_breakloop - if 0 == inputState.guessing: - _ttype = Token.SKIP; - elif ((_givenValue == char('='))): // 1831 - match('=') - if 0 == inputState.guessing: - _ttype = INPLACE_DIVISION; - else: // line 1969 - pass // 947 - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mML_COMMENT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = ML_COMMENT - - match("/*") - while true: - if (((cached_LA1==char('*')) and (((cached_LA2 >= char('\u0003')) and (cached_LA2 <= char('\ufffe')))) and (((LA(3) >= char('\u0003')) and (LA(3) <= char('\ufffe'))))) and ( LA(2) != char('/') )): - match('*') - elif ((cached_LA1==char('\n') or cached_LA1==char('\r'))): // line 2102 - mNEWLINE(false) - elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 - match(tokenSet_2_) - else: - goto _loop406_breakloop - :_loop406_breakloop - match("*/") - if 0 == inputState.guessing: - _ttype = Token.SKIP; - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mWHITE_SPACE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = WHITE_SPACE - - _cnt385 as int = 0 - while true: - _givenValue = cached_LA1 - if ((_givenValue == char(' '))): // 1831 - match(' ') - elif ((_givenValue == char('\t'))): // 1831 - match('\t') - elif ((_givenValue == char('\u000c'))): // 1831 - match('\f') - elif ((_givenValue == char('\n')) - or (_givenValue ==char('\r')) - ): // 1827 - mNEWLINE(false) - else: // line 1969 - if (_cnt385 >= 1): - goto _loop385_breakloop - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt385 - :_loop385_breakloop - if 0 == inputState.guessing: - _ttype = Token.SKIP; - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mNEWLINE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = NEWLINE - - _givenValue = cached_LA1 - if ((_givenValue == char('\n'))): // 1831 - match('\n') - elif ((_givenValue == char('\r'))): // 1831 - match('\r') - if ((cached_LA1==char('\n')) and (true) and (true)): - match('\n') - else: // line 2053 - pass // 947 - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if 0 == inputState.guessing: - newline(); - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mDOUBLE_QUOTED_STRING(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = DOUBLE_QUOTED_STRING - - _saveIndex = text.Length - match('"') - text.Length = _saveIndex - while true: - if ((cached_LA1==char('\\'))): - mDQS_ESC(false) - elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 - match(tokenSet_3_) - else: - goto _loop389_breakloop - :_loop389_breakloop - _saveIndex = text.Length - match('"') - text.Length = _saveIndex - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mDQS_ESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = DQS_ESC - - _saveIndex = text.Length - match('\\') - text.Length = _saveIndex - _givenValue = cached_LA1 - if ((_givenValue == char('0')) - or (_givenValue ==char('\\')) - or (_givenValue ==char('a')) - or (_givenValue ==char('b')) - or (_givenValue ==char('f')) - or (_givenValue ==char('n')) - or (_givenValue ==char('r')) - or (_givenValue ==char('t')) - ): // 1827 - mSESC(false) - elif ((_givenValue == char('"'))): // 1831 - match('"') - elif ((_givenValue == char('$'))): // 1831 - match('$') - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mSESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = SESC - - _givenValue = cached_LA1 - if ((_givenValue == char('r'))): // 1831 - _saveIndex = text.Length - match('r') - text.Length = _saveIndex - if 0 == inputState.guessing: - text.Length = _begin; text.Append("\r"); - elif ((_givenValue == char('n'))): // 1831 - _saveIndex = text.Length - match('n') - text.Length = _saveIndex - if 0 == inputState.guessing: - text.Length = _begin; text.Append("\n"); - elif ((_givenValue == char('t'))): // 1831 - _saveIndex = text.Length - match('t') - text.Length = _saveIndex - if 0 == inputState.guessing: - text.Length = _begin; text.Append("\t"); - elif ((_givenValue == char('a'))): // 1831 - _saveIndex = text.Length - match('a') - text.Length = _saveIndex - if 0 == inputState.guessing: - text.Length = _begin; text.Append("\a"); - elif ((_givenValue == char('b'))): // 1831 - _saveIndex = text.Length - match('b') - text.Length = _saveIndex - if 0 == inputState.guessing: - text.Length = _begin; text.Append("\b"); - elif ((_givenValue == char('f'))): // 1831 - _saveIndex = text.Length - match('f') - text.Length = _saveIndex - if 0 == inputState.guessing: - text.Length = _begin; text.Append("\f"); - elif ((_givenValue == char('0'))): // 1831 - _saveIndex = text.Length - match('0') - text.Length = _saveIndex - if 0 == inputState.guessing: - text.Length = _begin; text.Append("\0"); - elif ((_givenValue == char('\\'))): // 1831 - _saveIndex = text.Length - match('\\') - text.Length = _saveIndex - if 0 == inputState.guessing: - text.Length = _begin; text.Append("\\"); - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mSQS_ESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = SQS_ESC - - _saveIndex = text.Length - match('\\') - text.Length = _saveIndex - _givenValue = cached_LA1 - if ((_givenValue == char('0')) - or (_givenValue ==char('\\')) - or (_givenValue ==char('a')) - or (_givenValue ==char('b')) - or (_givenValue ==char('f')) - or (_givenValue ==char('n')) - or (_givenValue ==char('r')) - or (_givenValue ==char('t')) - ): // 1827 - mSESC(false) - elif ((_givenValue == char('\''))): // 1831 - match('\'') - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mRE_LITERAL(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = RE_LITERAL - - match('/') - _cnt409 as int = 0 - while true: - if ((tokenSet_4_.member(cast(int, cached_LA1)))): - mRE_CHAR(false) - else: - if (_cnt409 >= 1): - goto _loop409_breakloop - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt409 - :_loop409_breakloop - match('/') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mRE_CHAR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = RE_CHAR - - if ((cached_LA1==char('\\'))): - mRE_ESC(false) - elif ((tokenSet_5_.member(cast(int, cached_LA1)))): // line 2102 - match(tokenSet_5_) - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mRE_ESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = RE_ESC - - match('\\') - _givenValue = cached_LA1 - if ((_givenValue == char('a'))): // 1831 - match('a') - elif ((_givenValue == char('b'))): // 1831 - match('b') - elif ((_givenValue == char('c'))): // 1831 - match('c') - matchRange(char('A'),char('Z')) - elif ((_givenValue == char('t'))): // 1831 - match('t') - elif ((_givenValue == char('r'))): // 1831 - match('r') - elif ((_givenValue == char('v'))): // 1831 - match('v') - elif ((_givenValue == char('f'))): // 1831 - match('f') - elif ((_givenValue == char('n'))): // 1831 - match('n') - elif ((_givenValue == char('e'))): // 1831 - match('e') - elif ((_givenValue == char('0')) - or (_givenValue ==char('1')) - or (_givenValue ==char('2')) - or (_givenValue ==char('3')) - or (_givenValue ==char('4')) - or (_givenValue ==char('5')) - or (_givenValue ==char('6')) - or (_givenValue ==char('7')) - or (_givenValue ==char('8')) - or (_givenValue ==char('9')) - ): // 1827 - _cnt415 as int = 0 - while true: - if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_6_.member(cast(int, cached_LA2))) and (true)): - mDIGIT(false) - else: - if (_cnt415 >= 1): - goto _loop415_breakloop - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt415 - :_loop415_breakloop - elif ((_givenValue == char('x'))): // 1831 - match('x') - mDIGIT(false) - mDIGIT(false) - elif ((_givenValue == char('u'))): // 1831 - match('u') - mDIGIT(false) - mDIGIT(false) - mDIGIT(false) - mDIGIT(false) - elif ((_givenValue == char('\\'))): // 1831 - match('\\') - elif ((_givenValue == char('w'))): // 1831 - match('w') - elif ((_givenValue == char('W'))): // 1831 - match('W') - elif ((_givenValue == char('s'))): // 1831 - match('s') - elif ((_givenValue == char('S'))): // 1831 - match('S') - elif ((_givenValue == char('d'))): // 1831 - match('d') - elif ((_givenValue == char('D'))): // 1831 - match('D') - elif ((_givenValue == char('p'))): // 1831 - match('p') - elif ((_givenValue == char('P'))): // 1831 - match('P') - elif ((_givenValue == char('A'))): // 1831 - match('A') - elif ((_givenValue == char('z'))): // 1831 - match('z') - elif ((_givenValue == char('Z'))): // 1831 - match('Z') - elif ((_givenValue == char('g'))): // 1831 - match('g') - elif ((_givenValue == char('B'))): // 1831 - match('B') - elif ((_givenValue == char('k'))): // 1831 - match('k') - elif ((_givenValue == char('/'))): // 1831 - match('/') - elif ((_givenValue == char('('))): // 1831 - match('(') - elif ((_givenValue == char(')'))): // 1831 - match(')') - elif ((_givenValue == char('|'))): // 1831 - match('|') - elif ((_givenValue == char('.'))): // 1831 - match('.') - elif ((_givenValue == char('*'))): // 1831 - match('*') - elif ((_givenValue == char('?'))): // 1831 - match('?') - elif ((_givenValue == char('$'))): // 1831 - match('$') - elif ((_givenValue == char('^'))): // 1831 - match('^') - elif ((_givenValue == char('['))): // 1831 - match('[') - elif ((_givenValue == char(']'))): // 1831 - match(']') - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - - private static def mk_tokenSet_0_() as (long): - data = array(long, 1025) - data[0]=287948901175001088L - data[1]=541165879422L - i = 2 - while i<=1024: - data[i] = 0L - ++i - return data - public static final tokenSet_0_ = BitSet(mk_tokenSet_0_()) - private static def mk_tokenSet_1_() as (long): - data = array(long, 2048) - data[0]=-9224L - i = 1 - while i<=1022: - data[i] = -1L - ++i - data[1023]=9223372036854775807L - i = 1024 - while i<=2047: - data[i] = 0L - ++i - return data - public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) - private static def mk_tokenSet_2_() as (long): - data = array(long, 2048) - data[0]=-4398046520328L - i = 1 - while i<=1022: - data[i] = -1L - ++i - data[1023]=9223372036854775807L - i = 1024 - while i<=2047: - data[i] = 0L - ++i - return data - public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) - private static def mk_tokenSet_3_() as (long): - data = array(long, 2048) - data[0]=-17179878408L - data[1]=-268435457L - i = 2 - while i<=1022: - data[i] = -1L - ++i - data[1023]=9223372036854775807L - i = 1024 - while i<=2047: - data[i] = 0L - ++i - return data - public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) - private static def mk_tokenSet_4_() as (long): - data = array(long, 2048) - data[0]=-140741783332360L - i = 1 - while i<=1022: - data[i] = -1L - ++i - data[1023]=9223372036854775807L - i = 1024 - while i<=2047: - data[i] = 0L - ++i - return data - public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) - private static def mk_tokenSet_5_() as (long): - data = array(long, 2048) - data[0]=-140741783332360L - data[1]=-268435457L - i = 2 - while i<=1022: - data[i] = -1L - ++i - data[1023]=9223372036854775807L - i = 1024 - while i<=2047: - data[i] = 0L - ++i - return data - public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) - private static def mk_tokenSet_6_() as (long): - data = array(long, 2048) - data[0]=-4294977032L - i = 1 - while i<=1022: - data[i] = -1L - ++i - data[1023]=9223372036854775807L - i = 1024 - while i<=2047: - data[i] = 0L - ++i - return data - public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) - + def constructor(ins as Stream): + self(ByteBuffer(ins)) + + def constructor(r as TextReader): + self(CharBuffer(r)) + + def constructor(ib as InputBuffer): + self(LexerSharedInputState(ib)) + + def constructor(state as LexerSharedInputState): + super(state) + initialize() + + private def initialize(): + caseSensitiveLiterals = true + setCaseSensitive(true) + literals = Hashtable(100, 0.4, null, Comparer.Default) + literals.Add(",", 61) + literals.Add("public", 27) + literals.Add("a string", 54) + literals.Add("an identifier", 53) + literals.Add("]", 63) + literals.Add("case", 47) + literals.Add("break", 5) + literals.Add("while", 44) + literals.Add("new", 24) + literals.Add("||", 69) + literals.Add("+", 75) + literals.Add("instanceof", 23) + literals.Add("implements", 20) + literals.Add("*", 78) + literals.Add("|=", 65) + literals.Add("typeof", 41) + literals.Add("[", 62) + literals.Add(">>=", 92) + literals.Add("return", 26) + literals.Add("throw", 38) + literals.Add("var", 42) + literals.Add(")", 58) + literals.Add("==", 79) + literals.Add("null", 25) + literals.Add("protected", 28) + literals.Add("@script", 94) + literals.Add("class", 7) + literals.Add("(", 57) + literals.Add("~", 82) + literals.Add("function", 16) + literals.Add("/=", 49) + literals.Add("super", 36) + literals.Add("@", 93) + literals.Add("-=", 51) + literals.Add("set", 34) + literals.Add("+=", 50) + literals.Add("!==", 84) + literals.Add("}", 56) + literals.Add("interface", 22) + literals.Add("?", 81) + literals.Add("&", 66) + literals.Add("internal", 29) + literals.Add("final", 13) + literals.Add("yield", 45) + literals.Add("!=", 80) + literals.Add("===", 83) + literals.Add("if", 18) + literals.Add("|", 64) + literals.Add("override", 30) + literals.Add(">", 89) + literals.Add("as", 4) + literals.Add("%", 77) + literals.Add("pragma", 32) + literals.Add("catch", 6) + literals.Add("try", 40) + literals.Add("{", 55) + literals.Add("=", 72) + literals.Add("enum", 10) + literals.Add("for", 15) + literals.Add(">>", 91) + literals.Add("extends", 11) + literals.Add("private", 33) + literals.Add("default", 48) + literals.Add("--", 74) + literals.Add("<", 85) + literals.Add("false", 12) + literals.Add("this", 37) + literals.Add("static", 35) + literals.Add(">=", 90) + literals.Add("<=", 86) + literals.Add("partial", 31) + literals.Add(";", 71) + literals.Add("get", 17) + literals.Add("<<=", 88) + literals.Add("continue", 8) + literals.Add("&&", 70) + literals.Add("<<", 87) + literals.Add(".", 59) + literals.Add("finally", 14) + literals.Add("else", 9) + literals.Add("import", 19) + literals.Add("++", 73) + literals.Add(":", 60) + literals.Add("in", 21) + literals.Add("switch", 46) + literals.Add("true", 39) + literals.Add("-", 76) + literals.Add("*=", 52) + literals.Add("virtual", 43) + literals.Add("^", 67) + literals.Add("&=", 68) + + override def nextToken() as IToken: + theRetToken as IToken + :tryAgain + while true: + _token as IToken = null + _ttype = Token.INVALID_TYPE + resetText() + try: // for char stream error handling + try: // for lexical error handling + _givenValue = cached_LA1 + if ((_givenValue == char('A')) + or (_givenValue ==char('B')) + or (_givenValue ==char('C')) + or (_givenValue ==char('D')) + or (_givenValue ==char('E')) + or (_givenValue ==char('F')) + or (_givenValue ==char('G')) + or (_givenValue ==char('H')) + or (_givenValue ==char('I')) + or (_givenValue ==char('J')) + or (_givenValue ==char('K')) + or (_givenValue ==char('L')) + or (_givenValue ==char('M')) + or (_givenValue ==char('N')) + or (_givenValue ==char('O')) + or (_givenValue ==char('P')) + or (_givenValue ==char('Q')) + or (_givenValue ==char('R')) + or (_givenValue ==char('S')) + or (_givenValue ==char('T')) + or (_givenValue ==char('U')) + or (_givenValue ==char('V')) + or (_givenValue ==char('W')) + or (_givenValue ==char('X')) + or (_givenValue ==char('Y')) + or (_givenValue ==char('Z')) + or (_givenValue ==char('_')) + or (_givenValue ==char('a')) + or (_givenValue ==char('b')) + or (_givenValue ==char('c')) + or (_givenValue ==char('d')) + or (_givenValue ==char('e')) + or (_givenValue ==char('f')) + or (_givenValue ==char('g')) + or (_givenValue ==char('h')) + or (_givenValue ==char('i')) + or (_givenValue ==char('j')) + or (_givenValue ==char('k')) + or (_givenValue ==char('l')) + or (_givenValue ==char('m')) + or (_givenValue ==char('n')) + or (_givenValue ==char('o')) + or (_givenValue ==char('p')) + or (_givenValue ==char('q')) + or (_givenValue ==char('r')) + or (_givenValue ==char('s')) + or (_givenValue ==char('t')) + or (_givenValue ==char('u')) + or (_givenValue ==char('v')) + or (_givenValue ==char('w')) + or (_givenValue ==char('x')) + or (_givenValue ==char('y')) + or (_givenValue ==char('z')) + ): // 1827 + mID(true) + theRetToken = returnToken_ + elif ((_givenValue == char('0')) + or (_givenValue ==char('1')) + or (_givenValue ==char('2')) + or (_givenValue ==char('3')) + or (_givenValue ==char('4')) + or (_givenValue ==char('5')) + or (_givenValue ==char('6')) + or (_givenValue ==char('7')) + or (_givenValue ==char('8')) + or (_givenValue ==char('9')) + ): // 1827 + mINT(true) + theRetToken = returnToken_ + elif ((_givenValue == char('.'))): // 1831 + mDOT(true) + theRetToken = returnToken_ + elif ((_givenValue == char(':'))): // 1831 + mCOLON(true) + theRetToken = returnToken_ + elif ((_givenValue == char(','))): // 1831 + mCOMMA(true) + theRetToken = returnToken_ + elif ((_givenValue == char('('))): // 1831 + mLPAREN(true) + theRetToken = returnToken_ + elif ((_givenValue == char(')'))): // 1831 + mRPAREN(true) + theRetToken = returnToken_ + elif ((_givenValue == char('['))): // 1831 + mLBRACK(true) + theRetToken = returnToken_ + elif ((_givenValue == char(']'))): // 1831 + mRBRACK(true) + theRetToken = returnToken_ + elif ((_givenValue == char('{'))): // 1831 + mLBRACE(true) + theRetToken = returnToken_ + elif ((_givenValue == char('}'))): // 1831 + mRBRACE(true) + theRetToken = returnToken_ + elif ((_givenValue == char(';'))): // 1831 + mEOS(true) + theRetToken = returnToken_ + elif ((_givenValue == char('#'))): // 1831 + mHASH(true) + theRetToken = returnToken_ + elif ((_givenValue == char('%'))): // 1831 + mMODULUS(true) + theRetToken = returnToken_ + elif ((_givenValue == char('?'))): // 1831 + mQUESTION_MARK(true) + theRetToken = returnToken_ + elif ((_givenValue == char('~'))): // 1831 + mBITWISE_NOT(true) + theRetToken = returnToken_ + elif ((_givenValue == char('@'))): // 1831 + mAT(true) + theRetToken = returnToken_ + elif ((_givenValue == char('/'))): // 1831 + mDIVISION(true) + theRetToken = returnToken_ + elif ((_givenValue == char('\t')) + or (_givenValue ==char('\n')) + or (_givenValue ==char('\u000c')) + or (_givenValue ==char('\r')) + or (_givenValue ==char(' ')) + ): // 1827 + mWHITE_SPACE(true) + theRetToken = returnToken_ + elif ((_givenValue == char('"'))): // 1831 + mDOUBLE_QUOTED_STRING(true) + theRetToken = returnToken_ + else: // line 1969 + if ((cached_LA1==char('=')) and (cached_LA2==char('=')) and (LA(3)==char('='))): + mREFERENCE_EQUALITY(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('!')) and (cached_LA2==char('=')) and (LA(3)==char('='))): // line 2102 + mREFERENCE_INEQUALITY(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('<')) and (cached_LA2==char('<')) and (LA(3)==char('='))): // line 2102 + mINPLACE_SHIFT_LEFT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('>')) and (cached_LA2==char('>')) and (LA(3)==char('='))): // line 2102 + mINPLACE_SHIFT_RIGHT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('|')) and (cached_LA2==char('='))): // line 2102 + mINPLACE_BITWISE_OR(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('&')) and (cached_LA2==char('='))): // line 2102 + mINPLACE_BITWISE_AND(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('^')) and (cached_LA2==char('='))): // line 2102 + mINPLACE_BITWISE_XOR(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('|')) and (cached_LA2==char('|'))): // line 2102 + mLOGICAL_OR(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('&')) and (cached_LA2==char('&'))): // line 2102 + mLOGICAL_AND(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('+')) and (cached_LA2==char('+'))): // line 2102 + mINCREMENT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('-')) and (cached_LA2==char('-'))): // line 2102 + mDECREMENT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('+')) and (cached_LA2==char('='))): // line 2102 + mINPLACE_ADD(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('-')) and (cached_LA2==char('='))): // line 2102 + mINPLACE_SUBTRACT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('*')) and (cached_LA2==char('='))): // line 2102 + mINPLACE_MULTIPLY(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('=')) and (cached_LA2==char('=')) and (true)): // line 2102 + mEQUALITY(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('!')) and (cached_LA2==char('=')) and (true)): // line 2102 + mINEQUALITY(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('<')) and (cached_LA2==char('='))): // line 2102 + mLESS_THAN_OR_EQUAL(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('<')) and (cached_LA2==char('<')) and (true)): // line 2102 + mSHIFT_LEFT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('>')) and (cached_LA2==char('='))): // line 2102 + mGREATER_THAN_OR_EQUAL(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('>')) and (cached_LA2==char('>')) and (true)): // line 2102 + mSHIFT_RIGHT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('|')) and (true)): // line 2102 + mBITWISE_OR(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('&')) and (true)): // line 2102 + mBITWISE_AND(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('^')) and (true)): // line 2102 + mBITWISE_XOR(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('=')) and (true)): // line 2102 + mASSIGN(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('+')) and (true)): // line 2102 + mADD(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('-')) and (true)): // line 2102 + mSUBTRACT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('*')) and (true)): // line 2102 + mMULTIPLY(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('!')) and (true)): // line 2102 + mNOT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('<')) and (true)): // line 2102 + mLESS_THAN(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('>')) and (true)): // line 2102 + mGREATER_THAN(true) + theRetToken = returnToken_ + else: + if cached_LA1 == EOF_CHAR: + uponEOF(); returnToken_ = makeToken(Token.EOF_TYPE) + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + goto tryAgain if returnToken_ is null // found SKIP token + _ttype = returnToken_.Type + returnToken_.Type = _ttype + return returnToken_ + except e as RecognitionException: + raise TokenStreamRecognitionException(e) + except cse as CharStreamException: + if cse isa CharStreamIOException: + raise TokenStreamIOException(cast(CharStreamIOException, cse).io) + else: + raise TokenStreamException(cse.Message) + + public def mID(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = ID + + mID_LETTER(false) + while true: + _givenValue = cached_LA1 + if ((_givenValue == char('A')) + or (_givenValue ==char('B')) + or (_givenValue ==char('C')) + or (_givenValue ==char('D')) + or (_givenValue ==char('E')) + or (_givenValue ==char('F')) + or (_givenValue ==char('G')) + or (_givenValue ==char('H')) + or (_givenValue ==char('I')) + or (_givenValue ==char('J')) + or (_givenValue ==char('K')) + or (_givenValue ==char('L')) + or (_givenValue ==char('M')) + or (_givenValue ==char('N')) + or (_givenValue ==char('O')) + or (_givenValue ==char('P')) + or (_givenValue ==char('Q')) + or (_givenValue ==char('R')) + or (_givenValue ==char('S')) + or (_givenValue ==char('T')) + or (_givenValue ==char('U')) + or (_givenValue ==char('V')) + or (_givenValue ==char('W')) + or (_givenValue ==char('X')) + or (_givenValue ==char('Y')) + or (_givenValue ==char('Z')) + or (_givenValue ==char('_')) + or (_givenValue ==char('a')) + or (_givenValue ==char('b')) + or (_givenValue ==char('c')) + or (_givenValue ==char('d')) + or (_givenValue ==char('e')) + or (_givenValue ==char('f')) + or (_givenValue ==char('g')) + or (_givenValue ==char('h')) + or (_givenValue ==char('i')) + or (_givenValue ==char('j')) + or (_givenValue ==char('k')) + or (_givenValue ==char('l')) + or (_givenValue ==char('m')) + or (_givenValue ==char('n')) + or (_givenValue ==char('o')) + or (_givenValue ==char('p')) + or (_givenValue ==char('q')) + or (_givenValue ==char('r')) + or (_givenValue ==char('s')) + or (_givenValue ==char('t')) + or (_givenValue ==char('u')) + or (_givenValue ==char('v')) + or (_givenValue ==char('w')) + or (_givenValue ==char('x')) + or (_givenValue ==char('y')) + or (_givenValue ==char('z')) + ): // 1827 + mID_LETTER(false) + elif ((_givenValue == char('0')) + or (_givenValue ==char('1')) + or (_givenValue ==char('2')) + or (_givenValue ==char('3')) + or (_givenValue ==char('4')) + or (_givenValue ==char('5')) + or (_givenValue ==char('6')) + or (_givenValue ==char('7')) + or (_givenValue ==char('8')) + or (_givenValue ==char('9')) + ): // 1827 + mDIGIT(false) + else: // line 1969 + goto _loop305_breakloop + :_loop305_breakloop + _ttype = testLiteralsTable(_ttype) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mID_LETTER(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = ID_LETTER + + _givenValue = cached_LA1 + if ((_givenValue == char('_'))): // 1831 + match('_') + elif ((_givenValue == char('a')) + or (_givenValue ==char('b')) + or (_givenValue ==char('c')) + or (_givenValue ==char('d')) + or (_givenValue ==char('e')) + or (_givenValue ==char('f')) + or (_givenValue ==char('g')) + or (_givenValue ==char('h')) + or (_givenValue ==char('i')) + or (_givenValue ==char('j')) + or (_givenValue ==char('k')) + or (_givenValue ==char('l')) + or (_givenValue ==char('m')) + or (_givenValue ==char('n')) + or (_givenValue ==char('o')) + or (_givenValue ==char('p')) + or (_givenValue ==char('q')) + or (_givenValue ==char('r')) + or (_givenValue ==char('s')) + or (_givenValue ==char('t')) + or (_givenValue ==char('u')) + or (_givenValue ==char('v')) + or (_givenValue ==char('w')) + or (_givenValue ==char('x')) + or (_givenValue ==char('y')) + or (_givenValue ==char('z')) + ): // 1827 + matchRange(char('a'),char('z')) + elif ((_givenValue == char('A')) + or (_givenValue ==char('B')) + or (_givenValue ==char('C')) + or (_givenValue ==char('D')) + or (_givenValue ==char('E')) + or (_givenValue ==char('F')) + or (_givenValue ==char('G')) + or (_givenValue ==char('H')) + or (_givenValue ==char('I')) + or (_givenValue ==char('J')) + or (_givenValue ==char('K')) + or (_givenValue ==char('L')) + or (_givenValue ==char('M')) + or (_givenValue ==char('N')) + or (_givenValue ==char('O')) + or (_givenValue ==char('P')) + or (_givenValue ==char('Q')) + or (_givenValue ==char('R')) + or (_givenValue ==char('S')) + or (_givenValue ==char('T')) + or (_givenValue ==char('U')) + or (_givenValue ==char('V')) + or (_givenValue ==char('W')) + or (_givenValue ==char('X')) + or (_givenValue ==char('Y')) + or (_givenValue ==char('Z')) + ): // 1827 + matchRange(char('A'),char('Z')) + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mDIGIT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = DIGIT + + matchRange(char('0'),char('9')) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INT + + if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): + match("0x") + _cnt309 as int = 0 + while true: + if ((tokenSet_0_.member(cast(int, cached_LA1)))): + mHEXDIGIT(false) + else: + if (_cnt309 >= 1): + goto _loop309_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt309 + :_loop309_breakloop + if ((cached_LA1==char('L') or cached_LA1==char('l'))): + _givenValue = cached_LA1 + if ((_givenValue == char('l'))): // 1831 + match('l') + elif ((_givenValue == char('L'))): // 1831 + match('L') + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if 0 == inputState.guessing: + _ttype = LONG; + else: // line 2053 + pass // 947 + elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 + _cnt313 as int = 0 + while true: + if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): + mDIGIT(false) + else: + if (_cnt313 >= 1): + goto _loop313_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt313 + :_loop313_breakloop + _givenValue = cached_LA1 + if ((_givenValue == char('L')) + or (_givenValue ==char('l')) + ): // 1827 + _givenValue = cached_LA1 + if ((_givenValue == char('l'))): // 1831 + match('l') + elif ((_givenValue == char('L'))): // 1831 + match('L') + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if 0 == inputState.guessing: + _ttype = LONG; + elif ((_givenValue == char('F')) + or (_givenValue ==char('f')) + ): // 1827 + _givenValue = cached_LA1 + if ((_givenValue == char('f'))): // 1831 + _saveIndex = text.Length + match('f') + text.Length = _saveIndex + elif ((_givenValue == char('F'))): // 1831 + _saveIndex = text.Length + match('F') + text.Length = _saveIndex + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if 0 == inputState.guessing: + _ttype = DOUBLE; + elif ((_givenValue == char('.'))): // 1831 + match('.') + mDOUBLE_SUFFIX(false) + if 0 == inputState.guessing: + _ttype = DOUBLE; + elif ((_givenValue == char('E')) + or (_givenValue ==char('e')) + ): // 1827 + mEXPONENT(false) + if 0 == inputState.guessing: + _ttype = DOUBLE; + else: // line 1969 + pass // 947 + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mHEXDIGIT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = HEXDIGIT + + _givenValue = cached_LA1 + if ((_givenValue == char('a')) + or (_givenValue ==char('b')) + or (_givenValue ==char('c')) + or (_givenValue ==char('d')) + or (_givenValue ==char('e')) + or (_givenValue ==char('f')) + ): // 1827 + matchRange(char('a'),char('f')) + elif ((_givenValue == char('A')) + or (_givenValue ==char('B')) + or (_givenValue ==char('C')) + or (_givenValue ==char('D')) + or (_givenValue ==char('E')) + or (_givenValue ==char('F')) + ): // 1827 + matchRange(char('A'),char('F')) + elif ((_givenValue == char('0')) + or (_givenValue ==char('1')) + or (_givenValue ==char('2')) + or (_givenValue ==char('3')) + or (_givenValue ==char('4')) + or (_givenValue ==char('5')) + or (_givenValue ==char('6')) + or (_givenValue ==char('7')) + or (_givenValue ==char('8')) + or (_givenValue ==char('9')) + ): // 1827 + matchRange(char('0'),char('9')) + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mDOUBLE_SUFFIX(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = DOUBLE_SUFFIX + + _cnt322 as int = 0 + while true: + if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): + mDIGIT(false) + else: + if (_cnt322 >= 1): + goto _loop322_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt322 + :_loop322_breakloop + if ((cached_LA1==char('E') or cached_LA1==char('e'))): + mEXPONENT(false) + else: // line 2053 + pass // 947 + _givenValue = cached_LA1 + if ((_givenValue == char('f'))): // 1831 + _saveIndex = text.Length + match('f') + text.Length = _saveIndex + elif ((_givenValue == char('F'))): // 1831 + _saveIndex = text.Length + match('F') + text.Length = _saveIndex + else: // line 1969 + pass // 947 + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mEXPONENT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = EXPONENT + + _givenValue = cached_LA1 + if ((_givenValue == char('e'))): // 1831 + match('e') + elif ((_givenValue == char('E'))): // 1831 + match('E') + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + _givenValue = cached_LA1 + if ((_givenValue == char('+'))): // 1831 + match('+') + elif ((_givenValue == char('-'))): // 1831 + match('-') + elif ((_givenValue == char('0')) + or (_givenValue ==char('1')) + or (_givenValue ==char('2')) + or (_givenValue ==char('3')) + or (_givenValue ==char('4')) + or (_givenValue ==char('5')) + or (_givenValue ==char('6')) + or (_givenValue ==char('7')) + or (_givenValue ==char('8')) + or (_givenValue ==char('9')) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + _cnt329 as int = 0 + while true: + if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): + mDIGIT(false) + else: + if (_cnt329 >= 1): + goto _loop329_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt329 + :_loop329_breakloop + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mDOT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = DOT + + match('.') + if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): + mDOUBLE_SUFFIX(false) + if 0 == inputState.guessing: + _ttype = DOUBLE; + else: // line 2053 + pass // 947 + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mCOLON(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = COLON + + match(':') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mCOMMA(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = COMMA + + match(',') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mLPAREN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = LPAREN + + match('(') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mRPAREN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = RPAREN + + match(')') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mLBRACK(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = LBRACK + + match('[') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mRBRACK(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = RBRACK + + match(']') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mLBRACE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = LBRACE + + match('{') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mRBRACE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = RBRACE + + match('}') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mBITWISE_OR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = BITWISE_OR + + match('|') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINPLACE_BITWISE_OR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INPLACE_BITWISE_OR + + match("|=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mBITWISE_AND(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = BITWISE_AND + + match('&') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINPLACE_BITWISE_AND(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INPLACE_BITWISE_AND + + match("&=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mBITWISE_XOR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = BITWISE_XOR + + match('^') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINPLACE_BITWISE_XOR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INPLACE_BITWISE_XOR + + match("^=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mLOGICAL_OR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = LOGICAL_OR + + match("||") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mLOGICAL_AND(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = LOGICAL_AND + + match("&&") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mEOS(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = EOS + + match(';') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mASSIGN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = ASSIGN + + match('=') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINCREMENT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INCREMENT + + match("++") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mDECREMENT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = DECREMENT + + match("--") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mADD(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = ADD + + match('+') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mHASH(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = HASH + + match('#') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINPLACE_ADD(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INPLACE_ADD + + match("+=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mSUBTRACT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = SUBTRACT + + match('-') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINPLACE_SUBTRACT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INPLACE_SUBTRACT + + match("-=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mMODULUS(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = MODULUS + + match('%') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mMULTIPLY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = MULTIPLY + + match('*') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINPLACE_MULTIPLY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INPLACE_MULTIPLY + + match("*=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mEQUALITY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = EQUALITY + + match("==") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINEQUALITY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INEQUALITY + + match("!=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mNOT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = NOT + + match('!') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mQUESTION_MARK(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = QUESTION_MARK + + match('?') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mBITWISE_NOT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = BITWISE_NOT + + match('~') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mREFERENCE_EQUALITY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = REFERENCE_EQUALITY + + match("===") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mREFERENCE_INEQUALITY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = REFERENCE_INEQUALITY + + match("!==") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mLESS_THAN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = LESS_THAN + + match('<') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mLESS_THAN_OR_EQUAL(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = LESS_THAN_OR_EQUAL + + match("<=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mSHIFT_LEFT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = SHIFT_LEFT + + match("<<") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINPLACE_SHIFT_LEFT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INPLACE_SHIFT_LEFT + + match("<<=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mGREATER_THAN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = GREATER_THAN + + match('>') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mGREATER_THAN_OR_EQUAL(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = GREATER_THAN_OR_EQUAL + + match(">=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mSHIFT_RIGHT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = SHIFT_RIGHT + + match(">>") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINPLACE_SHIFT_RIGHT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INPLACE_SHIFT_RIGHT + + match(">>=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mAT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = AT + + match('@') + if ((cached_LA1==char('s'))): + match("script") + if 0 == inputState.guessing: + _ttype = SCRIPT_ATTRIBUTE_MARKER; + else: // line 2053 + pass // 947 + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mDIVISION(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = DIVISION + + synPredMatched377 as bool = false + if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): + _m377 as int = mark() + synPredMatched377 = true + ++inputState.guessing + try: + match("/*") + except x as RecognitionException: + synPredMatched377 = false + rewind(_m377) + --inputState.guessing + if synPredMatched377: + mML_COMMENT(false) + if 0 == inputState.guessing: + _ttype = Token.SKIP; + elif ((cached_LA1==char('/')) and (true)): // line 2102 + match('/') + _givenValue = cached_LA1 + if ((_givenValue == char('/'))): // 1831 + match('/') + while true: + if ((tokenSet_1_.member(cast(int, cached_LA1)))): + match(tokenSet_1_) + else: + goto _loop382_breakloop + :_loop382_breakloop + if 0 == inputState.guessing: + _ttype = Token.SKIP; + elif ((_givenValue == char('='))): // 1831 + match('=') + if 0 == inputState.guessing: + _ttype = INPLACE_DIVISION; + else: // line 1969 + pass // 947 + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mML_COMMENT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = ML_COMMENT + + match("/*") + while true: + if (((cached_LA1==char('*')) and (((cached_LA2 >= char('\u0003')) and (cached_LA2 <= char('\ufffe')))) and (((LA(3) >= char('\u0003')) and (LA(3) <= char('\ufffe'))))) and ( LA(2) != char('/') )): + match('*') + elif ((cached_LA1==char('\n') or cached_LA1==char('\r'))): // line 2102 + mNEWLINE(false) + elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 + match(tokenSet_2_) + else: + goto _loop407_breakloop + :_loop407_breakloop + match("*/") + if 0 == inputState.guessing: + _ttype = Token.SKIP; + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mWHITE_SPACE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = WHITE_SPACE + + _cnt386 as int = 0 + while true: + _givenValue = cached_LA1 + if ((_givenValue == char(' '))): // 1831 + match(' ') + elif ((_givenValue == char('\t'))): // 1831 + match('\t') + elif ((_givenValue == char('\u000c'))): // 1831 + match('\f') + elif ((_givenValue == char('\n')) + or (_givenValue ==char('\r')) + ): // 1827 + mNEWLINE(false) + else: // line 1969 + if (_cnt386 >= 1): + goto _loop386_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt386 + :_loop386_breakloop + if 0 == inputState.guessing: + _ttype = Token.SKIP; + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mNEWLINE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = NEWLINE + + _givenValue = cached_LA1 + if ((_givenValue == char('\n'))): // 1831 + match('\n') + elif ((_givenValue == char('\r'))): // 1831 + match('\r') + if ((cached_LA1==char('\n')) and (true) and (true)): + match('\n') + else: // line 2053 + pass // 947 + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if 0 == inputState.guessing: + newline(); + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mDOUBLE_QUOTED_STRING(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = DOUBLE_QUOTED_STRING + + _saveIndex = text.Length + match('"') + text.Length = _saveIndex + while true: + if ((cached_LA1==char('\\'))): + mDQS_ESC(false) + elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 + match(tokenSet_3_) + else: + goto _loop390_breakloop + :_loop390_breakloop + _saveIndex = text.Length + match('"') + text.Length = _saveIndex + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mDQS_ESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = DQS_ESC + + _saveIndex = text.Length + match('\\') + text.Length = _saveIndex + _givenValue = cached_LA1 + if ((_givenValue == char('0')) + or (_givenValue ==char('\\')) + or (_givenValue ==char('a')) + or (_givenValue ==char('b')) + or (_givenValue ==char('f')) + or (_givenValue ==char('n')) + or (_givenValue ==char('r')) + or (_givenValue ==char('t')) + ): // 1827 + mSESC(false) + elif ((_givenValue == char('"'))): // 1831 + match('"') + elif ((_givenValue == char('$'))): // 1831 + match('$') + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mSESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = SESC + + _givenValue = cached_LA1 + if ((_givenValue == char('r'))): // 1831 + _saveIndex = text.Length + match('r') + text.Length = _saveIndex + if 0 == inputState.guessing: + text.Length = _begin; text.Append("\r"); + elif ((_givenValue == char('n'))): // 1831 + _saveIndex = text.Length + match('n') + text.Length = _saveIndex + if 0 == inputState.guessing: + text.Length = _begin; text.Append("\n"); + elif ((_givenValue == char('t'))): // 1831 + _saveIndex = text.Length + match('t') + text.Length = _saveIndex + if 0 == inputState.guessing: + text.Length = _begin; text.Append("\t"); + elif ((_givenValue == char('a'))): // 1831 + _saveIndex = text.Length + match('a') + text.Length = _saveIndex + if 0 == inputState.guessing: + text.Length = _begin; text.Append("\a"); + elif ((_givenValue == char('b'))): // 1831 + _saveIndex = text.Length + match('b') + text.Length = _saveIndex + if 0 == inputState.guessing: + text.Length = _begin; text.Append("\b"); + elif ((_givenValue == char('f'))): // 1831 + _saveIndex = text.Length + match('f') + text.Length = _saveIndex + if 0 == inputState.guessing: + text.Length = _begin; text.Append("\f"); + elif ((_givenValue == char('0'))): // 1831 + _saveIndex = text.Length + match('0') + text.Length = _saveIndex + if 0 == inputState.guessing: + text.Length = _begin; text.Append("\0"); + elif ((_givenValue == char('\\'))): // 1831 + _saveIndex = text.Length + match('\\') + text.Length = _saveIndex + if 0 == inputState.guessing: + text.Length = _begin; text.Append("\\"); + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mSQS_ESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = SQS_ESC + + _saveIndex = text.Length + match('\\') + text.Length = _saveIndex + _givenValue = cached_LA1 + if ((_givenValue == char('0')) + or (_givenValue ==char('\\')) + or (_givenValue ==char('a')) + or (_givenValue ==char('b')) + or (_givenValue ==char('f')) + or (_givenValue ==char('n')) + or (_givenValue ==char('r')) + or (_givenValue ==char('t')) + ): // 1827 + mSESC(false) + elif ((_givenValue == char('\''))): // 1831 + match('\'') + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mRE_LITERAL(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = RE_LITERAL + + match('/') + _cnt410 as int = 0 + while true: + if ((tokenSet_4_.member(cast(int, cached_LA1)))): + mRE_CHAR(false) + else: + if (_cnt410 >= 1): + goto _loop410_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt410 + :_loop410_breakloop + match('/') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mRE_CHAR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = RE_CHAR + + if ((cached_LA1==char('\\'))): + mRE_ESC(false) + elif ((tokenSet_5_.member(cast(int, cached_LA1)))): // line 2102 + match(tokenSet_5_) + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mRE_ESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = RE_ESC + + match('\\') + _givenValue = cached_LA1 + if ((_givenValue == char('a'))): // 1831 + match('a') + elif ((_givenValue == char('b'))): // 1831 + match('b') + elif ((_givenValue == char('c'))): // 1831 + match('c') + matchRange(char('A'),char('Z')) + elif ((_givenValue == char('t'))): // 1831 + match('t') + elif ((_givenValue == char('r'))): // 1831 + match('r') + elif ((_givenValue == char('v'))): // 1831 + match('v') + elif ((_givenValue == char('f'))): // 1831 + match('f') + elif ((_givenValue == char('n'))): // 1831 + match('n') + elif ((_givenValue == char('e'))): // 1831 + match('e') + elif ((_givenValue == char('0')) + or (_givenValue ==char('1')) + or (_givenValue ==char('2')) + or (_givenValue ==char('3')) + or (_givenValue ==char('4')) + or (_givenValue ==char('5')) + or (_givenValue ==char('6')) + or (_givenValue ==char('7')) + or (_givenValue ==char('8')) + or (_givenValue ==char('9')) + ): // 1827 + _cnt416 as int = 0 + while true: + if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_6_.member(cast(int, cached_LA2))) and (true)): + mDIGIT(false) + else: + if (_cnt416 >= 1): + goto _loop416_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt416 + :_loop416_breakloop + elif ((_givenValue == char('x'))): // 1831 + match('x') + mDIGIT(false) + mDIGIT(false) + elif ((_givenValue == char('u'))): // 1831 + match('u') + mDIGIT(false) + mDIGIT(false) + mDIGIT(false) + mDIGIT(false) + elif ((_givenValue == char('\\'))): // 1831 + match('\\') + elif ((_givenValue == char('w'))): // 1831 + match('w') + elif ((_givenValue == char('W'))): // 1831 + match('W') + elif ((_givenValue == char('s'))): // 1831 + match('s') + elif ((_givenValue == char('S'))): // 1831 + match('S') + elif ((_givenValue == char('d'))): // 1831 + match('d') + elif ((_givenValue == char('D'))): // 1831 + match('D') + elif ((_givenValue == char('p'))): // 1831 + match('p') + elif ((_givenValue == char('P'))): // 1831 + match('P') + elif ((_givenValue == char('A'))): // 1831 + match('A') + elif ((_givenValue == char('z'))): // 1831 + match('z') + elif ((_givenValue == char('Z'))): // 1831 + match('Z') + elif ((_givenValue == char('g'))): // 1831 + match('g') + elif ((_givenValue == char('B'))): // 1831 + match('B') + elif ((_givenValue == char('k'))): // 1831 + match('k') + elif ((_givenValue == char('/'))): // 1831 + match('/') + elif ((_givenValue == char('('))): // 1831 + match('(') + elif ((_givenValue == char(')'))): // 1831 + match(')') + elif ((_givenValue == char('|'))): // 1831 + match('|') + elif ((_givenValue == char('.'))): // 1831 + match('.') + elif ((_givenValue == char('*'))): // 1831 + match('*') + elif ((_givenValue == char('?'))): // 1831 + match('?') + elif ((_givenValue == char('$'))): // 1831 + match('$') + elif ((_givenValue == char('^'))): // 1831 + match('^') + elif ((_givenValue == char('['))): // 1831 + match('[') + elif ((_givenValue == char(']'))): // 1831 + match(']') + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + + private static def mk_tokenSet_0_() as (long): + data = array(long, 1025) + data[0]=287948901175001088L + data[1]=541165879422L + i = 2 + while i<=1024: + data[i] = 0L + ++i + return data + public static final tokenSet_0_ = BitSet(mk_tokenSet_0_()) + private static def mk_tokenSet_1_() as (long): + data = array(long, 2048) + data[0]=-9224L + i = 1 + while i<=1022: + data[i] = -1L + ++i + data[1023]=9223372036854775807L + i = 1024 + while i<=2047: + data[i] = 0L + ++i + return data + public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) + private static def mk_tokenSet_2_() as (long): + data = array(long, 2048) + data[0]=-4398046520328L + i = 1 + while i<=1022: + data[i] = -1L + ++i + data[1023]=9223372036854775807L + i = 1024 + while i<=2047: + data[i] = 0L + ++i + return data + public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) + private static def mk_tokenSet_3_() as (long): + data = array(long, 2048) + data[0]=-17179878408L + data[1]=-268435457L + i = 2 + while i<=1022: + data[i] = -1L + ++i + data[1023]=9223372036854775807L + i = 1024 + while i<=2047: + data[i] = 0L + ++i + return data + public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) + private static def mk_tokenSet_4_() as (long): + data = array(long, 2048) + data[0]=-140741783332360L + i = 1 + while i<=1022: + data[i] = -1L + ++i + data[1023]=9223372036854775807L + i = 1024 + while i<=2047: + data[i] = 0L + ++i + return data + public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) + private static def mk_tokenSet_5_() as (long): + data = array(long, 2048) + data[0]=-140741783332360L + data[1]=-268435457L + i = 2 + while i<=1022: + data[i] = -1L + ++i + data[1023]=9223372036854775807L + i = 1024 + while i<=2047: + data[i] = 0L + ++i + return data + public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) + private static def mk_tokenSet_6_() as (long): + data = array(long, 2048) + data[0]=-4294977032L + i = 1 + while i<=1022: + data[i] = -1L + ++i + data[1023]=9223372036854775807L + i = 1024 + while i<=2047: + data[i] = 0L + ++i + return data + public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) + diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index b88bf69..810a5fe 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -1,23 +1,23 @@ -// $ANTLR 2.7.5 (20050517): "src/UnityScript/UnityScript.g" -> "UnityScriptParser.boo"$ - -namespace UnityScript.Parser -// Generate the header common to all output files. -import System - -import antlr.TokenBuffer as TokenBuffer -import antlr.TokenStreamException as TokenStreamException -import antlr.TokenStreamIOException as TokenStreamIOException -import antlr.ANTLRException as ANTLRException -import antlr.LLkParser as LLkParser -import antlr.Token as Token -import antlr.IToken as IToken -import antlr.TokenStream as TokenStream -import antlr.RecognitionException as RecognitionException -import antlr.NoViableAltException as NoViableAltException -import antlr.MismatchedTokenException as MismatchedTokenException -import antlr.SemanticException as SemanticException -import antlr.ParserSharedInputState as ParserSharedInputState -import antlr.collections.impl.BitSet as BitSet +// $ANTLR 2.7.5 (20050517): "UnityScript.g" -> "UnityScriptParser.boo"$ + +namespace UnityScript.Parser +// Generate the header common to all output files. +import System + +import antlr.TokenBuffer as TokenBuffer +import antlr.TokenStreamException as TokenStreamException +import antlr.TokenStreamIOException as TokenStreamIOException +import antlr.ANTLRException as ANTLRException +import antlr.LLkParser as LLkParser +import antlr.Token as Token +import antlr.IToken as IToken +import antlr.TokenStream as TokenStream +import antlr.RecognitionException as RecognitionException +import antlr.NoViableAltException as NoViableAltException +import antlr.MismatchedTokenException as MismatchedTokenException +import antlr.SemanticException as SemanticException +import antlr.ParserSharedInputState as ParserSharedInputState +import antlr.collections.impl.BitSet as BitSet import System.Text import Boo.Lang.Compiler @@ -26,124 +26,123 @@ import System.Globalization import UnityScript import UnityScript.Core - -class UnityScriptParser(antlr.LLkParser): - public static final EOF = 1 - public static final NULL_TREE_LOOKAHEAD = 3 - public static final AS = 4 - public static final BREAK = 5 - public static final CATCH = 6 - public static final CLASS = 7 - public static final CONTINUE = 8 - public static final ELSE = 9 - public static final ENUM = 10 - public static final EXTENDS = 11 - public static final FALSE = 12 - public static final FINAL = 13 - public static final FINALLY = 14 - public static final FOR = 15 - public static final FUNCTION = 16 - public static final GET = 17 - public static final IF = 18 - public static final IMPORT = 19 - public static final IMPLEMENTS = 20 - public static final IN = 21 - public static final INTERFACE = 22 - public static final INSTANCEOF = 23 - public static final NEW = 24 - public static final NOT = 25 - public static final NULL = 26 - public static final RETURN = 27 - public static final PUBLIC = 28 - public static final PROTECTED = 29 - public static final INTERNAL = 30 - public static final OVERRIDE = 31 - public static final PARTIAL = 32 - public static final PRAGMA = 33 - public static final PRIVATE = 34 - public static final SET = 35 - public static final STATIC = 36 - public static final SUPER = 37 - public static final THIS = 38 - public static final THROW = 39 - public static final TRUE = 40 - public static final TRY = 41 - public static final TYPEOF = 42 - public static final VAR = 43 - public static final VIRTUAL = 44 - public static final WHILE = 45 - public static final YIELD = 46 - public static final SWITCH = 47 - public static final CASE = 48 - public static final DEFAULT = 49 - public static final INPLACE_DIVISION = 50 - public static final INPLACE_ADD = 51 - public static final INPLACE_SUBTRACT = 52 - public static final INPLACE_MULTIPLY = 53 - public static final ID = 54 - public static final DOUBLE_QUOTED_STRING = 55 - public static final LBRACE = 56 - public static final RBRACE = 57 - public static final LPAREN = 58 - public static final RPAREN = 59 - public static final DOT = 60 - public static final COLON = 61 - public static final COMMA = 62 - public static final LBRACK = 63 - public static final RBRACK = 64 - public static final BITWISE_OR = 65 - public static final INPLACE_BITWISE_OR = 66 - public static final BITWISE_AND = 67 - public static final BITWISE_XOR = 68 - public static final INPLACE_BITWISE_AND = 69 - public static final LOGICAL_OR = 70 - public static final LOGICAL_AND = 71 - public static final EOS = 72 - public static final ASSIGN = 73 - public static final INCREMENT = 74 - public static final DECREMENT = 75 - public static final ADD = 76 - public static final SUBTRACT = 77 - public static final MODULUS = 78 - public static final MULTIPLY = 79 - public static final EQUALITY = 80 - public static final INEQUALITY = 81 - public static final QUESTION_MARK = 82 - public static final ONES_COMPLEMENT = 83 - public static final REFERENCE_EQUALITY = 84 - public static final REFERENCE_INEQUALITY = 85 - public static final LESS_THAN = 86 - public static final LESS_THAN_OR_EQUAL = 87 - public static final SHIFT_LEFT = 88 - public static final INPLACE_SHIFT_LEFT = 89 - public static final GREATER_THAN = 90 - public static final GREATER_THAN_OR_EQUAL = 91 - public static final SHIFT_RIGHT = 92 - public static final INPLACE_SHIFT_RIGHT = 93 - public static final AT = 94 - public static final SCRIPT_ATTRIBUTE_MARKER = 95 - public static final HASH = 96 - public static final INPLACE_BITWISE_XOR = 97 - public static final EXCLUSIVE_OR = 98 - public static final DIVISION = 99 - public static final RE_LITERAL = 100 - public static final DOUBLE = 101 - public static final INT = 102 - public static final LONG = 103 - public static final DOUBLE_SUFFIX = 104 - public static final EXPONENT = 105 - public static final WHITE_SPACE = 106 - public static final DQS_ESC = 107 - public static final SQS_ESC = 108 - public static final SESC = 109 - public static final ML_COMMENT = 110 - public static final RE_CHAR = 111 - public static final RE_ESC = 112 - public static final NEWLINE = 113 - public static final ID_LETTER = 114 - public static final DIGIT = 115 - public static final HEXDIGIT = 116 - + +class UnityScriptParser(antlr.LLkParser): + public static final EOF = 1 + public static final NULL_TREE_LOOKAHEAD = 3 + public static final AS = 4 + public static final BREAK = 5 + public static final CATCH = 6 + public static final CLASS = 7 + public static final CONTINUE = 8 + public static final ELSE = 9 + public static final ENUM = 10 + public static final EXTENDS = 11 + public static final FALSE = 12 + public static final FINAL = 13 + public static final FINALLY = 14 + public static final FOR = 15 + public static final FUNCTION = 16 + public static final GET = 17 + public static final IF = 18 + public static final IMPORT = 19 + public static final IMPLEMENTS = 20 + public static final IN = 21 + public static final INTERFACE = 22 + public static final INSTANCEOF = 23 + public static final NEW = 24 + public static final NULL = 25 + public static final RETURN = 26 + public static final PUBLIC = 27 + public static final PROTECTED = 28 + public static final INTERNAL = 29 + public static final OVERRIDE = 30 + public static final PARTIAL = 31 + public static final PRAGMA = 32 + public static final PRIVATE = 33 + public static final SET = 34 + public static final STATIC = 35 + public static final SUPER = 36 + public static final THIS = 37 + public static final THROW = 38 + public static final TRUE = 39 + public static final TRY = 40 + public static final TYPEOF = 41 + public static final VAR = 42 + public static final VIRTUAL = 43 + public static final WHILE = 44 + public static final YIELD = 45 + public static final SWITCH = 46 + public static final CASE = 47 + public static final DEFAULT = 48 + public static final INPLACE_DIVISION = 49 + public static final INPLACE_ADD = 50 + public static final INPLACE_SUBTRACT = 51 + public static final INPLACE_MULTIPLY = 52 + public static final ID = 53 + public static final DOUBLE_QUOTED_STRING = 54 + public static final LBRACE = 55 + public static final RBRACE = 56 + public static final LPAREN = 57 + public static final RPAREN = 58 + public static final DOT = 59 + public static final COLON = 60 + public static final COMMA = 61 + public static final LBRACK = 62 + public static final RBRACK = 63 + public static final BITWISE_OR = 64 + public static final INPLACE_BITWISE_OR = 65 + public static final BITWISE_AND = 66 + public static final BITWISE_XOR = 67 + public static final INPLACE_BITWISE_AND = 68 + public static final LOGICAL_OR = 69 + public static final LOGICAL_AND = 70 + public static final EOS = 71 + public static final ASSIGN = 72 + public static final INCREMENT = 73 + public static final DECREMENT = 74 + public static final ADD = 75 + public static final SUBTRACT = 76 + public static final MODULUS = 77 + public static final MULTIPLY = 78 + public static final EQUALITY = 79 + public static final INEQUALITY = 80 + public static final QUESTION_MARK = 81 + public static final BITWISE_NOT = 82 + public static final REFERENCE_EQUALITY = 83 + public static final REFERENCE_INEQUALITY = 84 + public static final LESS_THAN = 85 + public static final LESS_THAN_OR_EQUAL = 86 + public static final SHIFT_LEFT = 87 + public static final INPLACE_SHIFT_LEFT = 88 + public static final GREATER_THAN = 89 + public static final GREATER_THAN_OR_EQUAL = 90 + public static final SHIFT_RIGHT = 91 + public static final INPLACE_SHIFT_RIGHT = 92 + public static final AT = 93 + public static final SCRIPT_ATTRIBUTE_MARKER = 94 + public static final HASH = 95 + public static final INPLACE_BITWISE_XOR = 96 + public static final NOT = 97 + public static final DIVISION = 98 + public static final RE_LITERAL = 99 + public static final DOUBLE = 100 + public static final INT = 101 + public static final LONG = 102 + public static final DOUBLE_SUFFIX = 103 + public static final EXPONENT = 104 + public static final WHITE_SPACE = 105 + public static final DQS_ESC = 106 + public static final SQS_ESC = 107 + public static final SESC = 108 + public static final ML_COMMENT = 109 + public static final RE_CHAR = 110 + public static final RE_ESC = 111 + public static final NEWLINE = 112 + public static final ID_LETTER = 113 + public static final DIGIT = 114 + public static final HEXDIGIT = 115 + [property(CompilerContext)] _context as CompilerContext @@ -251,4339 +250,4341 @@ class UnityScriptParser(antlr.LLkParser): static final ValidPragmas = ("strict", "expando", "implicit", "downcast") - - protected def initialize(): - tokenNames = tokenNames_ - - - protected def constructor(tokenBuf as TokenBuffer, k as int): - super(tokenBuf, k) - initialize() - - def constructor(tokenBuf as TokenBuffer): - self(tokenBuf, 2) - - protected def constructor(lexer as TokenStream, k as int): - super(lexer, k) - initialize() - - public def constructor(lexer as TokenStream): - self(lexer, 2) - - public def constructor(state as ParserSharedInputState): - super(state, 2) - initialize() - - public def start( - cu as CompileUnit - ) as void: //throws RecognitionException, TokenStreamException - - eof as IToken = null - module = Module(LexicalInfo(getFilename(), 1, 1)) - module.Name = CreateModuleName(getFilename()) - cu.Modules.Add(module) - - try: // for error handling - while true: - _givenValue = LA(1) - if ((_givenValue == IMPORT)): // 1831 - import_directive(module) - elif ((_givenValue == HASH)): // 1831 - pragma_directive(module) - else: // line 1969 - goto _loop3_breakloop - :_loop3_breakloop - while true: - if ((LA(1)==AT)): - attributes() - module_member(module) - elif ((tokenSet_0_.member(cast(int, LA(1)))) and (tokenSet_1_.member(cast(int, LA(2))))): // line 2102 - module_member(module) - elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_3_.member(cast(int, LA(2))))): // line 2102 - global_statement(module) - else: - goto _loop6_breakloop - :_loop6_breakloop - eof = LT(1) - match(Token.EOF_TYPE) - if 0 == inputState.guessing: - SetEndSourceLocation(module, eof) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_4_) - else: - raise - - public def import_directive( - container as Module - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - match(IMPORT) - ns=qname() - eos() - if 0 == inputState.guessing: - container.Imports.Add( - Import(ToLexicalInfo(ns), Namespace: ns.getText())) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_5_) - else: - raise - - public def pragma_directive( - container as Module - ) as void: //throws RecognitionException, TokenStreamException - - id as IToken = null - - try: // for error handling - match(HASH) - match(PRAGMA) - id = LT(1) - match(ID) - if 0 == inputState.guessing: - pragma = id.getText() - if pragma not in ValidPragmas: - ReportError(UnityScriptCompilerErrors.UnknownPragma(ToLexicalInfo(id), pragma)) - container.Annotate(pragma) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_5_) - else: - raise - - public def attributes() as void: //throws RecognitionException, TokenStreamException - - _attributes.Clear() - - try: // for error handling - _cnt19 as int = 0 - while true: - if ((LA(1)==AT)): - attribute() - else: - if (_cnt19 >= 1): - goto _loop19_breakloop - else: - raise NoViableAltException(LT(1), getFilename()) - ++_cnt19 - :_loop19_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_6_) - else: - raise - - public def module_member( - m as Module - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == CLASS) - or (_givenValue ==PARTIAL) - ): // 1827 - class_declaration(m) - elif ((_givenValue == INTERFACE)): // 1831 - interface_declaration(m) - elif ((_givenValue == ENUM)): // 1831 - enum_declaration(m) - elif ((_givenValue == FINAL) - or (_givenValue ==FUNCTION) - or (_givenValue ==PUBLIC) - or (_givenValue ==PROTECTED) - or (_givenValue ==INTERNAL) - or (_givenValue ==PRIVATE) - or (_givenValue ==STATIC) - or (_givenValue ==VAR) - or (_givenValue ==VIRTUAL) - ): // 1827 - module_function_or_field(m) - elif ((_givenValue == SCRIPT_ATTRIBUTE_MARKER)): // 1831 - script_attribute(m) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_7_) - else: - raise - - public def global_statement( - m as Module - ) as void: //throws RecognitionException, TokenStreamException - - b = m.Globals - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == FINALLY) - or (_givenValue ==FOR) - or (_givenValue ==IF) - or (_givenValue ==TRY) - or (_givenValue ==WHILE) - or (_givenValue ==SWITCH) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == WHILE)): // 1831 - while_statement(b) - elif ((_givenValue == FOR)): // 1831 - for_statement(b) - elif ((_givenValue == IF)): // 1831 - if_statement(b) - elif ((_givenValue == FINALLY) - or (_givenValue ==TRY) - ): // 1827 - try_statement(b) - elif ((_givenValue == SWITCH)): // 1831 - switch_statement(b) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - elif ((_givenValue == BREAK) - or (_givenValue ==CONTINUE) - or (_givenValue ==FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NOT) - or (_givenValue ==NULL) - or (_givenValue ==RETURN) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==THROW) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==VAR) - or (_givenValue ==YIELD) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NOT) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - expression_statement(b) - elif ((_givenValue == YIELD)): // 1831 - yield_statement(b) - elif ((_givenValue == RETURN)): // 1831 - return_statement(b) - elif ((_givenValue == BREAK)): // 1831 - break_statement(b) - elif ((_givenValue == CONTINUE)): // 1831 - continue_statement(b) - elif ((_givenValue == THROW)): // 1831 - throw_statement(b) - elif ((_givenValue == VAR)): // 1831 - declaration_statement(b) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - eos() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_7_) - else: - raise - - public def attribute_parameter_value() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == INT) - or (_givenValue ==LONG) - ): // 1827 - e=integer_literal() - elif ((_givenValue == DOUBLE_QUOTED_STRING)): // 1831 - e=string_literal() - elif ((_givenValue == FALSE) - or (_givenValue ==TRUE) - ): // 1827 - e=bool_literal() - elif ((_givenValue == NULL)): // 1831 - e=null_literal() - elif ((_givenValue == DOUBLE)): // 1831 - e=double_literal() - else: // line 1969 - if ((LA(1)==ID) and (tokenSet_8_.member(cast(int, LA(2))))): - e=attribute_parameter_value_bitwise_expression() - elif ((tokenSet_9_.member(cast(int, LA(1)))) and (tokenSet_10_.member(cast(int, LA(2))))): // line 2102 - e=typeof_expression() - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_11_) - else: - raise - return e - - public def integer_literal() as IntegerLiteralExpression : //throws RecognitionException, TokenStreamException - e as IntegerLiteralExpression - - i as IToken = null - l as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == INT)): // 1831 - i = LT(1) - match(INT) - if 0 == inputState.guessing: - e = ParseIntegerLiteralExpression(i, i.getText(), false); - elif ((_givenValue == LONG)): // 1831 - l = LT(1) - match(LONG) - if 0 == inputState.guessing: - s = l.getText() - e = ParseIntegerLiteralExpression(l, s[:-1], true) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def string_literal() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - dqs as IToken = null - - try: // for error handling - dqs = LT(1) - match(DOUBLE_QUOTED_STRING) - if 0 == inputState.guessing: - e = StringLiteralExpression(ToLexicalInfo(dqs), dqs.getText()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def bool_literal() as BoolLiteralExpression : //throws RecognitionException, TokenStreamException - e as BoolLiteralExpression - - t as IToken = null - f as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == TRUE)): // 1831 - t = LT(1) - match(TRUE) - if 0 == inputState.guessing: - e = BoolLiteralExpression(ToLexicalInfo(t), Value: true) - elif ((_givenValue == FALSE)): // 1831 - f = LT(1) - match(FALSE) - if 0 == inputState.guessing: - e = BoolLiteralExpression(ToLexicalInfo(f), Value: false) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def null_literal() as NullLiteralExpression : //throws RecognitionException, TokenStreamException - e as NullLiteralExpression - - t as IToken = null - - try: // for error handling - t = LT(1) - match(NULL) - if 0 == inputState.guessing: - e = NullLiteralExpression(ToLexicalInfo(t)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def double_literal() as DoubleLiteralExpression : //throws RecognitionException, TokenStreamException - rle as DoubleLiteralExpression - - value as IToken = null - - try: // for error handling - value = LT(1) - match(DOUBLE) - if 0 == inputState.guessing: - rle = DoubleLiteralExpression(ToLexicalInfo(value), - ParseDouble(value.getText()), - IsSingle: true); - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return rle - - public def attribute_parameter_value_bitwise_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - op as IToken = null - - try: // for error handling - e=attribute_parameter_value_reference_expression() - while true: - if ((LA(1)==BITWISE_OR)): - op = LT(1) - match(BITWISE_OR) - rhs=attribute_parameter_value_reference_expression() - if 0 == inputState.guessing: - e = BinaryExpression(ToLexicalInfo(op), - Operator: BinaryOperatorType.BitwiseOr, - Left: e, - Right: rhs) - else: - goto _loop10_breakloop - :_loop10_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_11_) - else: - raise - return e - - public def typeof_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - t as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == TYPEOF)): // 1831 - t = LT(1) - match(TYPEOF) - if ((LA(1)==LPAREN) and (tokenSet_13_.member(cast(int, LA(2))))): - match(LPAREN) - arg=expression() - match(RPAREN) - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 - arg=expression() - else: - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - mie = MethodInvocationExpression(ToLexicalInfo(t)); - mie.Target = ReferenceExpression(ToLexicalInfo(t), Name: t.getText()) - mie.Arguments.Add(arg) - e = mie - elif ((_givenValue == FUNCTION) - or (_givenValue ==ID) - or (_givenValue ==LPAREN) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == LPAREN)): // 1831 - match(LPAREN) - tr=type_reference() - match(RPAREN) - elif ((_givenValue == FUNCTION) - or (_givenValue ==ID) - ): // 1827 - tr=type_reference() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - e = TypeofExpression(ToLexicalInfo(t), tr); - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def attribute_parameter_value_reference_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - e=reference_expression() - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_14_) - else: - raise - return e - - public def reference_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - lbrack as IToken = null - - try: // for error handling - e=simple_reference_expression() - while true: - if ((LA(1)==DOT)): - match(DOT) - _givenValue = LA(1) - if ((_givenValue == GET) - or (_givenValue ==SET) - or (_givenValue ==ID) - ): // 1827 - memberName=member() - if 0 == inputState.guessing: - e = MemberReferenceExpression(ToLexicalInfo(memberName), Target: e, Name: memberName.getText()) - elif ((_givenValue == LESS_THAN)): // 1831 - lbrack = LT(1) - match(LESS_THAN) - if 0 == inputState.guessing: - e = gre = GenericReferenceExpression(ToLexicalInfo(lbrack), Target: e) - genericArguments = gre.GenericArguments - type_reference_list(genericArguments) - match(GREATER_THAN) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - else: - goto _loop196_breakloop - :_loop196_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - return e - - public def attribute_parameter( - attr as Ast.Attribute - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - synPredMatched14 as bool = false - if ((LA(1)==ID) and (LA(2)==DOT or LA(2)==ASSIGN)): - _m14 as int = mark() - synPredMatched14 = true - ++inputState.guessing - try: - match(ID) - match(ASSIGN) - except x as RecognitionException: - synPredMatched14 = false - rewind(_m14) - --inputState.guessing - if synPredMatched14: - name=reference_expression() - match(ASSIGN) - value=attribute_parameter_value() - if 0 == inputState.guessing: - attr.NamedArguments.Add(ExpressionPair(name, value)) - elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 - value=attribute_parameter_value() - if 0 == inputState.guessing: - attr.Arguments.Add(value) - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_11_) - else: - raise - - public def attribute() as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - match(AT) - attr=attribute_constructor() - if 0 == inputState.guessing: - _attributes.Add(attr) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_18_) - else: - raise - - public def attribute_constructor() as Boo.Lang.Compiler.Ast.Attribute : //throws RecognitionException, TokenStreamException - attr as Boo.Lang.Compiler.Ast.Attribute - - - try: // for error handling - name=qname() - if 0 == inputState.guessing: - attr = Ast.Attribute(ToLexicalInfo(name), name.getText()) - if ((LA(1)==LPAREN) and (tokenSet_19_.member(cast(int, LA(2))))): - match(LPAREN) - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NULL) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LPAREN) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - attribute_parameter(attr) - while true: - if ((LA(1)==COMMA)): - match(COMMA) - attribute_parameter(attr) - else: - goto _loop25_breakloop - :_loop25_breakloop - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RPAREN) - elif ((tokenSet_20_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_20_) - else: - raise - return attr - - public def qname() as Token : //throws RecognitionException, TokenStreamException - id as Token - - start as IToken = null - other as IToken = null - - try: // for error handling - start = LT(1) - match(ID) - if 0 == inputState.guessing: - id = start - buffer = StringBuilder() - buffer.Append(start.getText()) - while true: - if ((LA(1)==DOT) and (LA(2)==ID)): - match(DOT) - other = LT(1) - match(ID) - if 0 == inputState.guessing: - buffer.Append(".") - buffer.Append(other.getText()) - else: - goto _loop38_breakloop - :_loop38_breakloop - if 0 == inputState.guessing: - id.setText(buffer.ToString()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_22_) - else: - raise - return id - - public def class_declaration( - parent as TypeDefinition - ) as void: //throws RecognitionException, TokenStreamException - - p as IToken = null - name as IToken = null - rbrace as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == PARTIAL)): // 1831 - p = LT(1) - match(PARTIAL) - elif ((_givenValue == CLASS)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(CLASS) - name = LT(1) - match(ID) - _givenValue = LA(1) - if ((_givenValue == EXTENDS)): // 1831 - match(EXTENDS) - baseType=type_reference() - elif ((_givenValue == IMPLEMENTS) - or (_givenValue ==LBRACE) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - cd = ClassDefinition(ToLexicalInfo(name), Name: name.getText()) - baseTypes = cd.BaseTypes - if baseType is not null: - baseTypes.Add(baseType) - cd.Modifiers |= TypeMemberModifiers.Partial if p is not null - FlushAttributes(cd) - parent.Members.Add(cd) - _givenValue = LA(1) - if ((_givenValue == IMPLEMENTS)): // 1831 - match(IMPLEMENTS) - type_reference_list(baseTypes) - elif ((_givenValue == LBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - for typeRef in baseTypes: - if typeRef is baseType: - BaseTypeAnnotations.AnnotateExtends(typeRef) - else: - BaseTypeAnnotations.AnnotateImplements(typeRef) - match(LBRACE) - while true: - if ((tokenSet_23_.member(cast(int, LA(1))))): - if 0 == inputState.guessing: - mod = TypeMemberModifiers.None - _givenValue = LA(1) - if ((_givenValue == AT)): // 1831 - attributes() - elif ((_givenValue == FINAL) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==PUBLIC) - or (_givenValue ==PROTECTED) - or (_givenValue ==INTERNAL) - or (_givenValue ==OVERRIDE) - or (_givenValue ==PRIVATE) - or (_givenValue ==STATIC) - or (_givenValue ==VAR) - or (_givenValue ==VIRTUAL) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): - mod=member_modifiers() - elif ((LA(1)==FUNCTION or LA(1)==VAR) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - _givenValue = LA(1) - if ((_givenValue == FUNCTION)): // 1831 - m=function_member(cd) - elif ((_givenValue == VAR)): // 1831 - m=field_member(cd) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - m.Modifiers |= mod if m is not null - else: - goto _loop59_breakloop - :_loop59_breakloop - rbrace = LT(1) - match(RBRACE) - if 0 == inputState.guessing: - SetEndSourceLocation(cd, rbrace) - while true: - if ((LA(1)==EOS)): - match(EOS) - else: - goto _loop61_breakloop - :_loop61_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_7_) - else: - raise - - public def interface_declaration( - parent as TypeDefinition - ) as void: //throws RecognitionException, TokenStreamException - - name as IToken = null - rbrace as IToken = null - - try: // for error handling - match(INTERFACE) - name = LT(1) - match(ID) - if 0 == inputState.guessing: - td = InterfaceDefinition(ToLexicalInfo(name), Name: name.getText()) - baseTypes = td.BaseTypes - FlushAttributes(td) - parent.Members.Add(td) - _givenValue = LA(1) - if ((_givenValue == EXTENDS)): // 1831 - match(EXTENDS) - type_reference_list(baseTypes) - elif ((_givenValue == LBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(LBRACE) - while true: - if ((LA(1)==FUNCTION or LA(1)==AT)): - _givenValue = LA(1) - if ((_givenValue == AT)): // 1831 - attributes() - elif ((_givenValue == FUNCTION)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - interface_member(td) - else: - goto _loop66_breakloop - :_loop66_breakloop - rbrace = LT(1) - match(RBRACE) - if 0 == inputState.guessing: - SetEndSourceLocation(td, rbrace) - while true: - if ((LA(1)==EOS)): - match(EOS) - else: - goto _loop68_breakloop - :_loop68_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_7_) - else: - raise - - public def enum_declaration( - container as TypeDefinition - ) as void: //throws RecognitionException, TokenStreamException - - name as IToken = null - rbrace as IToken = null - - try: // for error handling - match(ENUM) - name = LT(1) - match(ID) - if 0 == inputState.guessing: - ed = EnumDefinition(ToLexicalInfo(name), Name: name.getText()) - container.Members.Add(ed) - match(LBRACE) - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - enum_member(ed) - while true: - if ((LA(1)==COMMA) and (LA(2)==ID)): - match(COMMA) - enum_member(ed) - else: - goto _loop77_breakloop - :_loop77_breakloop - _givenValue = LA(1) - if ((_givenValue == COMMA)): // 1831 - match(COMMA) - elif ((_givenValue == RBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - elif ((_givenValue == RBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - rbrace = LT(1) - match(RBRACE) - if 0 == inputState.guessing: - SetEndSourceLocation(ed, rbrace) - while true: - if ((LA(1)==EOS)): - match(EOS) - else: - goto _loop80_breakloop - :_loop80_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_7_) - else: - raise - - public def module_function_or_field( - m as Module - ) as void: //throws RecognitionException, TokenStreamException - - globals = m.Globals - - try: // for error handling - synPredMatched30 as bool = false - if (((tokenSet_27_.member(cast(int, LA(1)))) and (tokenSet_28_.member(cast(int, LA(2))))) and (GlobalVariablesBecomeFields())): - _m30 as int = mark() - synPredMatched30 = true - ++inputState.guessing - try: - module_member_modifiers() - match(VAR) - except x as RecognitionException: - synPredMatched30 = false - rewind(_m30) - --inputState.guessing - if synPredMatched30: - module_field(m) - elif ((LA(1)==VAR) and (LA(2)==ID)): // line 2102 - declaration_statement(globals) - eos() - elif ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_30_.member(cast(int, LA(2))))): // line 2102 - module_function(m) - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_7_) - else: - raise - - public def script_attribute( - m as Module - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - match(SCRIPT_ATTRIBUTE_MARKER) - attr=attribute_constructor() - if 0 == inputState.guessing: - m.Attributes.Add(attr); - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_7_) - else: - raise - - public def module_member_modifiers() as TypeMemberModifiers : //throws RecognitionException, TokenStreamException - m as TypeMemberModifiers - - v as IToken = null - m = TypeMemberModifiers.None - - try: // for error handling - while true: - _givenValue = LA(1) - if ((_givenValue == FINAL)): // 1831 - match(FINAL) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Final - elif ((_givenValue == PUBLIC)): // 1831 - match(PUBLIC) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Public - elif ((_givenValue == PRIVATE)): // 1831 - match(PRIVATE) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Private - elif ((_givenValue == PROTECTED)): // 1831 - match(PROTECTED) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Protected - elif ((_givenValue == INTERNAL)): // 1831 - match(INTERNAL) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Internal - elif ((_givenValue == STATIC)): // 1831 - match(STATIC) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Static - elif ((_givenValue == VIRTUAL)): // 1831 - v = LT(1) - match(VIRTUAL) - if 0 == inputState.guessing: - VirtualKeywordHasNoEffect(v) - else: // line 1969 - goto _loop47_breakloop - :_loop47_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_31_) - else: - raise - return m - - public def module_field( - m as Module - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - mod=module_member_modifiers() - f=field_member(m) - if 0 == inputState.guessing: - f.Modifiers |= mod - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_7_) - else: - raise - - public def declaration_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - d=declaration() - _givenValue = LA(1) - if ((_givenValue == ASSIGN)): // 1831 - match(ASSIGN) - i=expression() - elif ((_givenValue == EOF) - or (_givenValue ==BREAK) - or (_givenValue ==CATCH) - or (_givenValue ==CLASS) - or (_givenValue ==CONTINUE) - or (_givenValue ==ELSE) - or (_givenValue ==ENUM) - or (_givenValue ==FALSE) - or (_givenValue ==FINAL) - or (_givenValue ==FINALLY) - or (_givenValue ==FOR) - or (_givenValue ==FUNCTION) - or (_givenValue ==IF) - or (_givenValue ==INTERFACE) - or (_givenValue ==NEW) - or (_givenValue ==NOT) - or (_givenValue ==NULL) - or (_givenValue ==RETURN) - or (_givenValue ==PUBLIC) - or (_givenValue ==PROTECTED) - or (_givenValue ==INTERNAL) - or (_givenValue ==PARTIAL) - or (_givenValue ==PRIVATE) - or (_givenValue ==STATIC) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==THROW) - or (_givenValue ==TRUE) - or (_givenValue ==TRY) - or (_givenValue ==TYPEOF) - or (_givenValue ==VAR) - or (_givenValue ==VIRTUAL) - or (_givenValue ==WHILE) - or (_givenValue ==YIELD) - or (_givenValue ==SWITCH) - or (_givenValue ==CASE) - or (_givenValue ==DEFAULT) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==RBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==EOS) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - or (_givenValue ==AT) - or (_givenValue ==SCRIPT_ATTRIBUTE_MARKER) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - stmt = DeclarationStatement(d.LexicalInfo, Declaration: d, Initializer: i) - b.Add(stmt) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - - public def eos() as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - if ((LA(1)==EOS) and (tokenSet_33_.member(cast(int, LA(2))))): - _cnt44 as int = 0 - while true: - if ((LA(1)==EOS) and (tokenSet_33_.member(cast(int, LA(2))))): - match(EOS) - else: - if (_cnt44 >= 1): - goto _loop44_breakloop - else: - raise NoViableAltException(LT(1), getFilename()) - ++_cnt44 - :_loop44_breakloop - elif ((tokenSet_33_.member(cast(int, LA(1)))) and (tokenSet_34_.member(cast(int, LA(2))))): // line 2102 - if 0 == inputState.guessing: - SemicolonExpected() - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_33_) - else: - raise - - public def module_function( - parent as TypeDefinition - ) as void: //throws RecognitionException, TokenStreamException - - name as IToken = null - - try: // for error handling - mod=module_member_modifiers() - match(FUNCTION) - name = LT(1) - match(ID) - if 0 == inputState.guessing: - method = Method(ToLexicalInfo(name), Name: name.getText()) - method.Modifiers = mod - FlushAttributes(method) - parent.Members.Add(method) - function_body(method) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_7_) - else: - raise - - public def field_member( - cd as TypeDefinition - ) as TypeMember : //throws RecognitionException, TokenStreamException - member as TypeMember - - - try: // for error handling - match(VAR) - name=member_name() - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - elif ((_givenValue == EOF) - or (_givenValue ==BREAK) - or (_givenValue ==CLASS) - or (_givenValue ==CONTINUE) - or (_givenValue ==ENUM) - or (_givenValue ==FALSE) - or (_givenValue ==FINAL) - or (_givenValue ==FINALLY) - or (_givenValue ==FOR) - or (_givenValue ==FUNCTION) - or (_givenValue ==IF) - or (_givenValue ==INTERFACE) - or (_givenValue ==NEW) - or (_givenValue ==NOT) - or (_givenValue ==NULL) - or (_givenValue ==RETURN) - or (_givenValue ==PUBLIC) - or (_givenValue ==PROTECTED) - or (_givenValue ==INTERNAL) - or (_givenValue ==OVERRIDE) - or (_givenValue ==PARTIAL) - or (_givenValue ==PRIVATE) - or (_givenValue ==STATIC) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==THROW) - or (_givenValue ==TRUE) - or (_givenValue ==TRY) - or (_givenValue ==TYPEOF) - or (_givenValue ==VAR) - or (_givenValue ==VIRTUAL) - or (_givenValue ==WHILE) - or (_givenValue ==YIELD) - or (_givenValue ==SWITCH) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==RBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==EOS) - or (_givenValue ==ASSIGN) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - or (_givenValue ==AT) - or (_givenValue ==SCRIPT_ATTRIBUTE_MARKER) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - _givenValue = LA(1) - if ((_givenValue == ASSIGN)): // 1831 - match(ASSIGN) - initializer=expression() - elif ((_givenValue == EOF) - or (_givenValue ==BREAK) - or (_givenValue ==CLASS) - or (_givenValue ==CONTINUE) - or (_givenValue ==ENUM) - or (_givenValue ==FALSE) - or (_givenValue ==FINAL) - or (_givenValue ==FINALLY) - or (_givenValue ==FOR) - or (_givenValue ==FUNCTION) - or (_givenValue ==IF) - or (_givenValue ==INTERFACE) - or (_givenValue ==NEW) - or (_givenValue ==NOT) - or (_givenValue ==NULL) - or (_givenValue ==RETURN) - or (_givenValue ==PUBLIC) - or (_givenValue ==PROTECTED) - or (_givenValue ==INTERNAL) - or (_givenValue ==OVERRIDE) - or (_givenValue ==PARTIAL) - or (_givenValue ==PRIVATE) - or (_givenValue ==STATIC) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==THROW) - or (_givenValue ==TRUE) - or (_givenValue ==TRY) - or (_givenValue ==TYPEOF) - or (_givenValue ==VAR) - or (_givenValue ==VIRTUAL) - or (_givenValue ==WHILE) - or (_givenValue ==YIELD) - or (_givenValue ==SWITCH) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==RBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==EOS) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - or (_givenValue ==AT) - or (_givenValue ==SCRIPT_ATTRIBUTE_MARKER) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - eos() - if 0 == inputState.guessing: - member = Field(ToLexicalInfo(name), - Name: name.getText(), - Type: tr, - Initializer: initializer) - FlushAttributes(member) - cd.Members.Add(member) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_35_) - else: - raise - return member - - public def while_statement( - container as Block - ) as void: //throws RecognitionException, TokenStreamException - - w as IToken = null - - try: // for error handling - w = LT(1) - match(WHILE) - e=paren_expression() - if 0 == inputState.guessing: - ws = WhileStatement(ToLexicalInfo(w), Condition: e) - b = ws.Block - container.Add(ws) - EnterLoop(ws) - compound_or_single_stmt(b) - if 0 == inputState.guessing: - LeaveLoop(ws) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - - public def for_statement( - container as Block - ) as void: //throws RecognitionException, TokenStreamException - - f as IToken = null - - try: // for error handling - f = LT(1) - match(FOR) - match(LPAREN) - synPredMatched127 as bool = false - if ((LA(1)==VAR or LA(1)==ID) and (LA(2)==IN or LA(2)==ID)): - _m127 as int = mark() - synPredMatched127 = true - ++inputState.guessing - try: - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - match(ID) - elif ((_givenValue == VAR)): // 1831 - declaration() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(IN) - except x as RecognitionException: - synPredMatched127 = false - rewind(_m127) - --inputState.guessing - if synPredMatched127: - stmt=for_in(container) - elif ((tokenSet_36_.member(cast(int, LA(1)))) and (tokenSet_37_.member(cast(int, LA(2))))): // line 2102 - stmt=for_c(container) - else: - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - stmt.LexicalInfo = ToLexicalInfo(f) if stmt is not null - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - - public def if_statement( - container as Block - ) as void: //throws RecognitionException, TokenStreamException - - it as IToken = null - et as IToken = null - - try: // for error handling - it = LT(1) - match(IF) - e=paren_expression() - if 0 == inputState.guessing: - s = IfStatement(ToLexicalInfo(it), Condition: e) - b = s.TrueBlock = Block() - container.Add(s) - compound_or_single_stmt(b) - if ((LA(1)==ELSE) and (tokenSet_38_.member(cast(int, LA(2))))): - et = LT(1) - match(ELSE) - if 0 == inputState.guessing: - b = s.FalseBlock = Block(ToLexicalInfo(et)) - compound_or_single_stmt(b) - elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - - public def try_statement( - container as Block - ) as void: //throws RecognitionException, TokenStreamException - - tt as IToken = null - ct as IToken = null - id as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == TRY)): // 1831 - tt = LT(1) - match(TRY) - if 0 == inputState.guessing: - s = TryStatement(ToLexicalInfo(tt)) - b = s.ProtectedBlock - container.Add(s) - compound_or_single_stmt(b) - _cnt154 as int = 0 - while true: - if ((LA(1)==CATCH) and (LA(2)==LPAREN)): - ct = LT(1) - match(CATCH) - match(LPAREN) - id = LT(1) - match(ID) - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RPAREN) - if 0 == inputState.guessing: - tr = SimpleTypeReference(ToLexicalInfo(id), "System.Exception") if tr is null - handler = ExceptionHandler( - ToLexicalInfo(ct), - Declaration: Declaration( - ToLexicalInfo(id), - Name: id.getText(), - Type: tr)) - s.ExceptionHandlers.Add(handler) - b = handler.Block - tr = null - compound_or_single_stmt(b) - else: - if (_cnt154 >= 1): - goto _loop154_breakloop - else: - raise NoViableAltException(LT(1), getFilename()) - ++_cnt154 - :_loop154_breakloop - if ((LA(1)==FINALLY) and (tokenSet_38_.member(cast(int, LA(2))))): - finally_block(s) - elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - elif ((_givenValue == FINALLY)): // 1831 - finally_block(s) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - - public def switch_statement( - container as Block - ) as void: //throws RecognitionException, TokenStreamException - - s as IToken = null - c as IToken = null - fallthrough as IToken = null - d as IToken = null - - try: // for error handling - s = LT(1) - match(SWITCH) - e=paren_expression() - if 0 == inputState.guessing: - switchMacro = MacroStatement(ToLexicalInfo(s), Name: MacroName(s.getText())) - switchMacro.Arguments.Add(e) - switchBlock = switchMacro.Body - container.Add(switchMacro) - match(LBRACE) - while true: - if ((LA(1)==CASE)): - c = LT(1) - match(CASE) - e=expression() - match(COLON) - if 0 == inputState.guessing: - item = MacroStatement(ToLexicalInfo(c), Name: c.getText()) - item.Arguments.Add(e) - itemBlock = item.Body - switchBlock.Add(item) - while true: - if ((LA(1)==CASE)): - fallthrough = LT(1) - match(CASE) - e=expression() - match(COLON) - if 0 == inputState.guessing: - item.Arguments.Add(e); - else: - goto _loop141_breakloop - :_loop141_breakloop - _cnt143 as int = 0 - while true: - if ((tokenSet_38_.member(cast(int, LA(1))))): - statement(itemBlock) - else: - if (_cnt143 >= 1): - goto _loop143_breakloop - else: - raise NoViableAltException(LT(1), getFilename()) - ++_cnt143 - :_loop143_breakloop - else: - goto _loop144_breakloop - :_loop144_breakloop - _givenValue = LA(1) - if ((_givenValue == DEFAULT)): // 1831 - d = LT(1) - match(DEFAULT) - match(COLON) - if 0 == inputState.guessing: - item = MacroStatement(ToLexicalInfo(d), Name: d.getText()) - itemBlock = item.Body - switchBlock.Add(item) - _cnt147 as int = 0 - while true: - if ((tokenSet_38_.member(cast(int, LA(1))))): - statement(itemBlock) - else: - if (_cnt147 >= 1): - goto _loop147_breakloop - else: - raise NoViableAltException(LT(1), getFilename()) - ++_cnt147 - :_loop147_breakloop - elif ((_givenValue == RBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RBRACE) - while true: - if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): - match(EOS) - else: - goto _loop149_breakloop - :_loop149_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - - public def expression_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - e=assignment_expression() - if 0 == inputState.guessing: - b.Add(ExpressionStatement(e)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - - public def yield_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - yt as IToken = null - - try: // for error handling - yt = LT(1) - match(YIELD) - if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_39_.member(cast(int, LA(2))))): - e=expression() - elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - b.Add(YieldStatement(ToLexicalInfo(yt), Expression: e)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - - public def return_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - ret as IToken = null - - try: // for error handling - ret = LT(1) - match(RETURN) - if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_39_.member(cast(int, LA(2))))): - e=expression() - elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - b.Add(ReturnStatement(ToLexicalInfo(ret), Expression: e)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - - public def break_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - t as IToken = null - - try: // for error handling - t = LT(1) - match(BREAK) - if 0 == inputState.guessing: - b.Add(BreakStatement(ToLexicalInfo(t))) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - - public def continue_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - t as IToken = null - - try: // for error handling - t = LT(1) - match(CONTINUE) - if 0 == inputState.guessing: - gotoLabel = GetCurrentLoopLabel() - if gotoLabel is not null: - // we might be inside a c style for statement - b.Add(GotoStatement(ToLexicalInfo(t), Label: ReferenceExpression(gotoLabel))) - else: - b.Add(ContinueStatement(ToLexicalInfo(t))) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - - public def throw_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - t as IToken = null - - try: // for error handling - t = LT(1) - match(THROW) - if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_39_.member(cast(int, LA(2))))): - e=expression() - elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - b.Add(RaiseStatement(ToLexicalInfo(t), Exception: e)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - - public def member_modifiers() as TypeMemberModifiers : //throws RecognitionException, TokenStreamException - m as TypeMemberModifiers - - v as IToken = null - m = TypeMemberModifiers.None - - try: // for error handling - while true: - _givenValue = LA(1) - if ((_givenValue == FINAL)): // 1831 - match(FINAL) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Final - elif ((_givenValue == OVERRIDE)): // 1831 - match(OVERRIDE) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Override - elif ((_givenValue == PUBLIC)): // 1831 - match(PUBLIC) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Public - elif ((_givenValue == PRIVATE)): // 1831 - match(PRIVATE) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Private - elif ((_givenValue == PROTECTED)): // 1831 - match(PROTECTED) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Protected - elif ((_givenValue == INTERNAL)): // 1831 - match(INTERNAL) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Internal - elif ((_givenValue == STATIC)): // 1831 - match(STATIC) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Static - elif ((_givenValue == NEW)): // 1831 - match(NEW) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.New - elif ((_givenValue == VIRTUAL)): // 1831 - v = LT(1) - match(VIRTUAL) - if 0 == inputState.guessing: - VirtualKeywordHasNoEffect(v) - else: // line 1969 - goto _loop50_breakloop - :_loop50_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_31_) - else: - raise - return m - - public def type_reference() as TypeReference : //throws RecognitionException, TokenStreamException - tr as TypeReference - - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - tr=simple_type_reference() - elif ((_givenValue == FUNCTION)): // 1831 - tr=anonymous_function_type() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if ((LA(1)==LBRACK) and (LA(2)==RBRACK)): - match(LBRACK) - match(RBRACK) - if 0 == inputState.guessing: - tr = ArrayTypeReference(tr.LexicalInfo, tr); - elif ((tokenSet_40_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_40_) - else: - raise - return tr - - public def type_reference_list( - typeReferences as TypeReferenceCollection - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - tr=type_reference() - if 0 == inputState.guessing: - typeReferences.Add(tr) - while true: - if ((LA(1)==COMMA)): - match(COMMA) - tr=type_reference() - if 0 == inputState.guessing: - typeReferences.Add(tr) - else: - goto _loop179_breakloop - :_loop179_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_42_) - else: - raise - - public def function_member( - cd as ClassDefinition - ) as TypeMember : //throws RecognitionException, TokenStreamException - member as TypeMember - - getter as IToken = null - setter as IToken = null - - try: // for error handling - match(FUNCTION) - _givenValue = LA(1) - if ((_givenValue == GET)): // 1831 - getter = LT(1) - match(GET) - elif ((_givenValue == SET)): // 1831 - setter = LT(1) - match(SET) - elif ((_givenValue == FINAL) - or (_givenValue ==ID) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - memberName=member_name() - if 0 == inputState.guessing: - method as Method - if memberName.getText() == cd.Name: - member = method = Constructor(ToLexicalInfo(memberName)) - else: - member = method = Method(ToLexicalInfo(memberName), Name: memberName.getText()) - if getter is not null or setter is not null: - p = cd.Members[memberName.getText()] as Property - if p is null: - p = Property(ToLexicalInfo(memberName), Name: memberName.getText()) - cd.Members.Add(p) - if getter is not null: - p.Getter = method - else: - p.Setter = method - FlushAttributes(p) - else: - cd.Members.Add(method) - FlushAttributes(method) - function_body(method) - if 0 == inputState.guessing: - // TODO: move this error checking to a compiler step - // as well as properly checking the type of the accessors - // against the type of the property - if setter is not null: - if method.Parameters.Count != 1 or method.Parameters[0].Name != "value": - ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(ToLexicalInfo(memberName))) - method.Parameters.Clear() - if getter is not null: - if method.Parameters.Count > 0: - ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(ToLexicalInfo(memberName))) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_43_) - else: - raise - return member - - public def interface_member( - parent as TypeDefinition - ) as void: //throws RecognitionException, TokenStreamException - - name as IToken = null - - try: // for error handling - match(FUNCTION) - name = LT(1) - match(ID) - if 0 == inputState.guessing: - method = Method(ToLexicalInfo(name), Name: name.getText()) - FlushAttributes(method) - parent.Members.Add(method) - match(LPAREN) - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - parameter_declaration_list(method) - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RPAREN) - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - if 0 == inputState.guessing: - method.ReturnType = tr; - elif ((_givenValue == FUNCTION) - or (_givenValue ==RBRACE) - or (_givenValue ==EOS) - or (_givenValue ==AT) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - while true: - if ((LA(1)==EOS)): - match(EOS) - else: - goto _loop73_breakloop - :_loop73_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_44_) - else: - raise - - public def parameter_declaration_list( - m as INodeWithParameters - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - parameter_declaration(m) - while true: - if ((LA(1)==COMMA)): - match(COMMA) - parameter_declaration(m) - else: - goto _loop95_breakloop - :_loop95_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_45_) - else: - raise - - public def enum_member( - container as EnumDefinition - ) as void: //throws RecognitionException, TokenStreamException - - name as IToken = null - - try: // for error handling - name = LT(1) - match(ID) - _givenValue = LA(1) - if ((_givenValue == ASSIGN)): // 1831 - match(ASSIGN) - initializer=integer_literal() - elif ((_givenValue == RBRACE) - or (_givenValue ==COMMA) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - em = EnumMember(ToLexicalInfo(name), - Name: name.getText(), - Initializer: initializer) - container.Members.Add(em) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_46_) - else: - raise - - public def member_name() as antlr.IToken : //throws RecognitionException, TokenStreamException - token as antlr.IToken - - name as IToken = null - f as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - name = LT(1) - match(ID) - if 0 == inputState.guessing: - token = name; - elif ((_givenValue == FINAL)): // 1831 - f = LT(1) - match(FINAL) - if 0 == inputState.guessing: - token = f; KeywordCannotBeUsedAsAnIdentifier(token); - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_47_) - else: - raise - return token - - public def expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - e=conditional_expression() - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def function_body( - method as Method - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - match(LPAREN) - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - parameter_declaration_list(method) - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RPAREN) - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - if 0 == inputState.guessing: - method.ReturnType = tr; - elif ((_givenValue == LBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - compound_statement(method.Body) - if 0 == inputState.guessing: - method.EndSourceLocation = method.Body.EndSourceLocation - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_35_) - else: - raise - - public def compound_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - block(b) - while true: - if ((LA(1)==EOS) and (tokenSet_48_.member(cast(int, LA(2))))): - match(EOS) - else: - goto _loop101_breakloop - :_loop101_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_48_) - else: - raise - - public def parameter_declaration( - m as INodeWithParameters - ) as void: //throws RecognitionException, TokenStreamException - - id as IToken = null - - try: // for error handling - id = LT(1) - match(ID) - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - elif ((_givenValue == RPAREN) - or (_givenValue ==COMMA) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - parameter = ParameterDeclaration(ToLexicalInfo(id), Name: id.getText(), Type: tr) - m.Parameters.Add(parameter) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_11_) - else: - raise - - public def compound_or_single_stmt( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - if ((LA(1)==LBRACE) and (tokenSet_49_.member(cast(int, LA(2))))): - compound_statement(b) - elif ((tokenSet_38_.member(cast(int, LA(1)))) and (tokenSet_50_.member(cast(int, LA(2))))): // line 2102 - statement(b) - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - - public def statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == FINALLY) - or (_givenValue ==FOR) - or (_givenValue ==IF) - or (_givenValue ==TRY) - or (_givenValue ==WHILE) - or (_givenValue ==SWITCH) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == WHILE)): // 1831 - while_statement(b) - elif ((_givenValue == FOR)): // 1831 - for_statement(b) - elif ((_givenValue == IF)): // 1831 - if_statement(b) - elif ((_givenValue == FINALLY) - or (_givenValue ==TRY) - ): // 1827 - try_statement(b) - elif ((_givenValue == SWITCH)): // 1831 - switch_statement(b) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - elif ((_givenValue == BREAK) - or (_givenValue ==CONTINUE) - or (_givenValue ==FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NOT) - or (_givenValue ==NULL) - or (_givenValue ==RETURN) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==THROW) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==VAR) - or (_givenValue ==YIELD) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NOT) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - expression_statement(b) - elif ((_givenValue == YIELD)): // 1831 - yield_statement(b) - elif ((_givenValue == RETURN)): // 1831 - return_statement(b) - elif ((_givenValue == BREAK)): // 1831 - break_statement(b) - elif ((_givenValue == CONTINUE)): // 1831 - continue_statement(b) - elif ((_givenValue == THROW)): // 1831 - throw_statement(b) - elif ((_givenValue == VAR)): // 1831 - declaration_statement(b) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - eos() - elif ((_givenValue == EOS)): // 1831 - _cnt111 as int = 0 - while true: - if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): - match(EOS) - else: - if (_cnt111 >= 1): - goto _loop111_breakloop - else: - raise NoViableAltException(LT(1), getFilename()) - ++_cnt111 - :_loop111_breakloop - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - - public def block( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - rbrace as IToken = null - - try: // for error handling - match(LBRACE) - while true: - if ((tokenSet_38_.member(cast(int, LA(1))))): - statement(b) - else: - goto _loop104_breakloop - :_loop104_breakloop - rbrace = LT(1) - match(RBRACE) - if 0 == inputState.guessing: - SetEndSourceLocation(b, rbrace) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - - public def declaration() as Declaration : //throws RecognitionException, TokenStreamException - d as Declaration - - id as IToken = null - - try: // for error handling - match(VAR) - id = LT(1) - match(ID) - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - elif ((_givenValue == EOF) - or (_givenValue ==BREAK) - or (_givenValue ==CATCH) - or (_givenValue ==CLASS) - or (_givenValue ==CONTINUE) - or (_givenValue ==ELSE) - or (_givenValue ==ENUM) - or (_givenValue ==FALSE) - or (_givenValue ==FINAL) - or (_givenValue ==FINALLY) - or (_givenValue ==FOR) - or (_givenValue ==FUNCTION) - or (_givenValue ==IF) - or (_givenValue ==IN) - or (_givenValue ==INTERFACE) - or (_givenValue ==NEW) - or (_givenValue ==NOT) - or (_givenValue ==NULL) - or (_givenValue ==RETURN) - or (_givenValue ==PUBLIC) - or (_givenValue ==PROTECTED) - or (_givenValue ==INTERNAL) - or (_givenValue ==PARTIAL) - or (_givenValue ==PRIVATE) - or (_givenValue ==STATIC) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==THROW) - or (_givenValue ==TRUE) - or (_givenValue ==TRY) - or (_givenValue ==TYPEOF) - or (_givenValue ==VAR) - or (_givenValue ==VIRTUAL) - or (_givenValue ==WHILE) - or (_givenValue ==YIELD) - or (_givenValue ==SWITCH) - or (_givenValue ==CASE) - or (_givenValue ==DEFAULT) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==RBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==EOS) - or (_givenValue ==ASSIGN) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - or (_givenValue ==AT) - or (_givenValue ==SCRIPT_ATTRIBUTE_MARKER) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - d = Declaration(ToLexicalInfo(id)) - d.Name = id.getText() - d.Type = tr - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_51_) - else: - raise - return d - - public def assignment_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - a as IToken = null - ipa as IToken = null - ips as IToken = null - ipm as IToken = null - ipd as IToken = null - ipbo as IToken = null - ipba as IToken = null - ipxo as IToken = null - ipsl as IToken = null - ipsr as IToken = null - - try: // for error handling - e=conditional_expression() - _givenValue = LA(1) - if ((_givenValue == INPLACE_DIVISION) - or (_givenValue ==INPLACE_ADD) - or (_givenValue ==INPLACE_SUBTRACT) - or (_givenValue ==INPLACE_MULTIPLY) - or (_givenValue ==INPLACE_BITWISE_OR) - or (_givenValue ==INPLACE_BITWISE_AND) - or (_givenValue ==ASSIGN) - or (_givenValue ==INPLACE_SHIFT_LEFT) - or (_givenValue ==INPLACE_SHIFT_RIGHT) - or (_givenValue ==INPLACE_BITWISE_XOR) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == ASSIGN)): // 1831 - a = LT(1) - match(ASSIGN) - if 0 == inputState.guessing: - token = a; op = BinaryOperatorType.Assign - elif ((_givenValue == INPLACE_ADD)): // 1831 - ipa = LT(1) - match(INPLACE_ADD) - if 0 == inputState.guessing: - token = ipa; op = BinaryOperatorType.InPlaceAddition - elif ((_givenValue == INPLACE_SUBTRACT)): // 1831 - ips = LT(1) - match(INPLACE_SUBTRACT) - if 0 == inputState.guessing: - token = ips; op = BinaryOperatorType.InPlaceSubtraction - elif ((_givenValue == INPLACE_MULTIPLY)): // 1831 - ipm = LT(1) - match(INPLACE_MULTIPLY) - if 0 == inputState.guessing: - token = ipm; op = BinaryOperatorType.InPlaceMultiply - elif ((_givenValue == INPLACE_DIVISION)): // 1831 - ipd = LT(1) - match(INPLACE_DIVISION) - if 0 == inputState.guessing: - token = ipd; op = BinaryOperatorType.InPlaceDivision - elif ((_givenValue == INPLACE_BITWISE_OR)): // 1831 - ipbo = LT(1) - match(INPLACE_BITWISE_OR) - if 0 == inputState.guessing: - token = ipbo; op = BinaryOperatorType.InPlaceBitwiseOr - elif ((_givenValue == INPLACE_BITWISE_AND)): // 1831 - ipba = LT(1) - match(INPLACE_BITWISE_AND) - if 0 == inputState.guessing: - token = ipba; op = BinaryOperatorType.InPlaceBitwiseAnd - elif ((_givenValue == INPLACE_BITWISE_XOR)): // 1831 - ipxo = LT(1) - match(INPLACE_BITWISE_XOR) - if 0 == inputState.guessing: - token = ipxo; op = BinaryOperatorType.InPlaceExclusiveOr - elif ((_givenValue == INPLACE_SHIFT_LEFT)): // 1831 - ipsl = LT(1) - match(INPLACE_SHIFT_LEFT) - if 0 == inputState.guessing: - token = ipsl; op = BinaryOperatorType.InPlaceShiftLeft - elif ((_givenValue == INPLACE_SHIFT_RIGHT)): // 1831 - ipsr = LT(1) - match(INPLACE_SHIFT_RIGHT) - if 0 == inputState.guessing: - token = ipsr; op = BinaryOperatorType.InPlaceShiftRight - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - r=assignment_expression() - if 0 == inputState.guessing: - be = BinaryExpression(ToLexicalInfo(token)) - be.Operator = op - be.Left = e - be.Right = r - e = be - elif ((_givenValue == EOF) - or (_givenValue ==BREAK) - or (_givenValue ==CATCH) - or (_givenValue ==CLASS) - or (_givenValue ==CONTINUE) - or (_givenValue ==ELSE) - or (_givenValue ==ENUM) - or (_givenValue ==FALSE) - or (_givenValue ==FINAL) - or (_givenValue ==FINALLY) - or (_givenValue ==FOR) - or (_givenValue ==FUNCTION) - or (_givenValue ==IF) - or (_givenValue ==INTERFACE) - or (_givenValue ==NEW) - or (_givenValue ==NOT) - or (_givenValue ==NULL) - or (_givenValue ==RETURN) - or (_givenValue ==PUBLIC) - or (_givenValue ==PROTECTED) - or (_givenValue ==INTERNAL) - or (_givenValue ==PARTIAL) - or (_givenValue ==PRIVATE) - or (_givenValue ==STATIC) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==THROW) - or (_givenValue ==TRUE) - or (_givenValue ==TRY) - or (_givenValue ==TYPEOF) - or (_givenValue ==VAR) - or (_givenValue ==VIRTUAL) - or (_givenValue ==WHILE) - or (_givenValue ==YIELD) - or (_givenValue ==SWITCH) - or (_givenValue ==CASE) - or (_givenValue ==DEFAULT) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==RBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==RPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==EOS) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - or (_givenValue ==AT) - or (_givenValue ==SCRIPT_ATTRIBUTE_MARKER) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_52_) - else: - raise - return e - - public def for_in( - container as Block - ) as Statement : //throws RecognitionException, TokenStreamException - stmt as Statement - - id as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - id = LT(1) - match(ID) - if 0 == inputState.guessing: - d = Declaration(ToLexicalInfo(id), Name: id.getText()) - elif ((_givenValue == VAR)): // 1831 - d=declaration() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(IN) - iterator=expression() - if 0 == inputState.guessing: - fs = ForStatement(Iterator: iterator) - fs.Declarations.Add(d) - b = fs.Block - stmt = fs - container.Add(stmt) - EnterLoop(stmt) - match(RPAREN) - compound_or_single_stmt(b) - if 0 == inputState.guessing: - LeaveLoop(stmt) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - return stmt - - public def for_c( - container as Block - ) as Statement : //throws RecognitionException, TokenStreamException - stmt as Statement - - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == VAR)): // 1831 - declaration_statement(container) - if 0 == inputState.guessing: - stmt = container.Statements[-1] as DeclarationStatement - stmt.Annotate("PrivateScope") if stmt is not null - elif ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NOT) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - expression_statement(container) - elif ((_givenValue == EOS)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(EOS) - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NOT) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - condition=expression() - elif ((_givenValue == EOS)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(EOS) - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NOT) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - update=assignment_expression() - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - ws = WhileStatement(Condition: condition) - if condition is null: - ws.Condition = BoolLiteralExpression(Value: true) - b = ws.Block - stmt = ws - // support for 'continue' - label = SetUpLoopLabel(ws) - container.Add(stmt) - EnterLoop(ws) - match(RPAREN) - compound_or_single_stmt(b) - if 0 == inputState.guessing: - LeaveLoop(ws) - if IsLabelInUse(ws): - b.Add(LabelStatement(Name: label)) - b.Add(update) if update is not null - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - return stmt - - public def paren_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - match(LPAREN) - e=expression() - match(RPAREN) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def finally_block( - s as TryStatement - ) as void: //throws RecognitionException, TokenStreamException - - ft as IToken = null - - try: // for error handling - ft = LT(1) - match(FINALLY) - if 0 == inputState.guessing: - finallyBlock = s.EnsureBlock = Block(ToLexicalInfo(ft)) - compound_or_single_stmt(finallyBlock) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - - public def conditional_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - qm as IToken = null - - try: // for error handling - e=logical_expression() - if ((LA(1)==QUESTION_MARK) and (tokenSet_13_.member(cast(int, LA(2))))): - qm = LT(1) - match(QUESTION_MARK) - trueValue=logical_expression() - match(COLON) - falseValue=conditional_expression() - if 0 == inputState.guessing: - e = ConditionalExpression(ToLexicalInfo(qm), - Condition: e, - TrueValue: trueValue, - FalseValue: falseValue) - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def member() as Token : //throws RecognitionException, TokenStreamException - name as Token - - id as IToken = null - st as IToken = null - gt as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - id = LT(1) - match(ID) - if 0 == inputState.guessing: - name=id; - elif ((_givenValue == SET)): // 1831 - st = LT(1) - match(SET) - if 0 == inputState.guessing: - name=st; - elif ((_givenValue == GET)): // 1831 - gt = LT(1) - match(GET) - if 0 == inputState.guessing: - name=gt; - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return name - - public def simple_type_reference() as TypeReference : //throws RecognitionException, TokenStreamException - tr as TypeReference - - - try: // for error handling - typeName=qname() - if ((LA(1)==DOT) and (LA(2)==LESS_THAN)): - match(DOT) - match(LESS_THAN) - if 0 == inputState.guessing: - tr = gtr = GenericTypeReference(ToLexicalInfo(typeName), typeName.getText()); - arguments = gtr.GenericArguments - type_reference_list(arguments) - match(GREATER_THAN) - elif ((tokenSet_40_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 - if 0 == inputState.guessing: - tr = SimpleTypeReference(ToLexicalInfo(typeName), Name: typeName.getText()) - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_40_) - else: - raise - return tr - - public def anonymous_function_type() as TypeReference : //throws RecognitionException, TokenStreamException - tr as TypeReference - - fn as IToken = null - - try: // for error handling - fn = LT(1) - match(FUNCTION) - if 0 == inputState.guessing: - tr = callableTypeRef = CallableTypeReference(ToLexicalInfo(fn)) - parameters = callableTypeRef.Parameters - function_type_parameters(parameters) - if ((LA(1)==COLON) and (LA(2)==FUNCTION or LA(2)==ID)): - match(COLON) - returnType=type_reference() - if 0 == inputState.guessing: - callableTypeRef.ReturnType = returnType - elif ((tokenSet_40_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_40_) - else: - raise - return tr - - public def function_type_parameters( - parameters as ParameterDeclarationCollection - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - match(LPAREN) - _givenValue = LA(1) - if ((_givenValue == FUNCTION) - or (_givenValue ==ID) - ): // 1827 - parameterType=type_reference() - if 0 == inputState.guessing: - parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) - while true: - if ((LA(1)==COMMA)): - match(COMMA) - parameterType=type_reference() - if 0 == inputState.guessing: - parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) - else: - goto _loop171_breakloop - :_loop171_breakloop - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RPAREN) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_40_) - else: - raise - - public def array_initializer() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - tr=simple_type_reference() - match(LBRACK) - count=sum() - match(RBRACK) - if 0 == inputState.guessing: - e = CodeFactory.NewArrayInitializer(tr.LexicalInfo, tr, count) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def sum() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - add as IToken = null - sub as IToken = null - bitor as IToken = null - eo as IToken = null - bOperator = BinaryOperatorType.None; - - try: // for error handling - e=term() - while true: - if ((tokenSet_54_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): - _givenValue = LA(1) - if ((_givenValue == ADD)): // 1831 - add = LT(1) - match(ADD) - if 0 == inputState.guessing: - op=add; bOperator = BinaryOperatorType.Addition; - elif ((_givenValue == SUBTRACT)): // 1831 - sub = LT(1) - match(SUBTRACT) - if 0 == inputState.guessing: - op=sub; bOperator = BinaryOperatorType.Subtraction; - elif ((_givenValue == BITWISE_OR)): // 1831 - bitor = LT(1) - match(BITWISE_OR) - if 0 == inputState.guessing: - op=bitor; bOperator = BinaryOperatorType.BitwiseOr; - elif ((_givenValue == EXCLUSIVE_OR)): // 1831 - eo = LT(1) - match(EXCLUSIVE_OR) - if 0 == inputState.guessing: - op=eo; bOperator = BinaryOperatorType.ExclusiveOr; - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - r=term() - if 0 == inputState.guessing: - be = BinaryExpression(ToLexicalInfo(op)) - be.Operator = bOperator - be.Left = e - be.Right = r - e = be - else: - goto _loop253_breakloop - :_loop253_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def new_array_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - match(NEW) - e=array_initializer() - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def new_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - synPredMatched183 as bool = false - if ((LA(1)==NEW) and (LA(2)==ID)): - _m183 as int = mark() - synPredMatched183 = true - ++inputState.guessing - try: - new_array_expression() - except x as RecognitionException: - synPredMatched183 = false - rewind(_m183) - --inputState.guessing - if synPredMatched183: - e=new_array_expression() - elif ((LA(1)==NEW) and (LA(2)==ID)): // line 2102 - match(NEW) - r=reference_expression() - if 0 == inputState.guessing: - e = mie = MethodInvocationExpression(r.LexicalInfo, Target: r) - args = mie.Arguments - match(LPAREN) - expression_list(args) - match(RPAREN) - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def expression_list( - ec as ExpressionCollection - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NOT) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - e=expression() - if 0 == inputState.guessing: - ec.Add(e); - while true: - if ((LA(1)==COMMA)): - match(COMMA) - e=expression() - if 0 == inputState.guessing: - ec.Add(e); - else: - goto _loop211_breakloop - :_loop211_breakloop - elif ((_givenValue == RPAREN) - or (_givenValue ==RBRACK) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_55_) - else: - raise - - public def atom() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LBRACK) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - e=literal() - elif ((_givenValue == NEW)): // 1831 - e=new_expression() - else: // line 1969 - if ((LA(1)==FUNCTION) and (LA(2)==LPAREN)): - e=function_expression() - elif ((LA(1)==ID) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 - e=simple_reference_expression() - elif ((LA(1)==LPAREN) and (tokenSet_13_.member(cast(int, LA(2))))): // line 2102 - e=paren_expression() - elif ((tokenSet_9_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 - e=typeof_expression() - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def literal() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == INT) - or (_givenValue ==LONG) - ): // 1827 - e=integer_literal() - elif ((_givenValue == DOUBLE_QUOTED_STRING)): // 1831 - e=string_literal() - elif ((_givenValue == LBRACK)): // 1831 - e=array_literal() - elif ((_givenValue == LBRACE)): // 1831 - e=hash_literal() - elif ((_givenValue == RE_LITERAL)): // 1831 - e=re_literal() - elif ((_givenValue == FALSE) - or (_givenValue ==TRUE) - ): // 1827 - e=bool_literal() - elif ((_givenValue == NULL)): // 1831 - e=null_literal() - elif ((_givenValue == THIS)): // 1831 - e=self_literal() - elif ((_givenValue == SUPER)): // 1831 - e=super_literal() - elif ((_givenValue == DOUBLE)): // 1831 - e=double_literal() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def function_expression() as BlockExpression : //throws RecognitionException, TokenStreamException - e as BlockExpression - - fn as IToken = null - - try: // for error handling - fn = LT(1) - match(FUNCTION) - if 0 == inputState.guessing: - e = BlockExpression(ToLexicalInfo(fn)) - body = e.Body - match(LPAREN) - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - parameter_declaration_list(e) - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RPAREN) - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - if 0 == inputState.guessing: - e.ReturnType = tr; - elif ((_givenValue == LBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - block(body) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def simple_reference_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - id as IToken = null - - try: // for error handling - id = LT(1) - match(ID) - if 0 == inputState.guessing: - e = ReferenceExpression(ToLexicalInfo(id), Name: id.getText()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def slice( - se as SlicingExpression - ) as void: //throws RecognitionException, TokenStreamException - - begin as Expression - end as Expression - step as Expression - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - if 0 == inputState.guessing: - begin = OmittedExpression.Default; - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NOT) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - end=expression() - elif ((_givenValue == COLON)): // 1831 - match(COLON) - if 0 == inputState.guessing: - end = OmittedExpression.Default; - step=expression() - elif ((_givenValue == COMMA) - or (_givenValue ==RBRACK) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - elif ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NOT) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - begin=expression() - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NOT) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - end=expression() - elif ((_givenValue == COLON) - or (_givenValue ==COMMA) - or (_givenValue ==RBRACK) - ): // 1827 - if 0 == inputState.guessing: - end = OmittedExpression.Default; - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - step=expression() - elif ((_givenValue == COMMA) - or (_givenValue ==RBRACK) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - elif ((_givenValue == COMMA) - or (_givenValue ==RBRACK) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - se.Indices.Add(Slice(begin, end, step)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_56_) - else: - raise - - public def logical_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - op as IToken = null - - try: // for error handling - e=boolean_term() - while true: - if ((LA(1)==LOGICAL_OR) and (tokenSet_13_.member(cast(int, LA(2))))): - op = LT(1) - match(LOGICAL_OR) - rhs=boolean_term() - if 0 == inputState.guessing: - e = BinaryExpression(ToLexicalInfo(op), - Operator: BinaryOperatorType.Or, - Left: e, - Right: rhs) - else: - goto _loop227_breakloop - :_loop227_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def boolean_term() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - op as IToken = null - - try: // for error handling - e=comparison_expression() - while true: - if ((LA(1)==LOGICAL_AND) and (tokenSet_13_.member(cast(int, LA(2))))): - op = LT(1) - match(LOGICAL_AND) - rhs=comparison_expression() - if 0 == inputState.guessing: - e=BinaryExpression(ToLexicalInfo(op), - Operator: BinaryOperatorType.And, - Left: e, - Right: rhs) - else: - goto _loop230_breakloop - :_loop230_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def comparison_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - te as IToken = null - ti as IToken = null - tgt as IToken = null - tgte as IToken = null - tlt as IToken = null - tlte as IToken = null - re as IToken = null - rie as IToken = null - tin as IToken = null - tnint as IToken = null - tisa as IToken = null - r as Expression - op = BinaryOperatorType.None; - token as IToken - - try: // for error handling - e=sum() - while true: - if ((tokenSet_57_.member(cast(int, LA(1)))) and (tokenSet_58_.member(cast(int, LA(2))))): - _givenValue = LA(1) - if ((_givenValue == EQUALITY) - or (_givenValue ==INEQUALITY) - or (_givenValue ==REFERENCE_EQUALITY) - or (_givenValue ==REFERENCE_INEQUALITY) - or (_givenValue ==LESS_THAN) - or (_givenValue ==LESS_THAN_OR_EQUAL) - or (_givenValue ==GREATER_THAN) - or (_givenValue ==GREATER_THAN_OR_EQUAL) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == EQUALITY)): // 1831 - te = LT(1) - match(EQUALITY) - if 0 == inputState.guessing: - op = BinaryOperatorType.Equality; token = te; - elif ((_givenValue == INEQUALITY)): // 1831 - ti = LT(1) - match(INEQUALITY) - if 0 == inputState.guessing: - op = BinaryOperatorType.Inequality; token =ti - elif ((_givenValue == GREATER_THAN)): // 1831 - tgt = LT(1) - match(GREATER_THAN) - if 0 == inputState.guessing: - op = BinaryOperatorType.GreaterThan; token = tgt; - elif ((_givenValue == GREATER_THAN_OR_EQUAL)): // 1831 - tgte = LT(1) - match(GREATER_THAN_OR_EQUAL) - if 0 == inputState.guessing: - op = BinaryOperatorType.GreaterThanOrEqual; token = tgte - elif ((_givenValue == LESS_THAN)): // 1831 - tlt = LT(1) - match(LESS_THAN) - if 0 == inputState.guessing: - op = BinaryOperatorType.LessThan; token = tlt; - elif ((_givenValue == LESS_THAN_OR_EQUAL)): // 1831 - tlte = LT(1) - match(LESS_THAN_OR_EQUAL) - if 0 == inputState.guessing: - op = BinaryOperatorType.LessThanOrEqual; token = tlte; - elif ((_givenValue == REFERENCE_EQUALITY)): // 1831 - re = LT(1) - match(REFERENCE_EQUALITY) - if 0 == inputState.guessing: - op = BinaryOperatorType.ReferenceEquality; token = re - elif ((_givenValue == REFERENCE_INEQUALITY)): // 1831 - rie = LT(1) - match(REFERENCE_INEQUALITY) - if 0 == inputState.guessing: - op = BinaryOperatorType.ReferenceInequality; token = rie - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - r=sum() - elif ((_givenValue == IN) - or (_givenValue ==NOT) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == IN)): // 1831 - tin = LT(1) - match(IN) - if 0 == inputState.guessing: - op = BinaryOperatorType.Member; token = tin; - elif ((_givenValue == NOT)): // 1831 - tnint = LT(1) - match(NOT) - match(IN) - if 0 == inputState.guessing: - op = BinaryOperatorType.NotMember; token = tnint; - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - r=expression() - elif ((_givenValue == INSTANCEOF)): // 1831 - tisa = LT(1) - match(INSTANCEOF) - tr=type_reference() - if 0 == inputState.guessing: - op = BinaryOperatorType.TypeTest; - token = tisa; - r = TypeofExpression(tr.LexicalInfo, tr); - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - be = BinaryExpression(ToLexicalInfo(token)) - be.Operator = op - be.Left = e - be.Right = r - e = be - else: - goto _loop249_breakloop - :_loop249_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def term() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - m as IToken = null - d as IToken = null - md as IToken = null - op = BinaryOperatorType.None - - try: // for error handling - e=factor() - while true: - if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_13_.member(cast(int, LA(2))))): - _givenValue = LA(1) - if ((_givenValue == MULTIPLY)): // 1831 - m = LT(1) - match(MULTIPLY) - if 0 == inputState.guessing: - op=BinaryOperatorType.Multiply; token=m; - elif ((_givenValue == DIVISION)): // 1831 - d = LT(1) - match(DIVISION) - if 0 == inputState.guessing: - op=BinaryOperatorType.Division; token=d; - elif ((_givenValue == MODULUS)): // 1831 - md = LT(1) - match(MODULUS) - if 0 == inputState.guessing: - op=BinaryOperatorType.Modulus; token=md; - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - r=factor() - if 0 == inputState.guessing: - be = BinaryExpression(ToLexicalInfo(token)) - be.Operator = op - be.Left = e - be.Right = r - e = be - else: - goto _loop257_breakloop - :_loop257_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def factor() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - sl as IToken = null - sr as IToken = null - - try: // for error handling - e=bitwise_or() - while true: - if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_13_.member(cast(int, LA(2))))): - _givenValue = LA(1) - if ((_givenValue == SHIFT_LEFT)): // 1831 - sl = LT(1) - match(SHIFT_LEFT) - if 0 == inputState.guessing: - op = BinaryOperatorType.ShiftLeft; token = sl - elif ((_givenValue == SHIFT_RIGHT)): // 1831 - sr = LT(1) - match(SHIFT_RIGHT) - if 0 == inputState.guessing: - op = BinaryOperatorType.ShiftRight; token = sr - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - r=bitwise_or() - if 0 == inputState.guessing: - e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) - else: - goto _loop261_breakloop - :_loop261_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def bitwise_or() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - token as IToken = null - - try: // for error handling - e=bitwise_xor() - while true: - if ((LA(1)==BITWISE_OR) and (tokenSet_13_.member(cast(int, LA(2))))): - token = LT(1) - match(BITWISE_OR) - if 0 == inputState.guessing: - op = BinaryOperatorType.BitwiseOr; - r=bitwise_xor() - if 0 == inputState.guessing: - e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) - else: - goto _loop264_breakloop - :_loop264_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def bitwise_xor() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - token as IToken = null - - try: // for error handling - e=bitwise_and() - while true: - if ((LA(1)==BITWISE_XOR) and (tokenSet_13_.member(cast(int, LA(2))))): - token = LT(1) - match(BITWISE_XOR) - if 0 == inputState.guessing: - op = BinaryOperatorType.ExclusiveOr; - r=bitwise_and() - if 0 == inputState.guessing: - e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) - else: - goto _loop267_breakloop - :_loop267_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def bitwise_and() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - token as IToken = null - - try: // for error handling - e=unary_expression() - while true: - if ((LA(1)==BITWISE_AND) and (tokenSet_13_.member(cast(int, LA(2))))): - token = LT(1) - match(BITWISE_AND) - if 0 == inputState.guessing: - op = BinaryOperatorType.BitwiseAnd; - r=unary_expression() - if 0 == inputState.guessing: - e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) - else: - goto _loop270_breakloop - :_loop270_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def unary_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - sub as IToken = null - inc as IToken = null - dec as IToken = null - nt as IToken = null - oc as IToken = null - postinc as IToken = null - preinc as IToken = null - t as IToken = null - uOperator = UnaryOperatorType.None - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == NOT) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == SUBTRACT)): // 1831 - sub = LT(1) - match(SUBTRACT) - if 0 == inputState.guessing: - op = sub; uOperator = UnaryOperatorType.UnaryNegation; - elif ((_givenValue == INCREMENT)): // 1831 - inc = LT(1) - match(INCREMENT) - if 0 == inputState.guessing: - op = inc; uOperator = UnaryOperatorType.Increment; - elif ((_givenValue == DECREMENT)): // 1831 - dec = LT(1) - match(DECREMENT) - if 0 == inputState.guessing: - op = dec; uOperator = UnaryOperatorType.Decrement; - elif ((_givenValue == NOT)): // 1831 - nt = LT(1) - match(NOT) - if 0 == inputState.guessing: - op = nt; uOperator = UnaryOperatorType.LogicalNot; - elif ((_givenValue == ONES_COMPLEMENT)): // 1831 - oc = LT(1) - match(ONES_COMPLEMENT) - if 0 == inputState.guessing: - op = oc; uOperator = UnaryOperatorType.OnesComplement; - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - e=slicing_expression() - elif ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - e=slicing_expression() - if ((LA(1)==INCREMENT) and (tokenSet_12_.member(cast(int, LA(2))))): - postinc = LT(1) - match(INCREMENT) - if 0 == inputState.guessing: - op = postinc; uOperator = UnaryOperatorType.PostIncrement; - elif ((LA(1)==DECREMENT) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 - preinc = LT(1) - match(DECREMENT) - if 0 == inputState.guessing: - op = preinc; uOperator= UnaryOperatorType.PostDecrement; - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - if op is not null: - ue = UnaryExpression(ToLexicalInfo(op)) - ue.Operator = uOperator - ue.Operand = e - e = ue - if ((LA(1)==AS) and (LA(2)==FUNCTION or LA(2)==ID)): - t = LT(1) - match(AS) - tr=type_reference() - if 0 == inputState.guessing: - ae = TryCastExpression(ToLexicalInfo(t), Target: e, Type: tr) - e = ae - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def slicing_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - lbrack as IToken = null - lparen as IToken = null - se as SlicingExpression - mce as MethodInvocationExpression - args as ExpressionCollection - memberName as IToken - - try: // for error handling - e=atom() - while true: - if ((LA(1)==LBRACK) and (tokenSet_59_.member(cast(int, LA(2))))): - lbrack = LT(1) - match(LBRACK) - if 0 == inputState.guessing: - se = SlicingExpression(ToLexicalInfo(lbrack)) - se.Target = e - e = se - slice(se) - while true: - if ((LA(1)==COMMA)): - match(COMMA) - slice(se) - else: - goto _loop282_breakloop - :_loop282_breakloop - match(RBRACK) - elif ((LA(1)==DOT) and (LA(2)==GET or LA(2)==SET or LA(2)==ID)): // line 2102 - match(DOT) - memberName=member() - if 0 == inputState.guessing: - e = MemberReferenceExpression(ToLexicalInfo(memberName), Target: e, Name: memberName.getText()) - elif ((LA(1)==LPAREN) and (tokenSet_60_.member(cast(int, LA(2))))): // line 2102 - lparen = LT(1) - match(LPAREN) - if 0 == inputState.guessing: - mce = MethodInvocationExpression(ToLexicalInfo(lparen)) - mce.Target = e - e = mce - args = mce.Arguments - expression_list(args) - match(RPAREN) - else: - goto _loop285_breakloop - :_loop285_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def array_literal() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - lbrack as IToken = null - lle as ListLiteralExpression - - try: // for error handling - lbrack = LT(1) - match(LBRACK) - if 0 == inputState.guessing: - e = lle = ArrayLiteralExpression(ToLexicalInfo(lbrack)) - expression_list(lle.Items) - match(RBRACK) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def hash_literal() as HashLiteralExpression : //throws RecognitionException, TokenStreamException - dle as HashLiteralExpression - - lbrace as IToken = null - pair as ExpressionPair - - try: // for error handling - lbrace = LT(1) - match(LBRACE) - if 0 == inputState.guessing: - dle = HashLiteralExpression(ToLexicalInfo(lbrace)); - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NOT) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==ONES_COMPLEMENT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - ): // 1827 - pair=expression_pair() - if 0 == inputState.guessing: - dle.Items.Add(pair); - while true: - if ((LA(1)==COMMA)): - match(COMMA) - pair=expression_pair() - if 0 == inputState.guessing: - dle.Items.Add(pair); - else: - goto _loop292_breakloop - :_loop292_breakloop - elif ((_givenValue == RBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RBRACE) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return dle - - public def re_literal() as RELiteralExpression : //throws RecognitionException, TokenStreamException - re as RELiteralExpression - - value as IToken = null - - try: // for error handling - value = LT(1) - match(RE_LITERAL) - if 0 == inputState.guessing: - re = RELiteralExpression(ToLexicalInfo(value), value.getText()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return re - - public def self_literal() as SelfLiteralExpression : //throws RecognitionException, TokenStreamException - e as SelfLiteralExpression - - t as IToken = null - - try: // for error handling - t = LT(1) - match(THIS) - if 0 == inputState.guessing: - e = SelfLiteralExpression(ToLexicalInfo(t)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def super_literal() as SuperLiteralExpression : //throws RecognitionException, TokenStreamException - e as SuperLiteralExpression - - t as IToken = null - - try: // for error handling - t = LT(1) - match(SUPER) - if 0 == inputState.guessing: - e = SuperLiteralExpression(ToLexicalInfo(t)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - return e - - public def expression_pair() as ExpressionPair : //throws RecognitionException, TokenStreamException - ep as ExpressionPair - - t as IToken = null - - try: // for error handling - key=expression() - t = LT(1) - match(COLON) - value=expression() - if 0 == inputState.guessing: - ep = ExpressionPair(ToLexicalInfo(t), key, value) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_46_) - else: - raise - return ep - - - public static final tokenNames_ = ( - '<0>', - 'EOF', - '<2>', - 'NULL_TREE_LOOKAHEAD', - 'as', - 'break', - 'catch', - 'class', - 'continue', - 'else', - 'enum', - 'extends', - 'false', - 'final', - 'finally', - 'for', - 'function', - 'get', - 'if', - 'import', - 'implements', - 'in', - 'interface', - 'instanceof', - 'new', - 'not', - 'null', - 'return', - 'public', - 'protected', - 'internal', - 'override', - 'partial', - 'pragma', - 'private', - 'set', - 'static', - 'super', - 'this', - 'throw', - 'true', - 'try', - 'typeof', - 'var', - 'virtual', - 'while', - 'yield', - 'switch', - 'case', - 'default', - '/=', - '+=', - '-=', - '*=', - 'an identifier', - 'a string', - '{', - '}', - '(', - ')', - '.', - ':', - ',', - '[', - ']', - '|', - '|=', - '&', - '^', - '&=', - '||', - '&&', - ';', - '=', - '++', - '--', - '+', - '-', - '%', - '*', - '==', - '!=', - '?', - '~', - '===', - '!==', - '<', - '<=', - '<<', - '<<=', - '>', - '>=', - '>>', - '>>=', - '@', - '@script', - 'HASH', - 'INPLACE_BITWISE_XOR', - 'EXCLUSIVE_OR', - 'DIVISION', - 'RE_LITERAL', - 'DOUBLE', - 'INT', - 'LONG', - 'DOUBLE_SUFFIX', - 'EXPONENT', - 'WHITE_SPACE', - 'DQS_ESC', - 'SQS_ESC', - 'SESC', - 'ML_COMMENT', - 'RE_CHAR', - 'RE_ESC', - 'NEWLINE', - 'ID_LETTER', - 'DIGIT', - 'HEXDIGIT', - ) - - private static def mk_tokenSet_0_() as (long): - data = (26480356697216L, 2147483648L, 0L, 0L, ) - return data - public static final tokenSet_0_ = BitSet(mk_tokenSet_0_()) - private static def mk_tokenSet_1_() as (long): - data = (18040874567016576L, 0L, ) - return data - public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) - private static def mk_tokenSet_2_() as (long): - data = (-8808777125532937952L, 1030792686592L, 0L, 0L, ) - return data - public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) - private static def mk_tokenSet_3_() as (long): - data = (-7494834249973500494L, 1095216660479L, 0L, 0L, ) - return data - public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) - private static def mk_tokenSet_4_() as (long): - data = (2L, 0L, ) - return data - public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) - private static def mk_tokenSet_5_() as (long): - data = (-8808759441268804190L, 1038308879360L, 0L, 0L, ) - return data - public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) - private static def mk_tokenSet_6_() as (long): - data = (26482520958080L, 2147483648L, 0L, 0L, ) - return data - public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) - private static def mk_tokenSet_7_() as (long): - data = (-8808759441269328478L, 1034013912064L, 0L, 0L, ) - return data - public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) - private static def mk_tokenSet_8_() as (long): - data = (6341068275337658368L, 2L, 0L, 0L, ) - return data - public static final tokenSet_8_ = BitSet(mk_tokenSet_8_()) - private static def mk_tokenSet_9_() as (long): - data = (306249172707770368L, 0L, ) - return data - public static final tokenSet_9_ = BitSet(mk_tokenSet_9_()) - private static def mk_tokenSet_10_() as (long): - data = (-2467966685806522368L, 1030792686592L, 0L, 0L, ) - return data - public static final tokenSet_10_ = BitSet(mk_tokenSet_10_()) - private static def mk_tokenSet_11_() as (long): - data = (5188146770730811392L, 0L, ) - return data - public static final tokenSet_11_ = BitSet(mk_tokenSet_11_()) - private static def mk_tokenSet_12_() as (long): - data = (-42951378958L, 1095216660479L, 0L, 0L, ) - return data - public static final tokenSet_12_ = BitSet(mk_tokenSet_12_()) - private static def mk_tokenSet_13_() as (long): - data = (-8809034961144180736L, 1030792686592L, 0L, 0L, ) - return data - public static final tokenSet_13_ = BitSet(mk_tokenSet_13_()) - private static def mk_tokenSet_14_() as (long): - data = (5188146770730811392L, 2L, 0L, 0L, ) - return data - public static final tokenSet_14_ = BitSet(mk_tokenSet_14_()) - private static def mk_tokenSet_15_() as (long): - data = (5476377146882523136L, 514L, 0L, 0L, ) - return data - public static final tokenSet_15_ = BitSet(mk_tokenSet_15_()) - private static def mk_tokenSet_16_() as (long): - data = (342279069305475072L, 962072674304L, 0L, 0L, ) - return data - public static final tokenSet_16_ = BitSet(mk_tokenSet_16_()) - private static def mk_tokenSet_17_() as (long): - data = (-2467966685806522368L, 1030792686594L, 0L, 0L, ) - return data - public static final tokenSet_17_ = BitSet(mk_tokenSet_17_()) - private static def mk_tokenSet_18_() as (long): - data = (26482520958080L, 3221225472L, 0L, 0L, ) - return data - public static final tokenSet_18_ = BitSet(mk_tokenSet_18_()) - private static def mk_tokenSet_19_() as (long): - data = (918739821608898560L, 962072674304L, 0L, 0L, ) - return data - public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) - private static def mk_tokenSet_20_() as (long): - data = (-8808759439121844830L, 1034013912064L, 0L, 0L, ) - return data - public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) - private static def mk_tokenSet_21_() as (long): - data = (-7494834213466147406L, 1095216660479L, 0L, 0L, ) - return data - public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) - private static def mk_tokenSet_22_() as (long): - data = (-42949806094L, 1099511627775L, 0L, 0L, ) - return data - public static final tokenSet_22_ = BitSet(mk_tokenSet_22_()) - private static def mk_tokenSet_23_() as (long): - data = (26478221795328L, 1073741824L, 0L, 0L, ) - return data - public static final tokenSet_23_ = BitSet(mk_tokenSet_23_()) - private static def mk_tokenSet_24_() as (long): - data = (26478221795328L, 0L, ) - return data - public static final tokenSet_24_ = BitSet(mk_tokenSet_24_()) - private static def mk_tokenSet_25_() as (long): - data = (18040911091146752L, 0L, ) - return data - public static final tokenSet_25_ = BitSet(mk_tokenSet_25_()) - private static def mk_tokenSet_26_() as (long): - data = (18014432869359616L, 0L, ) - return data - public static final tokenSet_26_ = BitSet(mk_tokenSet_26_()) - private static def mk_tokenSet_27_() as (long): - data = (26476057468928L, 0L, ) - return data - public static final tokenSet_27_ = BitSet(mk_tokenSet_27_()) - private static def mk_tokenSet_28_() as (long): - data = (18040874566950912L, 0L, ) - return data - public static final tokenSet_28_ = BitSet(mk_tokenSet_28_()) - private static def mk_tokenSet_29_() as (long): - data = (17679964512256L, 0L, ) - return data - public static final tokenSet_29_ = BitSet(mk_tokenSet_29_()) - private static def mk_tokenSet_30_() as (long): - data = (18032078473994240L, 0L, ) - return data - public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) - private static def mk_tokenSet_31_() as (long): - data = (8796093087744L, 0L, ) - return data - public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) - private static def mk_tokenSet_32_() as (long): - data = (-8663799828263340062L, 1034013912320L, 0L, 0L, ) - return data - public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) - private static def mk_tokenSet_33_() as (long): - data = (-8663799826115332126L, 1038308879616L, 0L, 0L, ) - return data - public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) - private static def mk_tokenSet_34_() as (long): - data = (-1574926L, 1095216660479L, 0L, 0L, ) - return data - public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) - private static def mk_tokenSet_35_() as (long): - data = (-8664644251045988958L, 1034013912064L, 0L, 0L, ) - return data - public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) - private static def mk_tokenSet_36_() as (long): - data = (-8809026165051158528L, 1030792686848L, 0L, 0L, ) - return data - public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) - private static def mk_tokenSet_37_() as (long): - data = (-7495109769848352752L, 1091995435007L, 0L, 0L, ) - return data - public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) - private static def mk_tokenSet_38_() as (long): - data = (-8808777125532937952L, 1030792686848L, 0L, 0L, ) - return data - public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) - private static def mk_tokenSet_39_() as (long): - data = (-7510878323646007310L, 1086056299995L, 0L, 0L, ) - return data - public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) - private static def mk_tokenSet_40_() as (long): - data = (-42950330382L, 1095216660479L, 0L, 0L, ) - return data - public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) - private static def mk_tokenSet_41_() as (long): - data = (-8590460942L, 1095216660479L, 0L, 0L, ) - return data - public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) - private static def mk_tokenSet_42_() as (long): - data = (72057594037927936L, 67108864L, 0L, 0L, ) - return data - public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) - private static def mk_tokenSet_43_() as (long): - data = (144141666297651200L, 1073741824L, 0L, 0L, ) - return data - public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) - private static def mk_tokenSet_44_() as (long): - data = (144115188075921408L, 1073741824L, 0L, 0L, ) - return data - public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) - private static def mk_tokenSet_45_() as (long): - data = (576460752303423488L, 0L, ) - return data - public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) - private static def mk_tokenSet_46_() as (long): - data = (4755801206503243776L, 0L, ) - return data - public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) - private static def mk_tokenSet_47_() as (long): - data = (-6358801241832295006L, 1034013912832L, 0L, 0L, ) - return data - public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) - private static def mk_tokenSet_48_() as (long): - data = (-8663799826115856414L, 1034013912320L, 0L, 0L, ) - return data - public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) - private static def mk_tokenSet_49_() as (long): - data = (-8664661937457082080L, 1030792686848L, 0L, 0L, ) - return data - public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) - private static def mk_tokenSet_50_() as (long): - data = (-7493989825043367950L, 1095216660479L, 0L, 0L, ) - return data - public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) - private static def mk_tokenSet_51_() as (long): - data = (-8663799828261242910L, 1034013912832L, 0L, 0L, ) - return data - public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) - private static def mk_tokenSet_52_() as (long): - data = (-8087339075959916574L, 1034013912320L, 0L, 0L, ) - return data - public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) - private static def mk_tokenSet_53_() as (long): - data = (-8591509518L, 1095216660479L, 0L, 0L, ) - return data - public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) - private static def mk_tokenSet_54_() as (long): - data = (0L, 17179881474L, 0L, 0L, ) - return data - public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) - private static def mk_tokenSet_55_() as (long): - data = (576460752303423488L, 1L, 0L, 0L, ) - return data - public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) - private static def mk_tokenSet_56_() as (long): - data = (4611686018427387904L, 1L, 0L, 0L, ) - return data - public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) - private static def mk_tokenSet_57_() as (long): - data = (44040192L, 217251840L, 0L, 0L, ) - return data - public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) - private static def mk_tokenSet_58_() as (long): - data = (-8809034961142083584L, 1030792686592L, 0L, 0L, ) - return data - public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) - private static def mk_tokenSet_59_() as (long): - data = (-6503191951930486784L, 1030792686592L, 0L, 0L, ) - return data - public static final tokenSet_59_ = BitSet(mk_tokenSet_59_()) - private static def mk_tokenSet_60_() as (long): - data = (-8232574208840757248L, 1030792686592L, 0L, 0L, ) - return data - public static final tokenSet_60_ = BitSet(mk_tokenSet_60_()) - + + protected def initialize(): + tokenNames = tokenNames_ + + + protected def constructor(tokenBuf as TokenBuffer, k as int): + super(tokenBuf, k) + initialize() + + def constructor(tokenBuf as TokenBuffer): + self(tokenBuf, 2) + + protected def constructor(lexer as TokenStream, k as int): + super(lexer, k) + initialize() + + public def constructor(lexer as TokenStream): + self(lexer, 2) + + public def constructor(state as ParserSharedInputState): + super(state, 2) + initialize() + + public def start( + cu as CompileUnit + ) as void: //throws RecognitionException, TokenStreamException + + eof as IToken = null + module = Module(LexicalInfo(getFilename(), 1, 1)) + module.Name = CreateModuleName(getFilename()) + cu.Modules.Add(module) + + try: // for error handling + while true: + _givenValue = LA(1) + if ((_givenValue == IMPORT)): // 1831 + import_directive(module) + elif ((_givenValue == HASH)): // 1831 + pragma_directive(module) + else: // line 1969 + goto _loop3_breakloop + :_loop3_breakloop + while true: + if ((LA(1)==AT)): + attributes() + module_member(module) + elif ((tokenSet_0_.member(cast(int, LA(1)))) and (tokenSet_1_.member(cast(int, LA(2))))): // line 2102 + module_member(module) + elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_3_.member(cast(int, LA(2))))): // line 2102 + global_statement(module) + else: + goto _loop6_breakloop + :_loop6_breakloop + eof = LT(1) + match(Token.EOF_TYPE) + if 0 == inputState.guessing: + SetEndSourceLocation(module, eof) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_4_) + else: + raise + + public def import_directive( + container as Module + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + match(IMPORT) + ns=qname() + eos() + if 0 == inputState.guessing: + container.Imports.Add( + Import(ToLexicalInfo(ns), Namespace: ns.getText())) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_5_) + else: + raise + + public def pragma_directive( + container as Module + ) as void: //throws RecognitionException, TokenStreamException + + id as IToken = null + + try: // for error handling + match(HASH) + match(PRAGMA) + id = LT(1) + match(ID) + if 0 == inputState.guessing: + pragma = id.getText() + if pragma not in ValidPragmas: + ReportError(UnityScriptCompilerErrors.UnknownPragma(ToLexicalInfo(id), pragma)) + container.Annotate(pragma) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_5_) + else: + raise + + public def attributes() as void: //throws RecognitionException, TokenStreamException + + _attributes.Clear() + + try: // for error handling + _cnt19 as int = 0 + while true: + if ((LA(1)==AT)): + attribute() + else: + if (_cnt19 >= 1): + goto _loop19_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) + ++_cnt19 + :_loop19_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_6_) + else: + raise + + public def module_member( + m as Module + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == CLASS) + or (_givenValue ==PARTIAL) + ): // 1827 + class_declaration(m) + elif ((_givenValue == INTERFACE)): // 1831 + interface_declaration(m) + elif ((_givenValue == ENUM)): // 1831 + enum_declaration(m) + elif ((_givenValue == FINAL) + or (_givenValue ==FUNCTION) + or (_givenValue ==PUBLIC) + or (_givenValue ==PROTECTED) + or (_givenValue ==INTERNAL) + or (_givenValue ==PRIVATE) + or (_givenValue ==STATIC) + or (_givenValue ==VAR) + or (_givenValue ==VIRTUAL) + ): // 1827 + module_function_or_field(m) + elif ((_givenValue == SCRIPT_ATTRIBUTE_MARKER)): // 1831 + script_attribute(m) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_7_) + else: + raise + + public def global_statement( + m as Module + ) as void: //throws RecognitionException, TokenStreamException + + b = m.Globals + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == FINALLY) + or (_givenValue ==FOR) + or (_givenValue ==IF) + or (_givenValue ==TRY) + or (_givenValue ==WHILE) + or (_givenValue ==SWITCH) + ): // 1827 + _givenValue = LA(1) + if ((_givenValue == WHILE)): // 1831 + while_statement(b) + elif ((_givenValue == FOR)): // 1831 + for_statement(b) + elif ((_givenValue == IF)): // 1831 + if_statement(b) + elif ((_givenValue == FINALLY) + or (_givenValue ==TRY) + ): // 1827 + try_statement(b) + elif ((_givenValue == SWITCH)): // 1831 + switch_statement(b) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + elif ((_givenValue == BREAK) + or (_givenValue ==CONTINUE) + or (_givenValue ==FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==RETURN) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==THROW) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==VAR) + or (_givenValue ==YIELD) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + expression_statement(b) + elif ((_givenValue == YIELD)): // 1831 + yield_statement(b) + elif ((_givenValue == RETURN)): // 1831 + return_statement(b) + elif ((_givenValue == BREAK)): // 1831 + break_statement(b) + elif ((_givenValue == CONTINUE)): // 1831 + continue_statement(b) + elif ((_givenValue == THROW)): // 1831 + throw_statement(b) + elif ((_givenValue == VAR)): // 1831 + declaration_statement(b) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + eos() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_7_) + else: + raise + + public def attribute_parameter_value() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == INT) + or (_givenValue ==LONG) + ): // 1827 + e=integer_literal() + elif ((_givenValue == DOUBLE_QUOTED_STRING)): // 1831 + e=string_literal() + elif ((_givenValue == FALSE) + or (_givenValue ==TRUE) + ): // 1827 + e=bool_literal() + elif ((_givenValue == NULL)): // 1831 + e=null_literal() + elif ((_givenValue == DOUBLE)): // 1831 + e=double_literal() + else: // line 1969 + if ((LA(1)==ID) and (tokenSet_8_.member(cast(int, LA(2))))): + e=attribute_parameter_value_bitwise_expression() + elif ((tokenSet_9_.member(cast(int, LA(1)))) and (tokenSet_10_.member(cast(int, LA(2))))): // line 2102 + e=typeof_expression() + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_11_) + else: + raise + return e + + public def integer_literal() as IntegerLiteralExpression : //throws RecognitionException, TokenStreamException + e as IntegerLiteralExpression + + i as IToken = null + l as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == INT)): // 1831 + i = LT(1) + match(INT) + if 0 == inputState.guessing: + e = ParseIntegerLiteralExpression(i, i.getText(), false); + elif ((_givenValue == LONG)): // 1831 + l = LT(1) + match(LONG) + if 0 == inputState.guessing: + s = l.getText() + e = ParseIntegerLiteralExpression(l, s[:-1], true) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def string_literal() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + dqs as IToken = null + + try: // for error handling + dqs = LT(1) + match(DOUBLE_QUOTED_STRING) + if 0 == inputState.guessing: + e = StringLiteralExpression(ToLexicalInfo(dqs), dqs.getText()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def bool_literal() as BoolLiteralExpression : //throws RecognitionException, TokenStreamException + e as BoolLiteralExpression + + t as IToken = null + f as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == TRUE)): // 1831 + t = LT(1) + match(TRUE) + if 0 == inputState.guessing: + e = BoolLiteralExpression(ToLexicalInfo(t), Value: true) + elif ((_givenValue == FALSE)): // 1831 + f = LT(1) + match(FALSE) + if 0 == inputState.guessing: + e = BoolLiteralExpression(ToLexicalInfo(f), Value: false) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def null_literal() as NullLiteralExpression : //throws RecognitionException, TokenStreamException + e as NullLiteralExpression + + t as IToken = null + + try: // for error handling + t = LT(1) + match(NULL) + if 0 == inputState.guessing: + e = NullLiteralExpression(ToLexicalInfo(t)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def double_literal() as DoubleLiteralExpression : //throws RecognitionException, TokenStreamException + rle as DoubleLiteralExpression + + value as IToken = null + + try: // for error handling + value = LT(1) + match(DOUBLE) + if 0 == inputState.guessing: + rle = DoubleLiteralExpression(ToLexicalInfo(value), + ParseDouble(value.getText()), + IsSingle: true); + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return rle + + public def attribute_parameter_value_bitwise_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + op as IToken = null + + try: // for error handling + e=attribute_parameter_value_reference_expression() + while true: + if ((LA(1)==BITWISE_OR)): + op = LT(1) + match(BITWISE_OR) + rhs=attribute_parameter_value_reference_expression() + if 0 == inputState.guessing: + e = BinaryExpression(ToLexicalInfo(op), + Operator: BinaryOperatorType.BitwiseOr, + Left: e, + Right: rhs) + else: + goto _loop10_breakloop + :_loop10_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_11_) + else: + raise + return e + + public def typeof_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + t as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == TYPEOF)): // 1831 + t = LT(1) + match(TYPEOF) + if ((LA(1)==LPAREN) and (tokenSet_13_.member(cast(int, LA(2))))): + match(LPAREN) + arg=expression() + match(RPAREN) + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + arg=expression() + else: + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + mie = MethodInvocationExpression(ToLexicalInfo(t)); + mie.Target = ReferenceExpression(ToLexicalInfo(t), Name: t.getText()) + mie.Arguments.Add(arg) + e = mie + elif ((_givenValue == FUNCTION) + or (_givenValue ==ID) + or (_givenValue ==LPAREN) + ): // 1827 + _givenValue = LA(1) + if ((_givenValue == LPAREN)): // 1831 + match(LPAREN) + tr=type_reference() + match(RPAREN) + elif ((_givenValue == FUNCTION) + or (_givenValue ==ID) + ): // 1827 + tr=type_reference() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + e = TypeofExpression(ToLexicalInfo(t), tr); + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def attribute_parameter_value_reference_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + e=reference_expression() + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_14_) + else: + raise + return e + + public def reference_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + lbrack as IToken = null + + try: // for error handling + e=simple_reference_expression() + while true: + if ((LA(1)==DOT)): + match(DOT) + _givenValue = LA(1) + if ((_givenValue == GET) + or (_givenValue ==SET) + or (_givenValue ==ID) + ): // 1827 + memberName=member() + if 0 == inputState.guessing: + e = MemberReferenceExpression(ToLexicalInfo(memberName), Target: e, Name: memberName.getText()) + elif ((_givenValue == LESS_THAN)): // 1831 + lbrack = LT(1) + match(LESS_THAN) + if 0 == inputState.guessing: + e = gre = GenericReferenceExpression(ToLexicalInfo(lbrack), Target: e) + genericArguments = gre.GenericArguments + type_reference_list(genericArguments) + match(GREATER_THAN) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + else: + goto _loop196_breakloop + :_loop196_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + return e + + public def attribute_parameter( + attr as Ast.Attribute + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + synPredMatched14 as bool = false + if ((LA(1)==ID) and (LA(2)==DOT or LA(2)==ASSIGN)): + _m14 as int = mark() + synPredMatched14 = true + ++inputState.guessing + try: + match(ID) + match(ASSIGN) + except x as RecognitionException: + synPredMatched14 = false + rewind(_m14) + --inputState.guessing + if synPredMatched14: + name=reference_expression() + match(ASSIGN) + value=attribute_parameter_value() + if 0 == inputState.guessing: + attr.NamedArguments.Add(ExpressionPair(name, value)) + elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + value=attribute_parameter_value() + if 0 == inputState.guessing: + attr.Arguments.Add(value) + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_11_) + else: + raise + + public def attribute() as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + match(AT) + attr=attribute_constructor() + if 0 == inputState.guessing: + _attributes.Add(attr) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_18_) + else: + raise + + public def attribute_constructor() as Boo.Lang.Compiler.Ast.Attribute : //throws RecognitionException, TokenStreamException + attr as Boo.Lang.Compiler.Ast.Attribute + + + try: // for error handling + name=qname() + if 0 == inputState.guessing: + attr = Ast.Attribute(ToLexicalInfo(name), name.getText()) + if ((LA(1)==LPAREN) and (tokenSet_19_.member(cast(int, LA(2))))): + match(LPAREN) + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NULL) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LPAREN) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + attribute_parameter(attr) + while true: + if ((LA(1)==COMMA)): + match(COMMA) + attribute_parameter(attr) + else: + goto _loop25_breakloop + :_loop25_breakloop + elif ((_givenValue == RPAREN)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RPAREN) + elif ((tokenSet_20_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_20_) + else: + raise + return attr + + public def qname() as Token : //throws RecognitionException, TokenStreamException + id as Token + + start as IToken = null + other as IToken = null + + try: // for error handling + start = LT(1) + match(ID) + if 0 == inputState.guessing: + id = start + buffer = StringBuilder() + buffer.Append(start.getText()) + while true: + if ((LA(1)==DOT) and (LA(2)==ID)): + match(DOT) + other = LT(1) + match(ID) + if 0 == inputState.guessing: + buffer.Append(".") + buffer.Append(other.getText()) + else: + goto _loop38_breakloop + :_loop38_breakloop + if 0 == inputState.guessing: + id.setText(buffer.ToString()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_22_) + else: + raise + return id + + public def class_declaration( + parent as TypeDefinition + ) as void: //throws RecognitionException, TokenStreamException + + p as IToken = null + name as IToken = null + rbrace as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == PARTIAL)): // 1831 + p = LT(1) + match(PARTIAL) + elif ((_givenValue == CLASS)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(CLASS) + name = LT(1) + match(ID) + _givenValue = LA(1) + if ((_givenValue == EXTENDS)): // 1831 + match(EXTENDS) + baseType=type_reference() + elif ((_givenValue == IMPLEMENTS) + or (_givenValue ==LBRACE) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + cd = ClassDefinition(ToLexicalInfo(name), Name: name.getText()) + baseTypes = cd.BaseTypes + if baseType is not null: + baseTypes.Add(baseType) + cd.Modifiers |= TypeMemberModifiers.Partial if p is not null + FlushAttributes(cd) + parent.Members.Add(cd) + _givenValue = LA(1) + if ((_givenValue == IMPLEMENTS)): // 1831 + match(IMPLEMENTS) + type_reference_list(baseTypes) + elif ((_givenValue == LBRACE)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + for typeRef in baseTypes: + if typeRef is baseType: + BaseTypeAnnotations.AnnotateExtends(typeRef) + else: + BaseTypeAnnotations.AnnotateImplements(typeRef) + match(LBRACE) + while true: + if ((tokenSet_23_.member(cast(int, LA(1))))): + if 0 == inputState.guessing: + mod = TypeMemberModifiers.None + _givenValue = LA(1) + if ((_givenValue == AT)): // 1831 + attributes() + elif ((_givenValue == FINAL) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==PUBLIC) + or (_givenValue ==PROTECTED) + or (_givenValue ==INTERNAL) + or (_givenValue ==OVERRIDE) + or (_givenValue ==PRIVATE) + or (_givenValue ==STATIC) + or (_givenValue ==VAR) + or (_givenValue ==VIRTUAL) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): + mod=member_modifiers() + elif ((LA(1)==FUNCTION or LA(1)==VAR) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + _givenValue = LA(1) + if ((_givenValue == FUNCTION)): // 1831 + m=function_member(cd) + elif ((_givenValue == VAR)): // 1831 + m=field_member(cd) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + m.Modifiers |= mod if m is not null + else: + goto _loop59_breakloop + :_loop59_breakloop + rbrace = LT(1) + match(RBRACE) + if 0 == inputState.guessing: + SetEndSourceLocation(cd, rbrace) + while true: + if ((LA(1)==EOS)): + match(EOS) + else: + goto _loop61_breakloop + :_loop61_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_7_) + else: + raise + + public def interface_declaration( + parent as TypeDefinition + ) as void: //throws RecognitionException, TokenStreamException + + name as IToken = null + rbrace as IToken = null + + try: // for error handling + match(INTERFACE) + name = LT(1) + match(ID) + if 0 == inputState.guessing: + td = InterfaceDefinition(ToLexicalInfo(name), Name: name.getText()) + baseTypes = td.BaseTypes + FlushAttributes(td) + parent.Members.Add(td) + _givenValue = LA(1) + if ((_givenValue == EXTENDS)): // 1831 + match(EXTENDS) + type_reference_list(baseTypes) + elif ((_givenValue == LBRACE)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(LBRACE) + while true: + if ((LA(1)==FUNCTION or LA(1)==AT)): + _givenValue = LA(1) + if ((_givenValue == AT)): // 1831 + attributes() + elif ((_givenValue == FUNCTION)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + interface_member(td) + else: + goto _loop66_breakloop + :_loop66_breakloop + rbrace = LT(1) + match(RBRACE) + if 0 == inputState.guessing: + SetEndSourceLocation(td, rbrace) + while true: + if ((LA(1)==EOS)): + match(EOS) + else: + goto _loop68_breakloop + :_loop68_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_7_) + else: + raise + + public def enum_declaration( + container as TypeDefinition + ) as void: //throws RecognitionException, TokenStreamException + + name as IToken = null + rbrace as IToken = null + + try: // for error handling + match(ENUM) + name = LT(1) + match(ID) + if 0 == inputState.guessing: + ed = EnumDefinition(ToLexicalInfo(name), Name: name.getText()) + container.Members.Add(ed) + match(LBRACE) + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + enum_member(ed) + while true: + if ((LA(1)==COMMA) and (LA(2)==ID)): + match(COMMA) + enum_member(ed) + else: + goto _loop77_breakloop + :_loop77_breakloop + _givenValue = LA(1) + if ((_givenValue == COMMA)): // 1831 + match(COMMA) + elif ((_givenValue == RBRACE)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + elif ((_givenValue == RBRACE)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + rbrace = LT(1) + match(RBRACE) + if 0 == inputState.guessing: + SetEndSourceLocation(ed, rbrace) + while true: + if ((LA(1)==EOS)): + match(EOS) + else: + goto _loop80_breakloop + :_loop80_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_7_) + else: + raise + + public def module_function_or_field( + m as Module + ) as void: //throws RecognitionException, TokenStreamException + + globals = m.Globals + + try: // for error handling + synPredMatched30 as bool = false + if (((tokenSet_27_.member(cast(int, LA(1)))) and (tokenSet_28_.member(cast(int, LA(2))))) and (GlobalVariablesBecomeFields())): + _m30 as int = mark() + synPredMatched30 = true + ++inputState.guessing + try: + module_member_modifiers() + match(VAR) + except x as RecognitionException: + synPredMatched30 = false + rewind(_m30) + --inputState.guessing + if synPredMatched30: + module_field(m) + elif ((LA(1)==VAR) and (LA(2)==ID)): // line 2102 + declaration_statement(globals) + eos() + elif ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_30_.member(cast(int, LA(2))))): // line 2102 + module_function(m) + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_7_) + else: + raise + + public def script_attribute( + m as Module + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + match(SCRIPT_ATTRIBUTE_MARKER) + attr=attribute_constructor() + if 0 == inputState.guessing: + m.Attributes.Add(attr); + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_7_) + else: + raise + + public def module_member_modifiers() as TypeMemberModifiers : //throws RecognitionException, TokenStreamException + m as TypeMemberModifiers + + v as IToken = null + m = TypeMemberModifiers.None + + try: // for error handling + while true: + _givenValue = LA(1) + if ((_givenValue == FINAL)): // 1831 + match(FINAL) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Final + elif ((_givenValue == PUBLIC)): // 1831 + match(PUBLIC) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Public + elif ((_givenValue == PRIVATE)): // 1831 + match(PRIVATE) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Private + elif ((_givenValue == PROTECTED)): // 1831 + match(PROTECTED) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Protected + elif ((_givenValue == INTERNAL)): // 1831 + match(INTERNAL) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Internal + elif ((_givenValue == STATIC)): // 1831 + match(STATIC) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Static + elif ((_givenValue == VIRTUAL)): // 1831 + v = LT(1) + match(VIRTUAL) + if 0 == inputState.guessing: + VirtualKeywordHasNoEffect(v) + else: // line 1969 + goto _loop47_breakloop + :_loop47_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_31_) + else: + raise + return m + + public def module_field( + m as Module + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + mod=module_member_modifiers() + f=field_member(m) + if 0 == inputState.guessing: + f.Modifiers |= mod + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_7_) + else: + raise + + public def declaration_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + d=declaration() + _givenValue = LA(1) + if ((_givenValue == ASSIGN)): // 1831 + match(ASSIGN) + i=expression() + elif ((_givenValue == EOF) + or (_givenValue ==BREAK) + or (_givenValue ==CATCH) + or (_givenValue ==CLASS) + or (_givenValue ==CONTINUE) + or (_givenValue ==ELSE) + or (_givenValue ==ENUM) + or (_givenValue ==FALSE) + or (_givenValue ==FINAL) + or (_givenValue ==FINALLY) + or (_givenValue ==FOR) + or (_givenValue ==FUNCTION) + or (_givenValue ==IF) + or (_givenValue ==INTERFACE) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==RETURN) + or (_givenValue ==PUBLIC) + or (_givenValue ==PROTECTED) + or (_givenValue ==INTERNAL) + or (_givenValue ==PARTIAL) + or (_givenValue ==PRIVATE) + or (_givenValue ==STATIC) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==THROW) + or (_givenValue ==TRUE) + or (_givenValue ==TRY) + or (_givenValue ==TYPEOF) + or (_givenValue ==VAR) + or (_givenValue ==VIRTUAL) + or (_givenValue ==WHILE) + or (_givenValue ==YIELD) + or (_givenValue ==SWITCH) + or (_givenValue ==CASE) + or (_givenValue ==DEFAULT) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==RBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==EOS) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==AT) + or (_givenValue ==SCRIPT_ATTRIBUTE_MARKER) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + stmt = DeclarationStatement(d.LexicalInfo, Declaration: d, Initializer: i) + b.Add(stmt) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + + public def eos() as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + if ((LA(1)==EOS) and (tokenSet_33_.member(cast(int, LA(2))))): + _cnt44 as int = 0 + while true: + if ((LA(1)==EOS) and (tokenSet_33_.member(cast(int, LA(2))))): + match(EOS) + else: + if (_cnt44 >= 1): + goto _loop44_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) + ++_cnt44 + :_loop44_breakloop + elif ((tokenSet_33_.member(cast(int, LA(1)))) and (tokenSet_34_.member(cast(int, LA(2))))): // line 2102 + if 0 == inputState.guessing: + SemicolonExpected() + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_33_) + else: + raise + + public def module_function( + parent as TypeDefinition + ) as void: //throws RecognitionException, TokenStreamException + + name as IToken = null + + try: // for error handling + mod=module_member_modifiers() + match(FUNCTION) + name = LT(1) + match(ID) + if 0 == inputState.guessing: + method = Method(ToLexicalInfo(name), Name: name.getText()) + method.Modifiers = mod + FlushAttributes(method) + parent.Members.Add(method) + function_body(method) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_7_) + else: + raise + + public def field_member( + cd as TypeDefinition + ) as TypeMember : //throws RecognitionException, TokenStreamException + member as TypeMember + + + try: // for error handling + match(VAR) + name=member_name() + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + elif ((_givenValue == EOF) + or (_givenValue ==BREAK) + or (_givenValue ==CLASS) + or (_givenValue ==CONTINUE) + or (_givenValue ==ENUM) + or (_givenValue ==FALSE) + or (_givenValue ==FINAL) + or (_givenValue ==FINALLY) + or (_givenValue ==FOR) + or (_givenValue ==FUNCTION) + or (_givenValue ==IF) + or (_givenValue ==INTERFACE) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==RETURN) + or (_givenValue ==PUBLIC) + or (_givenValue ==PROTECTED) + or (_givenValue ==INTERNAL) + or (_givenValue ==OVERRIDE) + or (_givenValue ==PARTIAL) + or (_givenValue ==PRIVATE) + or (_givenValue ==STATIC) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==THROW) + or (_givenValue ==TRUE) + or (_givenValue ==TRY) + or (_givenValue ==TYPEOF) + or (_givenValue ==VAR) + or (_givenValue ==VIRTUAL) + or (_givenValue ==WHILE) + or (_givenValue ==YIELD) + or (_givenValue ==SWITCH) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==RBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==EOS) + or (_givenValue ==ASSIGN) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==AT) + or (_givenValue ==SCRIPT_ATTRIBUTE_MARKER) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + _givenValue = LA(1) + if ((_givenValue == ASSIGN)): // 1831 + match(ASSIGN) + initializer=expression() + elif ((_givenValue == EOF) + or (_givenValue ==BREAK) + or (_givenValue ==CLASS) + or (_givenValue ==CONTINUE) + or (_givenValue ==ENUM) + or (_givenValue ==FALSE) + or (_givenValue ==FINAL) + or (_givenValue ==FINALLY) + or (_givenValue ==FOR) + or (_givenValue ==FUNCTION) + or (_givenValue ==IF) + or (_givenValue ==INTERFACE) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==RETURN) + or (_givenValue ==PUBLIC) + or (_givenValue ==PROTECTED) + or (_givenValue ==INTERNAL) + or (_givenValue ==OVERRIDE) + or (_givenValue ==PARTIAL) + or (_givenValue ==PRIVATE) + or (_givenValue ==STATIC) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==THROW) + or (_givenValue ==TRUE) + or (_givenValue ==TRY) + or (_givenValue ==TYPEOF) + or (_givenValue ==VAR) + or (_givenValue ==VIRTUAL) + or (_givenValue ==WHILE) + or (_givenValue ==YIELD) + or (_givenValue ==SWITCH) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==RBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==EOS) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==AT) + or (_givenValue ==SCRIPT_ATTRIBUTE_MARKER) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + eos() + if 0 == inputState.guessing: + member = Field(ToLexicalInfo(name), + Name: name.getText(), + Type: tr, + Initializer: initializer) + FlushAttributes(member) + cd.Members.Add(member) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_35_) + else: + raise + return member + + public def while_statement( + container as Block + ) as void: //throws RecognitionException, TokenStreamException + + w as IToken = null + + try: // for error handling + w = LT(1) + match(WHILE) + e=paren_expression() + if 0 == inputState.guessing: + ws = WhileStatement(ToLexicalInfo(w), Condition: e) + b = ws.Block + container.Add(ws) + EnterLoop(ws) + compound_or_single_stmt(b) + if 0 == inputState.guessing: + LeaveLoop(ws) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + + public def for_statement( + container as Block + ) as void: //throws RecognitionException, TokenStreamException + + f as IToken = null + + try: // for error handling + f = LT(1) + match(FOR) + match(LPAREN) + synPredMatched127 as bool = false + if ((LA(1)==VAR or LA(1)==ID) and (LA(2)==IN or LA(2)==ID)): + _m127 as int = mark() + synPredMatched127 = true + ++inputState.guessing + try: + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + match(ID) + elif ((_givenValue == VAR)): // 1831 + declaration() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(IN) + except x as RecognitionException: + synPredMatched127 = false + rewind(_m127) + --inputState.guessing + if synPredMatched127: + stmt=for_in(container) + elif ((tokenSet_36_.member(cast(int, LA(1)))) and (tokenSet_37_.member(cast(int, LA(2))))): // line 2102 + stmt=for_c(container) + else: + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + stmt.LexicalInfo = ToLexicalInfo(f) if stmt is not null + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + + public def if_statement( + container as Block + ) as void: //throws RecognitionException, TokenStreamException + + it as IToken = null + et as IToken = null + + try: // for error handling + it = LT(1) + match(IF) + e=paren_expression() + if 0 == inputState.guessing: + s = IfStatement(ToLexicalInfo(it), Condition: e) + b = s.TrueBlock = Block() + container.Add(s) + compound_or_single_stmt(b) + if ((LA(1)==ELSE) and (tokenSet_38_.member(cast(int, LA(2))))): + et = LT(1) + match(ELSE) + if 0 == inputState.guessing: + b = s.FalseBlock = Block(ToLexicalInfo(et)) + compound_or_single_stmt(b) + elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + + public def try_statement( + container as Block + ) as void: //throws RecognitionException, TokenStreamException + + tt as IToken = null + ct as IToken = null + id as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == TRY)): // 1831 + tt = LT(1) + match(TRY) + if 0 == inputState.guessing: + s = TryStatement(ToLexicalInfo(tt)) + b = s.ProtectedBlock + container.Add(s) + compound_or_single_stmt(b) + _cnt154 as int = 0 + while true: + if ((LA(1)==CATCH) and (LA(2)==LPAREN)): + ct = LT(1) + match(CATCH) + match(LPAREN) + id = LT(1) + match(ID) + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + elif ((_givenValue == RPAREN)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RPAREN) + if 0 == inputState.guessing: + tr = SimpleTypeReference(ToLexicalInfo(id), "System.Exception") if tr is null + handler = ExceptionHandler( + ToLexicalInfo(ct), + Declaration: Declaration( + ToLexicalInfo(id), + Name: id.getText(), + Type: tr)) + s.ExceptionHandlers.Add(handler) + b = handler.Block + tr = null + compound_or_single_stmt(b) + else: + if (_cnt154 >= 1): + goto _loop154_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) + ++_cnt154 + :_loop154_breakloop + if ((LA(1)==FINALLY) and (tokenSet_38_.member(cast(int, LA(2))))): + finally_block(s) + elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + elif ((_givenValue == FINALLY)): // 1831 + finally_block(s) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + + public def switch_statement( + container as Block + ) as void: //throws RecognitionException, TokenStreamException + + s as IToken = null + c as IToken = null + fallthrough as IToken = null + d as IToken = null + + try: // for error handling + s = LT(1) + match(SWITCH) + e=paren_expression() + if 0 == inputState.guessing: + switchMacro = MacroStatement(ToLexicalInfo(s), Name: MacroName(s.getText())) + switchMacro.Arguments.Add(e) + switchBlock = switchMacro.Body + container.Add(switchMacro) + match(LBRACE) + while true: + if ((LA(1)==CASE)): + c = LT(1) + match(CASE) + e=expression() + match(COLON) + if 0 == inputState.guessing: + item = MacroStatement(ToLexicalInfo(c), Name: c.getText()) + item.Arguments.Add(e) + itemBlock = item.Body + switchBlock.Add(item) + while true: + if ((LA(1)==CASE)): + fallthrough = LT(1) + match(CASE) + e=expression() + match(COLON) + if 0 == inputState.guessing: + item.Arguments.Add(e); + else: + goto _loop141_breakloop + :_loop141_breakloop + _cnt143 as int = 0 + while true: + if ((tokenSet_38_.member(cast(int, LA(1))))): + statement(itemBlock) + else: + if (_cnt143 >= 1): + goto _loop143_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) + ++_cnt143 + :_loop143_breakloop + else: + goto _loop144_breakloop + :_loop144_breakloop + _givenValue = LA(1) + if ((_givenValue == DEFAULT)): // 1831 + d = LT(1) + match(DEFAULT) + match(COLON) + if 0 == inputState.guessing: + item = MacroStatement(ToLexicalInfo(d), Name: d.getText()) + itemBlock = item.Body + switchBlock.Add(item) + _cnt147 as int = 0 + while true: + if ((tokenSet_38_.member(cast(int, LA(1))))): + statement(itemBlock) + else: + if (_cnt147 >= 1): + goto _loop147_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) + ++_cnt147 + :_loop147_breakloop + elif ((_givenValue == RBRACE)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RBRACE) + while true: + if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): + match(EOS) + else: + goto _loop149_breakloop + :_loop149_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + + public def expression_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + e=assignment_expression() + if 0 == inputState.guessing: + b.Add(ExpressionStatement(e)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + + public def yield_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + yt as IToken = null + + try: // for error handling + yt = LT(1) + match(YIELD) + if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_39_.member(cast(int, LA(2))))): + e=expression() + elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + b.Add(YieldStatement(ToLexicalInfo(yt), Expression: e)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + + public def return_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + ret as IToken = null + + try: // for error handling + ret = LT(1) + match(RETURN) + if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_39_.member(cast(int, LA(2))))): + e=expression() + elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + b.Add(ReturnStatement(ToLexicalInfo(ret), Expression: e)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + + public def break_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + t as IToken = null + + try: // for error handling + t = LT(1) + match(BREAK) + if 0 == inputState.guessing: + b.Add(BreakStatement(ToLexicalInfo(t))) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + + public def continue_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + t as IToken = null + + try: // for error handling + t = LT(1) + match(CONTINUE) + if 0 == inputState.guessing: + gotoLabel = GetCurrentLoopLabel() + if gotoLabel is not null: + // we might be inside a c style for statement + b.Add(GotoStatement(ToLexicalInfo(t), Label: ReferenceExpression(gotoLabel))) + else: + b.Add(ContinueStatement(ToLexicalInfo(t))) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + + public def throw_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + t as IToken = null + + try: // for error handling + t = LT(1) + match(THROW) + if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_39_.member(cast(int, LA(2))))): + e=expression() + elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + b.Add(RaiseStatement(ToLexicalInfo(t), Exception: e)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + + public def member_modifiers() as TypeMemberModifiers : //throws RecognitionException, TokenStreamException + m as TypeMemberModifiers + + v as IToken = null + m = TypeMemberModifiers.None + + try: // for error handling + while true: + _givenValue = LA(1) + if ((_givenValue == FINAL)): // 1831 + match(FINAL) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Final + elif ((_givenValue == OVERRIDE)): // 1831 + match(OVERRIDE) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Override + elif ((_givenValue == PUBLIC)): // 1831 + match(PUBLIC) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Public + elif ((_givenValue == PRIVATE)): // 1831 + match(PRIVATE) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Private + elif ((_givenValue == PROTECTED)): // 1831 + match(PROTECTED) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Protected + elif ((_givenValue == INTERNAL)): // 1831 + match(INTERNAL) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Internal + elif ((_givenValue == STATIC)): // 1831 + match(STATIC) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Static + elif ((_givenValue == NEW)): // 1831 + match(NEW) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.New + elif ((_givenValue == VIRTUAL)): // 1831 + v = LT(1) + match(VIRTUAL) + if 0 == inputState.guessing: + VirtualKeywordHasNoEffect(v) + else: // line 1969 + goto _loop50_breakloop + :_loop50_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_31_) + else: + raise + return m + + public def type_reference() as TypeReference : //throws RecognitionException, TokenStreamException + tr as TypeReference + + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + tr=simple_type_reference() + elif ((_givenValue == FUNCTION)): // 1831 + tr=anonymous_function_type() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if ((LA(1)==LBRACK) and (LA(2)==RBRACK)): + match(LBRACK) + match(RBRACK) + if 0 == inputState.guessing: + tr = ArrayTypeReference(tr.LexicalInfo, tr); + elif ((tokenSet_40_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_40_) + else: + raise + return tr + + public def type_reference_list( + typeReferences as TypeReferenceCollection + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + tr=type_reference() + if 0 == inputState.guessing: + typeReferences.Add(tr) + while true: + if ((LA(1)==COMMA)): + match(COMMA) + tr=type_reference() + if 0 == inputState.guessing: + typeReferences.Add(tr) + else: + goto _loop179_breakloop + :_loop179_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_42_) + else: + raise + + public def function_member( + cd as ClassDefinition + ) as TypeMember : //throws RecognitionException, TokenStreamException + member as TypeMember + + getter as IToken = null + setter as IToken = null + + try: // for error handling + match(FUNCTION) + _givenValue = LA(1) + if ((_givenValue == GET)): // 1831 + getter = LT(1) + match(GET) + elif ((_givenValue == SET)): // 1831 + setter = LT(1) + match(SET) + elif ((_givenValue == FINAL) + or (_givenValue ==ID) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + memberName=member_name() + if 0 == inputState.guessing: + method as Method + if memberName.getText() == cd.Name: + member = method = Constructor(ToLexicalInfo(memberName)) + else: + member = method = Method(ToLexicalInfo(memberName), Name: memberName.getText()) + if getter is not null or setter is not null: + p = cd.Members[memberName.getText()] as Property + if p is null: + p = Property(ToLexicalInfo(memberName), Name: memberName.getText()) + cd.Members.Add(p) + if getter is not null: + p.Getter = method + else: + p.Setter = method + FlushAttributes(p) + else: + cd.Members.Add(method) + FlushAttributes(method) + function_body(method) + if 0 == inputState.guessing: + // TODO: move this error checking to a compiler step + // as well as properly checking the type of the accessors + // against the type of the property + if setter is not null: + if method.Parameters.Count != 1 or method.Parameters[0].Name != "value": + ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(ToLexicalInfo(memberName))) + method.Parameters.Clear() + if getter is not null: + if method.Parameters.Count > 0: + ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(ToLexicalInfo(memberName))) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_43_) + else: + raise + return member + + public def interface_member( + parent as TypeDefinition + ) as void: //throws RecognitionException, TokenStreamException + + name as IToken = null + + try: // for error handling + match(FUNCTION) + name = LT(1) + match(ID) + if 0 == inputState.guessing: + method = Method(ToLexicalInfo(name), Name: name.getText()) + FlushAttributes(method) + parent.Members.Add(method) + match(LPAREN) + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + parameter_declaration_list(method) + elif ((_givenValue == RPAREN)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RPAREN) + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + if 0 == inputState.guessing: + method.ReturnType = tr; + elif ((_givenValue == FUNCTION) + or (_givenValue ==RBRACE) + or (_givenValue ==EOS) + or (_givenValue ==AT) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + while true: + if ((LA(1)==EOS)): + match(EOS) + else: + goto _loop73_breakloop + :_loop73_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_44_) + else: + raise + + public def parameter_declaration_list( + m as INodeWithParameters + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + parameter_declaration(m) + while true: + if ((LA(1)==COMMA)): + match(COMMA) + parameter_declaration(m) + else: + goto _loop95_breakloop + :_loop95_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_45_) + else: + raise + + public def enum_member( + container as EnumDefinition + ) as void: //throws RecognitionException, TokenStreamException + + name as IToken = null + + try: // for error handling + name = LT(1) + match(ID) + _givenValue = LA(1) + if ((_givenValue == ASSIGN)): // 1831 + match(ASSIGN) + initializer=integer_literal() + elif ((_givenValue == RBRACE) + or (_givenValue ==COMMA) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + em = EnumMember(ToLexicalInfo(name), + Name: name.getText(), + Initializer: initializer) + container.Members.Add(em) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_46_) + else: + raise + + public def member_name() as antlr.IToken : //throws RecognitionException, TokenStreamException + token as antlr.IToken + + name as IToken = null + f as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + name = LT(1) + match(ID) + if 0 == inputState.guessing: + token = name; + elif ((_givenValue == FINAL)): // 1831 + f = LT(1) + match(FINAL) + if 0 == inputState.guessing: + token = f; KeywordCannotBeUsedAsAnIdentifier(token); + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_47_) + else: + raise + return token + + public def expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + e=conditional_expression() + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def function_body( + method as Method + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + match(LPAREN) + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + parameter_declaration_list(method) + elif ((_givenValue == RPAREN)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RPAREN) + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + if 0 == inputState.guessing: + method.ReturnType = tr; + elif ((_givenValue == LBRACE)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + compound_statement(method.Body) + if 0 == inputState.guessing: + method.EndSourceLocation = method.Body.EndSourceLocation + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_35_) + else: + raise + + public def compound_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + block(b) + while true: + if ((LA(1)==EOS) and (tokenSet_48_.member(cast(int, LA(2))))): + match(EOS) + else: + goto _loop101_breakloop + :_loop101_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_48_) + else: + raise + + public def parameter_declaration( + m as INodeWithParameters + ) as void: //throws RecognitionException, TokenStreamException + + id as IToken = null + + try: // for error handling + id = LT(1) + match(ID) + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + elif ((_givenValue == RPAREN) + or (_givenValue ==COMMA) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + parameter = ParameterDeclaration(ToLexicalInfo(id), Name: id.getText(), Type: tr) + m.Parameters.Add(parameter) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_11_) + else: + raise + + public def compound_or_single_stmt( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + if ((LA(1)==LBRACE) and (tokenSet_49_.member(cast(int, LA(2))))): + compound_statement(b) + elif ((tokenSet_38_.member(cast(int, LA(1)))) and (tokenSet_50_.member(cast(int, LA(2))))): // line 2102 + statement(b) + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + + public def statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == FINALLY) + or (_givenValue ==FOR) + or (_givenValue ==IF) + or (_givenValue ==TRY) + or (_givenValue ==WHILE) + or (_givenValue ==SWITCH) + ): // 1827 + _givenValue = LA(1) + if ((_givenValue == WHILE)): // 1831 + while_statement(b) + elif ((_givenValue == FOR)): // 1831 + for_statement(b) + elif ((_givenValue == IF)): // 1831 + if_statement(b) + elif ((_givenValue == FINALLY) + or (_givenValue ==TRY) + ): // 1827 + try_statement(b) + elif ((_givenValue == SWITCH)): // 1831 + switch_statement(b) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + elif ((_givenValue == BREAK) + or (_givenValue ==CONTINUE) + or (_givenValue ==FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==RETURN) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==THROW) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==VAR) + or (_givenValue ==YIELD) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + expression_statement(b) + elif ((_givenValue == YIELD)): // 1831 + yield_statement(b) + elif ((_givenValue == RETURN)): // 1831 + return_statement(b) + elif ((_givenValue == BREAK)): // 1831 + break_statement(b) + elif ((_givenValue == CONTINUE)): // 1831 + continue_statement(b) + elif ((_givenValue == THROW)): // 1831 + throw_statement(b) + elif ((_givenValue == VAR)): // 1831 + declaration_statement(b) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + eos() + elif ((_givenValue == EOS)): // 1831 + _cnt111 as int = 0 + while true: + if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): + match(EOS) + else: + if (_cnt111 >= 1): + goto _loop111_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) + ++_cnt111 + :_loop111_breakloop + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + + public def block( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + rbrace as IToken = null + + try: // for error handling + match(LBRACE) + while true: + if ((tokenSet_38_.member(cast(int, LA(1))))): + statement(b) + else: + goto _loop104_breakloop + :_loop104_breakloop + rbrace = LT(1) + match(RBRACE) + if 0 == inputState.guessing: + SetEndSourceLocation(b, rbrace) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + + public def declaration() as Declaration : //throws RecognitionException, TokenStreamException + d as Declaration + + id as IToken = null + + try: // for error handling + match(VAR) + id = LT(1) + match(ID) + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + elif ((_givenValue == EOF) + or (_givenValue ==BREAK) + or (_givenValue ==CATCH) + or (_givenValue ==CLASS) + or (_givenValue ==CONTINUE) + or (_givenValue ==ELSE) + or (_givenValue ==ENUM) + or (_givenValue ==FALSE) + or (_givenValue ==FINAL) + or (_givenValue ==FINALLY) + or (_givenValue ==FOR) + or (_givenValue ==FUNCTION) + or (_givenValue ==IF) + or (_givenValue ==IN) + or (_givenValue ==INTERFACE) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==RETURN) + or (_givenValue ==PUBLIC) + or (_givenValue ==PROTECTED) + or (_givenValue ==INTERNAL) + or (_givenValue ==PARTIAL) + or (_givenValue ==PRIVATE) + or (_givenValue ==STATIC) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==THROW) + or (_givenValue ==TRUE) + or (_givenValue ==TRY) + or (_givenValue ==TYPEOF) + or (_givenValue ==VAR) + or (_givenValue ==VIRTUAL) + or (_givenValue ==WHILE) + or (_givenValue ==YIELD) + or (_givenValue ==SWITCH) + or (_givenValue ==CASE) + or (_givenValue ==DEFAULT) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==RBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==EOS) + or (_givenValue ==ASSIGN) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==AT) + or (_givenValue ==SCRIPT_ATTRIBUTE_MARKER) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + d = Declaration(ToLexicalInfo(id)) + d.Name = id.getText() + d.Type = tr + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_51_) + else: + raise + return d + + public def assignment_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + a as IToken = null + ipa as IToken = null + ips as IToken = null + ipm as IToken = null + ipd as IToken = null + ipbo as IToken = null + ipba as IToken = null + ipxo as IToken = null + ipsl as IToken = null + ipsr as IToken = null + + try: // for error handling + e=conditional_expression() + _givenValue = LA(1) + if ((_givenValue == INPLACE_DIVISION) + or (_givenValue ==INPLACE_ADD) + or (_givenValue ==INPLACE_SUBTRACT) + or (_givenValue ==INPLACE_MULTIPLY) + or (_givenValue ==INPLACE_BITWISE_OR) + or (_givenValue ==INPLACE_BITWISE_AND) + or (_givenValue ==ASSIGN) + or (_givenValue ==INPLACE_SHIFT_LEFT) + or (_givenValue ==INPLACE_SHIFT_RIGHT) + or (_givenValue ==INPLACE_BITWISE_XOR) + ): // 1827 + _givenValue = LA(1) + if ((_givenValue == ASSIGN)): // 1831 + a = LT(1) + match(ASSIGN) + if 0 == inputState.guessing: + token = a; op = BinaryOperatorType.Assign + elif ((_givenValue == INPLACE_ADD)): // 1831 + ipa = LT(1) + match(INPLACE_ADD) + if 0 == inputState.guessing: + token = ipa; op = BinaryOperatorType.InPlaceAddition + elif ((_givenValue == INPLACE_SUBTRACT)): // 1831 + ips = LT(1) + match(INPLACE_SUBTRACT) + if 0 == inputState.guessing: + token = ips; op = BinaryOperatorType.InPlaceSubtraction + elif ((_givenValue == INPLACE_MULTIPLY)): // 1831 + ipm = LT(1) + match(INPLACE_MULTIPLY) + if 0 == inputState.guessing: + token = ipm; op = BinaryOperatorType.InPlaceMultiply + elif ((_givenValue == INPLACE_DIVISION)): // 1831 + ipd = LT(1) + match(INPLACE_DIVISION) + if 0 == inputState.guessing: + token = ipd; op = BinaryOperatorType.InPlaceDivision + elif ((_givenValue == INPLACE_BITWISE_OR)): // 1831 + ipbo = LT(1) + match(INPLACE_BITWISE_OR) + if 0 == inputState.guessing: + token = ipbo; op = BinaryOperatorType.InPlaceBitwiseOr + elif ((_givenValue == INPLACE_BITWISE_AND)): // 1831 + ipba = LT(1) + match(INPLACE_BITWISE_AND) + if 0 == inputState.guessing: + token = ipba; op = BinaryOperatorType.InPlaceBitwiseAnd + elif ((_givenValue == INPLACE_BITWISE_XOR)): // 1831 + ipxo = LT(1) + match(INPLACE_BITWISE_XOR) + if 0 == inputState.guessing: + token = ipxo; op = BinaryOperatorType.InPlaceExclusiveOr + elif ((_givenValue == INPLACE_SHIFT_LEFT)): // 1831 + ipsl = LT(1) + match(INPLACE_SHIFT_LEFT) + if 0 == inputState.guessing: + token = ipsl; op = BinaryOperatorType.InPlaceShiftLeft + elif ((_givenValue == INPLACE_SHIFT_RIGHT)): // 1831 + ipsr = LT(1) + match(INPLACE_SHIFT_RIGHT) + if 0 == inputState.guessing: + token = ipsr; op = BinaryOperatorType.InPlaceShiftRight + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + r=assignment_expression() + if 0 == inputState.guessing: + be = BinaryExpression(ToLexicalInfo(token)) + be.Operator = op + be.Left = e + be.Right = r + e = be + elif ((_givenValue == EOF) + or (_givenValue ==BREAK) + or (_givenValue ==CATCH) + or (_givenValue ==CLASS) + or (_givenValue ==CONTINUE) + or (_givenValue ==ELSE) + or (_givenValue ==ENUM) + or (_givenValue ==FALSE) + or (_givenValue ==FINAL) + or (_givenValue ==FINALLY) + or (_givenValue ==FOR) + or (_givenValue ==FUNCTION) + or (_givenValue ==IF) + or (_givenValue ==INTERFACE) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==RETURN) + or (_givenValue ==PUBLIC) + or (_givenValue ==PROTECTED) + or (_givenValue ==INTERNAL) + or (_givenValue ==PARTIAL) + or (_givenValue ==PRIVATE) + or (_givenValue ==STATIC) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==THROW) + or (_givenValue ==TRUE) + or (_givenValue ==TRY) + or (_givenValue ==TYPEOF) + or (_givenValue ==VAR) + or (_givenValue ==VIRTUAL) + or (_givenValue ==WHILE) + or (_givenValue ==YIELD) + or (_givenValue ==SWITCH) + or (_givenValue ==CASE) + or (_givenValue ==DEFAULT) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==RBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==RPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==EOS) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==AT) + or (_givenValue ==SCRIPT_ATTRIBUTE_MARKER) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_52_) + else: + raise + return e + + public def for_in( + container as Block + ) as Statement : //throws RecognitionException, TokenStreamException + stmt as Statement + + id as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + id = LT(1) + match(ID) + if 0 == inputState.guessing: + d = Declaration(ToLexicalInfo(id), Name: id.getText()) + elif ((_givenValue == VAR)): // 1831 + d=declaration() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(IN) + iterator=expression() + if 0 == inputState.guessing: + fs = ForStatement(Iterator: iterator) + fs.Declarations.Add(d) + b = fs.Block + stmt = fs + container.Add(stmt) + EnterLoop(stmt) + match(RPAREN) + compound_or_single_stmt(b) + if 0 == inputState.guessing: + LeaveLoop(stmt) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + return stmt + + public def for_c( + container as Block + ) as Statement : //throws RecognitionException, TokenStreamException + stmt as Statement + + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == VAR)): // 1831 + declaration_statement(container) + if 0 == inputState.guessing: + stmt = container.Statements[-1] as DeclarationStatement + stmt.Annotate("PrivateScope") if stmt is not null + elif ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + expression_statement(container) + elif ((_givenValue == EOS)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(EOS) + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + condition=expression() + elif ((_givenValue == EOS)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(EOS) + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + update=assignment_expression() + elif ((_givenValue == RPAREN)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + ws = WhileStatement(Condition: condition) + if condition is null: + ws.Condition = BoolLiteralExpression(Value: true) + b = ws.Block + stmt = ws + // support for 'continue' + label = SetUpLoopLabel(ws) + container.Add(stmt) + EnterLoop(ws) + match(RPAREN) + compound_or_single_stmt(b) + if 0 == inputState.guessing: + LeaveLoop(ws) + if IsLabelInUse(ws): + b.Add(LabelStatement(Name: label)) + b.Add(update) if update is not null + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + return stmt + + public def paren_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + match(LPAREN) + e=expression() + match(RPAREN) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def finally_block( + s as TryStatement + ) as void: //throws RecognitionException, TokenStreamException + + ft as IToken = null + + try: // for error handling + ft = LT(1) + match(FINALLY) + if 0 == inputState.guessing: + finallyBlock = s.EnsureBlock = Block(ToLexicalInfo(ft)) + compound_or_single_stmt(finallyBlock) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + + public def conditional_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + qm as IToken = null + + try: // for error handling + e=logical_or() + if ((LA(1)==QUESTION_MARK) and (tokenSet_13_.member(cast(int, LA(2))))): + qm = LT(1) + match(QUESTION_MARK) + trueValue=logical_or() + match(COLON) + falseValue=conditional_expression() + if 0 == inputState.guessing: + e = ConditionalExpression(ToLexicalInfo(qm), + Condition: e, + TrueValue: trueValue, + FalseValue: falseValue) + elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def member() as Token : //throws RecognitionException, TokenStreamException + name as Token + + id as IToken = null + st as IToken = null + gt as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + id = LT(1) + match(ID) + if 0 == inputState.guessing: + name=id; + elif ((_givenValue == SET)): // 1831 + st = LT(1) + match(SET) + if 0 == inputState.guessing: + name=st; + elif ((_givenValue == GET)): // 1831 + gt = LT(1) + match(GET) + if 0 == inputState.guessing: + name=gt; + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return name + + public def simple_type_reference() as TypeReference : //throws RecognitionException, TokenStreamException + tr as TypeReference + + + try: // for error handling + typeName=qname() + if ((LA(1)==DOT) and (LA(2)==LESS_THAN)): + match(DOT) + match(LESS_THAN) + if 0 == inputState.guessing: + tr = gtr = GenericTypeReference(ToLexicalInfo(typeName), typeName.getText()); + arguments = gtr.GenericArguments + type_reference_list(arguments) + match(GREATER_THAN) + elif ((tokenSet_40_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 + if 0 == inputState.guessing: + tr = SimpleTypeReference(ToLexicalInfo(typeName), Name: typeName.getText()) + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_40_) + else: + raise + return tr + + public def anonymous_function_type() as TypeReference : //throws RecognitionException, TokenStreamException + tr as TypeReference + + fn as IToken = null + + try: // for error handling + fn = LT(1) + match(FUNCTION) + if 0 == inputState.guessing: + tr = callableTypeRef = CallableTypeReference(ToLexicalInfo(fn)) + parameters = callableTypeRef.Parameters + function_type_parameters(parameters) + if ((LA(1)==COLON) and (LA(2)==FUNCTION or LA(2)==ID)): + match(COLON) + returnType=type_reference() + if 0 == inputState.guessing: + callableTypeRef.ReturnType = returnType + elif ((tokenSet_40_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_40_) + else: + raise + return tr + + public def function_type_parameters( + parameters as ParameterDeclarationCollection + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + match(LPAREN) + _givenValue = LA(1) + if ((_givenValue == FUNCTION) + or (_givenValue ==ID) + ): // 1827 + parameterType=type_reference() + if 0 == inputState.guessing: + parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) + while true: + if ((LA(1)==COMMA)): + match(COMMA) + parameterType=type_reference() + if 0 == inputState.guessing: + parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) + else: + goto _loop171_breakloop + :_loop171_breakloop + elif ((_givenValue == RPAREN)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RPAREN) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_40_) + else: + raise + + public def array_initializer() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + tr=simple_type_reference() + match(LBRACK) + count=sum() + match(RBRACK) + if 0 == inputState.guessing: + e = CodeFactory.NewArrayInitializer(tr.LexicalInfo, tr, count) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def sum() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + add as IToken = null + sub as IToken = null + bOperator = BinaryOperatorType.None; + + try: // for error handling + e=term() + while true: + if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_13_.member(cast(int, LA(2))))): + _givenValue = LA(1) + if ((_givenValue == ADD)): // 1831 + add = LT(1) + match(ADD) + if 0 == inputState.guessing: + op=add; bOperator = BinaryOperatorType.Addition; + elif ((_givenValue == SUBTRACT)): // 1831 + sub = LT(1) + match(SUBTRACT) + if 0 == inputState.guessing: + op=sub; bOperator = BinaryOperatorType.Subtraction; + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + r=term() + if 0 == inputState.guessing: + be = BinaryExpression(ToLexicalInfo(op)) + be.Operator = bOperator + be.Left = e + be.Right = r + e = be + else: + goto _loop245_breakloop + :_loop245_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def new_array_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + match(NEW) + e=array_initializer() + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def new_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + synPredMatched183 as bool = false + if ((LA(1)==NEW) and (LA(2)==ID)): + _m183 as int = mark() + synPredMatched183 = true + ++inputState.guessing + try: + new_array_expression() + except x as RecognitionException: + synPredMatched183 = false + rewind(_m183) + --inputState.guessing + if synPredMatched183: + e=new_array_expression() + elif ((LA(1)==NEW) and (LA(2)==ID)): // line 2102 + match(NEW) + r=reference_expression() + if 0 == inputState.guessing: + e = mie = MethodInvocationExpression(r.LexicalInfo, Target: r) + args = mie.Arguments + match(LPAREN) + expression_list(args) + match(RPAREN) + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def expression_list( + ec as ExpressionCollection + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + e=expression() + if 0 == inputState.guessing: + ec.Add(e); + while true: + if ((LA(1)==COMMA)): + match(COMMA) + e=expression() + if 0 == inputState.guessing: + ec.Add(e); + else: + goto _loop211_breakloop + :_loop211_breakloop + elif ((_givenValue == RPAREN) + or (_givenValue ==RBRACK) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_54_) + else: + raise + + public def atom() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LBRACK) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + e=literal() + elif ((_givenValue == NEW)): // 1831 + e=new_expression() + else: // line 1969 + if ((LA(1)==FUNCTION) and (LA(2)==LPAREN)): + e=function_expression() + elif ((LA(1)==ID) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + e=simple_reference_expression() + elif ((LA(1)==LPAREN) and (tokenSet_13_.member(cast(int, LA(2))))): // line 2102 + e=paren_expression() + elif ((tokenSet_9_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + e=typeof_expression() + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def literal() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == INT) + or (_givenValue ==LONG) + ): // 1827 + e=integer_literal() + elif ((_givenValue == DOUBLE_QUOTED_STRING)): // 1831 + e=string_literal() + elif ((_givenValue == LBRACK)): // 1831 + e=array_literal() + elif ((_givenValue == LBRACE)): // 1831 + e=hash_literal() + elif ((_givenValue == RE_LITERAL)): // 1831 + e=re_literal() + elif ((_givenValue == FALSE) + or (_givenValue ==TRUE) + ): // 1827 + e=bool_literal() + elif ((_givenValue == NULL)): // 1831 + e=null_literal() + elif ((_givenValue == THIS)): // 1831 + e=self_literal() + elif ((_givenValue == SUPER)): // 1831 + e=super_literal() + elif ((_givenValue == DOUBLE)): // 1831 + e=double_literal() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def function_expression() as BlockExpression : //throws RecognitionException, TokenStreamException + e as BlockExpression + + fn as IToken = null + + try: // for error handling + fn = LT(1) + match(FUNCTION) + if 0 == inputState.guessing: + e = BlockExpression(ToLexicalInfo(fn)) + body = e.Body + match(LPAREN) + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + parameter_declaration_list(e) + elif ((_givenValue == RPAREN)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RPAREN) + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + if 0 == inputState.guessing: + e.ReturnType = tr; + elif ((_givenValue == LBRACE)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + block(body) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def simple_reference_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + id as IToken = null + + try: // for error handling + id = LT(1) + match(ID) + if 0 == inputState.guessing: + e = ReferenceExpression(ToLexicalInfo(id), Name: id.getText()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def slice( + se as SlicingExpression + ) as void: //throws RecognitionException, TokenStreamException + + begin as Expression + end as Expression + step as Expression + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + if 0 == inputState.guessing: + begin = OmittedExpression.Default; + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + end=expression() + elif ((_givenValue == COLON)): // 1831 + match(COLON) + if 0 == inputState.guessing: + end = OmittedExpression.Default; + step=expression() + elif ((_givenValue == COMMA) + or (_givenValue ==RBRACK) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + elif ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + begin=expression() + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + end=expression() + elif ((_givenValue == COLON) + or (_givenValue ==COMMA) + or (_givenValue ==RBRACK) + ): // 1827 + if 0 == inputState.guessing: + end = OmittedExpression.Default; + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + step=expression() + elif ((_givenValue == COMMA) + or (_givenValue ==RBRACK) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + elif ((_givenValue == COMMA) + or (_givenValue ==RBRACK) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + se.Indices.Add(Slice(begin, end, step)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_55_) + else: + raise + + public def slicing_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + lbrack as IToken = null + lparen as IToken = null + se as SlicingExpression + mce as MethodInvocationExpression + args as ExpressionCollection + memberName as IToken + + try: // for error handling + e=atom() + while true: + if ((LA(1)==LBRACK) and (tokenSet_56_.member(cast(int, LA(2))))): + lbrack = LT(1) + match(LBRACK) + if 0 == inputState.guessing: + se = SlicingExpression(ToLexicalInfo(lbrack)) + se.Target = e + e = se + slice(se) + while true: + if ((LA(1)==COMMA)): + match(COMMA) + slice(se) + else: + goto _loop227_breakloop + :_loop227_breakloop + match(RBRACK) + elif ((LA(1)==DOT) and (LA(2)==GET or LA(2)==SET or LA(2)==ID)): // line 2102 + match(DOT) + memberName=member() + if 0 == inputState.guessing: + e = MemberReferenceExpression(ToLexicalInfo(memberName), Target: e, Name: memberName.getText()) + elif ((LA(1)==LPAREN) and (tokenSet_57_.member(cast(int, LA(2))))): // line 2102 + lparen = LT(1) + match(LPAREN) + if 0 == inputState.guessing: + mce = MethodInvocationExpression(ToLexicalInfo(lparen)) + mce.Target = e + e = mce + args = mce.Arguments + expression_list(args) + match(RPAREN) + else: + goto _loop230_breakloop + :_loop230_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def postfix_unary_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + postinc as IToken = null + preinc as IToken = null + + try: // for error handling + e=slicing_expression() + if ((LA(1)==INCREMENT) and (tokenSet_12_.member(cast(int, LA(2))))): + postinc = LT(1) + match(INCREMENT) + if 0 == inputState.guessing: + token = postinc; operator = UnaryOperatorType.PostIncrement; + elif ((LA(1)==DECREMENT) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + preinc = LT(1) + match(DECREMENT) + if 0 == inputState.guessing: + token = preinc; operator= UnaryOperatorType.PostDecrement; + elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + e = UnaryExpression(ToLexicalInfo(token), operator, e) if token is not null + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def unary_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + sub as IToken = null + inc as IToken = null + dec as IToken = null + nt as IToken = null + oc as IToken = null + t as IToken = null + uOperator = UnaryOperatorType.None + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + ): // 1827 + _givenValue = LA(1) + if ((_givenValue == SUBTRACT)): // 1831 + sub = LT(1) + match(SUBTRACT) + if 0 == inputState.guessing: + op = sub; uOperator = UnaryOperatorType.UnaryNegation; + elif ((_givenValue == INCREMENT)): // 1831 + inc = LT(1) + match(INCREMENT) + if 0 == inputState.guessing: + op = inc; uOperator = UnaryOperatorType.Increment; + elif ((_givenValue == DECREMENT)): // 1831 + dec = LT(1) + match(DECREMENT) + if 0 == inputState.guessing: + op = dec; uOperator = UnaryOperatorType.Decrement; + elif ((_givenValue == NOT)): // 1831 + nt = LT(1) + match(NOT) + if 0 == inputState.guessing: + op = nt; uOperator = UnaryOperatorType.LogicalNot; + elif ((_givenValue == BITWISE_NOT)): // 1831 + oc = LT(1) + match(BITWISE_NOT) + if 0 == inputState.guessing: + op = oc; uOperator = UnaryOperatorType.OnesComplement; + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + e=unary_expression() + if 0 == inputState.guessing: + e = UnaryExpression(ToLexicalInfo(op), uOperator, e) if op is not null + elif ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + e=postfix_unary_expression() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if ((LA(1)==AS) and (LA(2)==FUNCTION or LA(2)==ID)): + t = LT(1) + match(AS) + tr=type_reference() + if 0 == inputState.guessing: + e = TryCastExpression(ToLexicalInfo(t), Target: e, Type: tr) + elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def term() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + m as IToken = null + d as IToken = null + md as IToken = null + op = BinaryOperatorType.None + + try: // for error handling + e=unary_expression() + while true: + if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_13_.member(cast(int, LA(2))))): + _givenValue = LA(1) + if ((_givenValue == MULTIPLY)): // 1831 + m = LT(1) + match(MULTIPLY) + if 0 == inputState.guessing: + op=BinaryOperatorType.Multiply; token=m; + elif ((_givenValue == DIVISION)): // 1831 + d = LT(1) + match(DIVISION) + if 0 == inputState.guessing: + op=BinaryOperatorType.Division; token=d; + elif ((_givenValue == MODULUS)): // 1831 + md = LT(1) + match(MODULUS) + if 0 == inputState.guessing: + op=BinaryOperatorType.Modulus; token=md; + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + r=unary_expression() + if 0 == inputState.guessing: + be = BinaryExpression(ToLexicalInfo(token)) + be.Operator = op + be.Left = e + be.Right = r + e = be + else: + goto _loop241_breakloop + :_loop241_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def shift() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + sl as IToken = null + sr as IToken = null + + try: // for error handling + e=sum() + while true: + if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_13_.member(cast(int, LA(2))))): + _givenValue = LA(1) + if ((_givenValue == SHIFT_LEFT)): // 1831 + sl = LT(1) + match(SHIFT_LEFT) + if 0 == inputState.guessing: + op = BinaryOperatorType.ShiftLeft; token = sl + elif ((_givenValue == SHIFT_RIGHT)): // 1831 + sr = LT(1) + match(SHIFT_RIGHT) + if 0 == inputState.guessing: + op = BinaryOperatorType.ShiftRight; token = sr + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + r=sum() + if 0 == inputState.guessing: + e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) + else: + goto _loop249_breakloop + :_loop249_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def comparison() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + tin as IToken = null + tgt as IToken = null + tgte as IToken = null + tlt as IToken = null + tlte as IToken = null + tisa as IToken = null + r as Expression + op = BinaryOperatorType.None; + token as IToken + + try: // for error handling + e=shift() + while true: + if ((tokenSet_58_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): + _givenValue = LA(1) + if ((_givenValue == IN) + or (_givenValue ==LESS_THAN) + or (_givenValue ==LESS_THAN_OR_EQUAL) + or (_givenValue ==GREATER_THAN) + or (_givenValue ==GREATER_THAN_OR_EQUAL) + ): // 1827 + _givenValue = LA(1) + if ((_givenValue == IN)): // 1831 + tin = LT(1) + match(IN) + if 0 == inputState.guessing: + op = BinaryOperatorType.Member; token = tin; + elif ((_givenValue == GREATER_THAN)): // 1831 + tgt = LT(1) + match(GREATER_THAN) + if 0 == inputState.guessing: + op = BinaryOperatorType.GreaterThan; token = tgt; + elif ((_givenValue == GREATER_THAN_OR_EQUAL)): // 1831 + tgte = LT(1) + match(GREATER_THAN_OR_EQUAL) + if 0 == inputState.guessing: + op = BinaryOperatorType.GreaterThanOrEqual; token = tgte + elif ((_givenValue == LESS_THAN)): // 1831 + tlt = LT(1) + match(LESS_THAN) + if 0 == inputState.guessing: + op = BinaryOperatorType.LessThan; token = tlt; + elif ((_givenValue == LESS_THAN_OR_EQUAL)): // 1831 + tlte = LT(1) + match(LESS_THAN_OR_EQUAL) + if 0 == inputState.guessing: + op = BinaryOperatorType.LessThanOrEqual; token = tlte; + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + r=shift() + elif ((_givenValue == INSTANCEOF)): // 1831 + tisa = LT(1) + match(INSTANCEOF) + tr=type_reference() + if 0 == inputState.guessing: + op = BinaryOperatorType.TypeTest; + token = tisa; + r = TypeofExpression(tr.LexicalInfo, tr); + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + be = BinaryExpression(ToLexicalInfo(token)) + be.Operator = op + be.Left = e + be.Right = r + e = be + else: + goto _loop261_breakloop + :_loop261_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def equality() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + te as IToken = null + ti as IToken = null + re as IToken = null + rie as IToken = null + + try: // for error handling + e=comparison() + while true: + if ((tokenSet_59_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): + _givenValue = LA(1) + if ((_givenValue == EQUALITY)): // 1831 + te = LT(1) + match(EQUALITY) + if 0 == inputState.guessing: + op = BinaryOperatorType.Equality; token = te; + elif ((_givenValue == INEQUALITY)): // 1831 + ti = LT(1) + match(INEQUALITY) + if 0 == inputState.guessing: + op = BinaryOperatorType.Inequality; token = ti + elif ((_givenValue == REFERENCE_EQUALITY)): // 1831 + re = LT(1) + match(REFERENCE_EQUALITY) + if 0 == inputState.guessing: + op = BinaryOperatorType.ReferenceEquality; token = re + elif ((_givenValue == REFERENCE_INEQUALITY)): // 1831 + rie = LT(1) + match(REFERENCE_INEQUALITY) + if 0 == inputState.guessing: + op = BinaryOperatorType.ReferenceInequality; token = rie + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + r=comparison() + if 0 == inputState.guessing: + e = BinaryExpression(ToLexicalInfo(token), op, e, r) + else: + goto _loop269_breakloop + :_loop269_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def bitwise_and() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + token as IToken = null + + try: // for error handling + e=equality() + while true: + if ((LA(1)==BITWISE_AND) and (tokenSet_13_.member(cast(int, LA(2))))): + token = LT(1) + match(BITWISE_AND) + if 0 == inputState.guessing: + op = BinaryOperatorType.BitwiseAnd; + r=equality() + if 0 == inputState.guessing: + e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) + else: + goto _loop272_breakloop + :_loop272_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def bitwise_xor() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + token as IToken = null + + try: // for error handling + e=bitwise_and() + while true: + if ((LA(1)==BITWISE_XOR) and (tokenSet_13_.member(cast(int, LA(2))))): + token = LT(1) + match(BITWISE_XOR) + if 0 == inputState.guessing: + op = BinaryOperatorType.ExclusiveOr; + r=bitwise_and() + if 0 == inputState.guessing: + e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) + else: + goto _loop275_breakloop + :_loop275_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def bitwise_or() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + token as IToken = null + + try: // for error handling + e=bitwise_xor() + while true: + if ((LA(1)==BITWISE_OR) and (tokenSet_13_.member(cast(int, LA(2))))): + token = LT(1) + match(BITWISE_OR) + if 0 == inputState.guessing: + op = BinaryOperatorType.BitwiseOr; + r=bitwise_xor() + if 0 == inputState.guessing: + e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) + else: + goto _loop278_breakloop + :_loop278_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def logical_and() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + op as IToken = null + + try: // for error handling + e=bitwise_or() + while true: + if ((LA(1)==LOGICAL_AND) and (tokenSet_13_.member(cast(int, LA(2))))): + op = LT(1) + match(LOGICAL_AND) + rhs=bitwise_or() + if 0 == inputState.guessing: + e=BinaryExpression(ToLexicalInfo(op), + Operator: BinaryOperatorType.And, + Left: e, + Right: rhs) + else: + goto _loop281_breakloop + :_loop281_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def logical_or() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + op as IToken = null + + try: // for error handling + e=logical_and() + while true: + if ((LA(1)==LOGICAL_OR) and (tokenSet_13_.member(cast(int, LA(2))))): + op = LT(1) + match(LOGICAL_OR) + rhs=logical_and() + if 0 == inputState.guessing: + e = BinaryExpression(ToLexicalInfo(op), + Operator: BinaryOperatorType.Or, + Left: e, + Right: rhs) + else: + goto _loop284_breakloop + :_loop284_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def array_literal() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + lbrack as IToken = null + lle as ListLiteralExpression + + try: // for error handling + lbrack = LT(1) + match(LBRACK) + if 0 == inputState.guessing: + e = lle = ArrayLiteralExpression(ToLexicalInfo(lbrack)) + expression_list(lle.Items) + match(RBRACK) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def hash_literal() as HashLiteralExpression : //throws RecognitionException, TokenStreamException + dle as HashLiteralExpression + + lbrace as IToken = null + pair as ExpressionPair + + try: // for error handling + lbrace = LT(1) + match(LBRACE) + if 0 == inputState.guessing: + dle = HashLiteralExpression(ToLexicalInfo(lbrace)); + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 + pair=expression_pair() + if 0 == inputState.guessing: + dle.Items.Add(pair); + while true: + if ((LA(1)==COMMA)): + match(COMMA) + pair=expression_pair() + if 0 == inputState.guessing: + dle.Items.Add(pair); + else: + goto _loop293_breakloop + :_loop293_breakloop + elif ((_givenValue == RBRACE)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RBRACE) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return dle + + public def re_literal() as RELiteralExpression : //throws RecognitionException, TokenStreamException + re as RELiteralExpression + + value as IToken = null + + try: // for error handling + value = LT(1) + match(RE_LITERAL) + if 0 == inputState.guessing: + re = RELiteralExpression(ToLexicalInfo(value), value.getText()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return re + + public def self_literal() as SelfLiteralExpression : //throws RecognitionException, TokenStreamException + e as SelfLiteralExpression + + t as IToken = null + + try: // for error handling + t = LT(1) + match(THIS) + if 0 == inputState.guessing: + e = SelfLiteralExpression(ToLexicalInfo(t)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def super_literal() as SuperLiteralExpression : //throws RecognitionException, TokenStreamException + e as SuperLiteralExpression + + t as IToken = null + + try: // for error handling + t = LT(1) + match(SUPER) + if 0 == inputState.guessing: + e = SuperLiteralExpression(ToLexicalInfo(t)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + + public def expression_pair() as ExpressionPair : //throws RecognitionException, TokenStreamException + ep as ExpressionPair + + t as IToken = null + + try: // for error handling + key=expression() + t = LT(1) + match(COLON) + value=expression() + if 0 == inputState.guessing: + ep = ExpressionPair(ToLexicalInfo(t), key, value) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_46_) + else: + raise + return ep + + + public static final tokenNames_ = ( + '<0>', + 'EOF', + '<2>', + 'NULL_TREE_LOOKAHEAD', + 'as', + 'break', + 'catch', + 'class', + 'continue', + 'else', + 'enum', + 'extends', + 'false', + 'final', + 'finally', + 'for', + 'function', + 'get', + 'if', + 'import', + 'implements', + 'in', + 'interface', + 'instanceof', + 'new', + 'null', + 'return', + 'public', + 'protected', + 'internal', + 'override', + 'partial', + 'pragma', + 'private', + 'set', + 'static', + 'super', + 'this', + 'throw', + 'true', + 'try', + 'typeof', + 'var', + 'virtual', + 'while', + 'yield', + 'switch', + 'case', + 'default', + '/=', + '+=', + '-=', + '*=', + 'an identifier', + 'a string', + '{', + '}', + '(', + ')', + '.', + ':', + ',', + '[', + ']', + '|', + '|=', + '&', + '^', + '&=', + '||', + '&&', + ';', + '=', + '++', + '--', + '+', + '-', + '%', + '*', + '==', + '!=', + '?', + '~', + '===', + '!==', + '<', + '<=', + '<<', + '<<=', + '>', + '>=', + '>>', + '>>=', + '@', + '@script', + 'HASH', + 'INPLACE_BITWISE_XOR', + 'NOT', + 'DIVISION', + 'RE_LITERAL', + 'DOUBLE', + 'INT', + 'LONG', + 'DOUBLE_SUFFIX', + 'EXPONENT', + 'WHITE_SPACE', + 'DQS_ESC', + 'SQS_ESC', + 'SESC', + 'ML_COMMENT', + 'RE_CHAR', + 'RE_ESC', + 'NEWLINE', + 'ID_LETTER', + 'DIGIT', + 'HEXDIGIT', + ) + + private static def mk_tokenSet_0_() as (long): + data = (13240180483200L, 1073741824L, 0L, 0L, ) + return data + public static final tokenSet_0_ = BitSet(mk_tokenSet_0_()) + private static def mk_tokenSet_1_() as (long): + data = (9020437283545216L, 0L, ) + return data + public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) + private static def mk_tokenSet_2_() as (long): + data = (4818983474080108832L, 523986277888L, 0L, 0L, ) + return data + public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) + private static def mk_tokenSet_3_() as (long): + data = (-3747417124987603534L, 547608330239L, 0L, 0L, ) + return data + public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) + private static def mk_tokenSet_4_() as (long): + data = (2L, 0L, ) + return data + public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) + private static def mk_tokenSet_5_() as (long): + data = (4818992316214539682L, 527744374272L, 0L, 0L, ) + return data + public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) + private static def mk_tokenSet_6_() as (long): + data = (13241271002240L, 1073741824L, 0L, 0L, ) + return data + public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) + private static def mk_tokenSet_7_() as (long): + data = (4818992316214015394L, 525596890624L, 0L, 0L, ) + return data + public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) + private static def mk_tokenSet_8_() as (long): + data = (3170534137668829184L, 1L, 0L, 0L, ) + return data + public static final tokenSet_8_ = BitSet(mk_tokenSet_8_()) + private static def mk_tokenSet_9_() as (long): + data = (153124586353917952L, 0L, ) + return data + public static final tokenSet_9_ = BitSet(mk_tokenSet_9_()) + private static def mk_tokenSet_10_() as (long): + data = (7989388693943160832L, 523986277888L, 0L, 0L, ) + return data + public static final tokenSet_10_ = BitSet(mk_tokenSet_10_()) + private static def mk_tokenSet_11_() as (long): + data = (2594073385365405696L, 0L, ) + return data + public static final tokenSet_11_ = BitSet(mk_tokenSet_11_()) + private static def mk_tokenSet_12_() as (long): + data = (-21476542478L, 547608330239L, 0L, 0L, ) + return data + public static final tokenSet_12_ = BitSet(mk_tokenSet_12_()) + private static def mk_tokenSet_13_() as (long): + data = (4818854556274331648L, 523986277888L, 0L, 0L, ) + return data + public static final tokenSet_13_ = BitSet(mk_tokenSet_13_()) + private static def mk_tokenSet_14_() as (long): + data = (2594073385365405696L, 1L, 0L, 0L, ) + return data + public static final tokenSet_14_ = BitSet(mk_tokenSet_14_()) + private static def mk_tokenSet_15_() as (long): + data = (2738188573441261568L, 257L, 0L, 0L, ) + return data + public static final tokenSet_15_ = BitSet(mk_tokenSet_15_()) + private static def mk_tokenSet_16_() as (long): + data = (171139534652772352L, 481036337152L, 0L, 0L, ) + return data + public static final tokenSet_16_ = BitSet(mk_tokenSet_16_()) + private static def mk_tokenSet_17_() as (long): + data = (7989388693943160832L, 523986277889L, 0L, 0L, ) + return data + public static final tokenSet_17_ = BitSet(mk_tokenSet_17_()) + private static def mk_tokenSet_18_() as (long): + data = (13241271002240L, 1610612736L, 0L, 0L, ) + return data + public static final tokenSet_18_ = BitSet(mk_tokenSet_18_()) + private static def mk_tokenSet_19_() as (long): + data = (459369910804484096L, 481036337152L, 0L, 0L, ) + return data + public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) + private static def mk_tokenSet_20_() as (long): + data = (4818992317287757218L, 525596890624L, 0L, 0L, ) + return data + public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) + private static def mk_tokenSet_21_() as (long): + data = (-3747417106733861454L, 547608330239L, 0L, 0L, ) + return data + public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) + private static def mk_tokenSet_22_() as (long): + data = (-21474969614L, 549755813887L, 0L, 0L, ) + return data + public static final tokenSet_22_ = BitSet(mk_tokenSet_22_()) + private static def mk_tokenSet_23_() as (long): + data = (13239119323136L, 536870912L, 0L, 0L, ) + return data + public static final tokenSet_23_ = BitSet(mk_tokenSet_23_()) + private static def mk_tokenSet_24_() as (long): + data = (13239119323136L, 0L, ) + return data + public static final tokenSet_24_ = BitSet(mk_tokenSet_24_()) + private static def mk_tokenSet_25_() as (long): + data = (9020455554064384L, 0L, ) + return data + public static final tokenSet_25_ = BitSet(mk_tokenSet_25_()) + private static def mk_tokenSet_26_() as (long): + data = (9007216434749440L, 0L, ) + return data + public static final tokenSet_26_ = BitSet(mk_tokenSet_26_()) + private static def mk_tokenSet_27_() as (long): + data = (13238028738560L, 0L, ) + return data + public static final tokenSet_27_ = BitSet(mk_tokenSet_27_()) + private static def mk_tokenSet_28_() as (long): + data = (9020437283479552L, 0L, ) + return data + public static final tokenSet_28_ = BitSet(mk_tokenSet_28_()) + private static def mk_tokenSet_29_() as (long): + data = (8839982292992L, 0L, ) + return data + public static final tokenSet_29_ = BitSet(mk_tokenSet_29_()) + private static def mk_tokenSet_30_() as (long): + data = (9016039237033984L, 0L, ) + return data + public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) + private static def mk_tokenSet_31_() as (long): + data = (4398046576640L, 0L, ) + return data + public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) + private static def mk_tokenSet_32_() as (long): + data = (4891472122717009890L, 525596890752L, 0L, 0L, ) + return data + public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) + private static def mk_tokenSet_33_() as (long): + data = (4891472123791276002L, 527744374400L, 0L, 0L, ) + return data + public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) + private static def mk_tokenSet_34_() as (long): + data = (-1574926L, 547608330239L, 0L, 0L, ) + return data + public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) + private static def mk_tokenSet_35_() as (long): + data = (4891049911325685154L, 525596890624L, 0L, 0L, ) + return data + public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) + private static def mk_tokenSet_36_() as (long): + data = (4818858954320842752L, 523986278016L, 0L, 0L, ) + return data + public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) + private static def mk_tokenSet_37_() as (long): + data = (-3747554884927287280L, 545997717503L, 0L, 0L, ) + return data + public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) + private static def mk_tokenSet_38_() as (long): + data = (4818983474080108832L, 523986278016L, 0L, 0L, ) + return data + public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) + private static def mk_tokenSet_39_() as (long): + data = (-3755439161823856654L, 543028149997L, 0L, 0L, ) + return data + public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) + private static def mk_tokenSet_40_() as (long): + data = (-21475493902L, 547608330239L, 0L, 0L, ) + return data + public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) + private static def mk_tokenSet_41_() as (long): + data = (-4295493646L, 547608330239L, 0L, 0L, ) + return data + public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) + private static def mk_tokenSet_42_() as (long): + data = (36028797018963968L, 33554432L, 0L, 0L, ) + return data + public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) + private static def mk_tokenSet_43_() as (long): + data = (72070833157251072L, 536870912L, 0L, 0L, ) + return data + public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) + private static def mk_tokenSet_44_() as (long): + data = (72057594037993472L, 536870912L, 0L, 0L, ) + return data + public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) + private static def mk_tokenSet_45_() as (long): + data = (288230376151711744L, 0L, ) + return data + public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) + private static def mk_tokenSet_46_() as (long): + data = (2377900603251621888L, 0L, ) + return data + public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) + private static def mk_tokenSet_47_() as (long): + data = (6043971415932532130L, 525596891008L, 0L, 0L, ) + return data + public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) + private static def mk_tokenSet_48_() as (long): + data = (4891472123790751714L, 525596890752L, 0L, 0L, ) + return data + public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) + private static def mk_tokenSet_49_() as (long): + data = (4891041068118036768L, 523986278016L, 0L, 0L, ) + return data + public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) + private static def mk_tokenSet_50_() as (long): + data = (-3746994912522536974L, 547608330239L, 0L, 0L, ) + return data + public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) + private static def mk_tokenSet_51_() as (long): + data = (4891472122719107042L, 525596891008L, 0L, 0L, ) + return data + public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) + private static def mk_tokenSet_52_() as (long): + data = (5179702498868721634L, 525596890752L, 0L, 0L, ) + return data + public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) + private static def mk_tokenSet_53_() as (long): + data = (-4296542222L, 547608330239L, 0L, 0L, ) + return data + public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) + private static def mk_tokenSet_54_() as (long): + data = (-8935141660703064064L, 0L, ) + return data + public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) + private static def mk_tokenSet_55_() as (long): + data = (-6917529027641081856L, 0L, ) + return data + public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) + private static def mk_tokenSet_56_() as (long): + data = (5971776060881178624L, 523986277888L, 0L, 0L, ) + return data + public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) + private static def mk_tokenSet_57_() as (long): + data = (5107084932426043392L, 523986277888L, 0L, 0L, ) + return data + public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) + private static def mk_tokenSet_58_() as (long): + data = (10485760L, 106954752L, 0L, 0L, ) + return data + public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) + private static def mk_tokenSet_59_() as (long): + data = (0L, 1671168L, 0L, 0L, ) + return data + public static final tokenSet_59_ = BitSet(mk_tokenSet_59_()) + diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.boo b/src/UnityScript/Parser/UnityScriptTokenTypes.boo index d45c730..c893c8a 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.boo +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.boo @@ -1,120 +1,119 @@ -// $ANTLR 2.7.5 (20050517): "src/UnityScript/UnityScript.g" -> "UnityScriptLexer.boo"$ - -namespace UnityScript.Parser -class UnityScriptTokenTypes: - public static final EOF = 1 - public static final NULL_TREE_LOOKAHEAD = 3 - public static final AS = 4 - public static final BREAK = 5 - public static final CATCH = 6 - public static final CLASS = 7 - public static final CONTINUE = 8 - public static final ELSE = 9 - public static final ENUM = 10 - public static final EXTENDS = 11 - public static final FALSE = 12 - public static final FINAL = 13 - public static final FINALLY = 14 - public static final FOR = 15 - public static final FUNCTION = 16 - public static final GET = 17 - public static final IF = 18 - public static final IMPORT = 19 - public static final IMPLEMENTS = 20 - public static final IN = 21 - public static final INTERFACE = 22 - public static final INSTANCEOF = 23 - public static final NEW = 24 - public static final NOT = 25 - public static final NULL = 26 - public static final RETURN = 27 - public static final PUBLIC = 28 - public static final PROTECTED = 29 - public static final INTERNAL = 30 - public static final OVERRIDE = 31 - public static final PARTIAL = 32 - public static final PRAGMA = 33 - public static final PRIVATE = 34 - public static final SET = 35 - public static final STATIC = 36 - public static final SUPER = 37 - public static final THIS = 38 - public static final THROW = 39 - public static final TRUE = 40 - public static final TRY = 41 - public static final TYPEOF = 42 - public static final VAR = 43 - public static final VIRTUAL = 44 - public static final WHILE = 45 - public static final YIELD = 46 - public static final SWITCH = 47 - public static final CASE = 48 - public static final DEFAULT = 49 - public static final INPLACE_DIVISION = 50 - public static final INPLACE_ADD = 51 - public static final INPLACE_SUBTRACT = 52 - public static final INPLACE_MULTIPLY = 53 - public static final ID = 54 - public static final DOUBLE_QUOTED_STRING = 55 - public static final LBRACE = 56 - public static final RBRACE = 57 - public static final LPAREN = 58 - public static final RPAREN = 59 - public static final DOT = 60 - public static final COLON = 61 - public static final COMMA = 62 - public static final LBRACK = 63 - public static final RBRACK = 64 - public static final BITWISE_OR = 65 - public static final INPLACE_BITWISE_OR = 66 - public static final BITWISE_AND = 67 - public static final BITWISE_XOR = 68 - public static final INPLACE_BITWISE_AND = 69 - public static final LOGICAL_OR = 70 - public static final LOGICAL_AND = 71 - public static final EOS = 72 - public static final ASSIGN = 73 - public static final INCREMENT = 74 - public static final DECREMENT = 75 - public static final ADD = 76 - public static final SUBTRACT = 77 - public static final MODULUS = 78 - public static final MULTIPLY = 79 - public static final EQUALITY = 80 - public static final INEQUALITY = 81 - public static final QUESTION_MARK = 82 - public static final ONES_COMPLEMENT = 83 - public static final REFERENCE_EQUALITY = 84 - public static final REFERENCE_INEQUALITY = 85 - public static final LESS_THAN = 86 - public static final LESS_THAN_OR_EQUAL = 87 - public static final SHIFT_LEFT = 88 - public static final INPLACE_SHIFT_LEFT = 89 - public static final GREATER_THAN = 90 - public static final GREATER_THAN_OR_EQUAL = 91 - public static final SHIFT_RIGHT = 92 - public static final INPLACE_SHIFT_RIGHT = 93 - public static final AT = 94 - public static final SCRIPT_ATTRIBUTE_MARKER = 95 - public static final HASH = 96 - public static final INPLACE_BITWISE_XOR = 97 - public static final EXCLUSIVE_OR = 98 - public static final DIVISION = 99 - public static final RE_LITERAL = 100 - public static final DOUBLE = 101 - public static final INT = 102 - public static final LONG = 103 - public static final DOUBLE_SUFFIX = 104 - public static final EXPONENT = 105 - public static final WHITE_SPACE = 106 - public static final DQS_ESC = 107 - public static final SQS_ESC = 108 - public static final SESC = 109 - public static final ML_COMMENT = 110 - public static final RE_CHAR = 111 - public static final RE_ESC = 112 - public static final NEWLINE = 113 - public static final ID_LETTER = 114 - public static final DIGIT = 115 - public static final HEXDIGIT = 116 - +// $ANTLR 2.7.5 (20050517): "UnityScript.g" -> "UnityScriptLexer.boo"$ + +namespace UnityScript.Parser +class UnityScriptTokenTypes: + public static final EOF = 1 + public static final NULL_TREE_LOOKAHEAD = 3 + public static final AS = 4 + public static final BREAK = 5 + public static final CATCH = 6 + public static final CLASS = 7 + public static final CONTINUE = 8 + public static final ELSE = 9 + public static final ENUM = 10 + public static final EXTENDS = 11 + public static final FALSE = 12 + public static final FINAL = 13 + public static final FINALLY = 14 + public static final FOR = 15 + public static final FUNCTION = 16 + public static final GET = 17 + public static final IF = 18 + public static final IMPORT = 19 + public static final IMPLEMENTS = 20 + public static final IN = 21 + public static final INTERFACE = 22 + public static final INSTANCEOF = 23 + public static final NEW = 24 + public static final NULL = 25 + public static final RETURN = 26 + public static final PUBLIC = 27 + public static final PROTECTED = 28 + public static final INTERNAL = 29 + public static final OVERRIDE = 30 + public static final PARTIAL = 31 + public static final PRAGMA = 32 + public static final PRIVATE = 33 + public static final SET = 34 + public static final STATIC = 35 + public static final SUPER = 36 + public static final THIS = 37 + public static final THROW = 38 + public static final TRUE = 39 + public static final TRY = 40 + public static final TYPEOF = 41 + public static final VAR = 42 + public static final VIRTUAL = 43 + public static final WHILE = 44 + public static final YIELD = 45 + public static final SWITCH = 46 + public static final CASE = 47 + public static final DEFAULT = 48 + public static final INPLACE_DIVISION = 49 + public static final INPLACE_ADD = 50 + public static final INPLACE_SUBTRACT = 51 + public static final INPLACE_MULTIPLY = 52 + public static final ID = 53 + public static final DOUBLE_QUOTED_STRING = 54 + public static final LBRACE = 55 + public static final RBRACE = 56 + public static final LPAREN = 57 + public static final RPAREN = 58 + public static final DOT = 59 + public static final COLON = 60 + public static final COMMA = 61 + public static final LBRACK = 62 + public static final RBRACK = 63 + public static final BITWISE_OR = 64 + public static final INPLACE_BITWISE_OR = 65 + public static final BITWISE_AND = 66 + public static final BITWISE_XOR = 67 + public static final INPLACE_BITWISE_AND = 68 + public static final LOGICAL_OR = 69 + public static final LOGICAL_AND = 70 + public static final EOS = 71 + public static final ASSIGN = 72 + public static final INCREMENT = 73 + public static final DECREMENT = 74 + public static final ADD = 75 + public static final SUBTRACT = 76 + public static final MODULUS = 77 + public static final MULTIPLY = 78 + public static final EQUALITY = 79 + public static final INEQUALITY = 80 + public static final QUESTION_MARK = 81 + public static final BITWISE_NOT = 82 + public static final REFERENCE_EQUALITY = 83 + public static final REFERENCE_INEQUALITY = 84 + public static final LESS_THAN = 85 + public static final LESS_THAN_OR_EQUAL = 86 + public static final SHIFT_LEFT = 87 + public static final INPLACE_SHIFT_LEFT = 88 + public static final GREATER_THAN = 89 + public static final GREATER_THAN_OR_EQUAL = 90 + public static final SHIFT_RIGHT = 91 + public static final INPLACE_SHIFT_RIGHT = 92 + public static final AT = 93 + public static final SCRIPT_ATTRIBUTE_MARKER = 94 + public static final HASH = 95 + public static final INPLACE_BITWISE_XOR = 96 + public static final NOT = 97 + public static final DIVISION = 98 + public static final RE_LITERAL = 99 + public static final DOUBLE = 100 + public static final INT = 101 + public static final LONG = 102 + public static final DOUBLE_SUFFIX = 103 + public static final EXPONENT = 104 + public static final WHITE_SPACE = 105 + public static final DQS_ESC = 106 + public static final SQS_ESC = 107 + public static final SESC = 108 + public static final ML_COMMENT = 109 + public static final RE_CHAR = 110 + public static final RE_ESC = 111 + public static final NEWLINE = 112 + public static final ID_LETTER = 113 + public static final DIGIT = 114 + public static final HEXDIGIT = 115 + diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.txt b/src/UnityScript/Parser/UnityScriptTokenTypes.txt index cc6f6ed..500005a 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.txt +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.txt @@ -1,115 +1,114 @@ -// $ANTLR 2.7.5 (20050517): src/UnityScript/UnityScript.g -> UnityScriptTokenTypes.txt$ -UnityScript // output token vocab name -AS="as"=4 -BREAK="break"=5 -CATCH="catch"=6 -CLASS="class"=7 -CONTINUE="continue"=8 -ELSE="else"=9 -ENUM="enum"=10 -EXTENDS="extends"=11 -FALSE="false"=12 -FINAL="final"=13 -FINALLY="finally"=14 -FOR="for"=15 -FUNCTION="function"=16 -GET="get"=17 -IF="if"=18 -IMPORT="import"=19 -IMPLEMENTS="implements"=20 -IN="in"=21 -INTERFACE="interface"=22 -INSTANCEOF="instanceof"=23 -NEW="new"=24 -NOT="not"=25 -NULL="null"=26 -RETURN="return"=27 -PUBLIC="public"=28 -PROTECTED="protected"=29 -INTERNAL="internal"=30 -OVERRIDE="override"=31 -PARTIAL="partial"=32 -PRAGMA="pragma"=33 -PRIVATE="private"=34 -SET="set"=35 -STATIC="static"=36 -SUPER="super"=37 -THIS="this"=38 -THROW="throw"=39 -TRUE="true"=40 -TRY="try"=41 -TYPEOF="typeof"=42 -VAR="var"=43 -VIRTUAL="virtual"=44 -WHILE="while"=45 -YIELD="yield"=46 -SWITCH="switch"=47 -CASE="case"=48 -DEFAULT="default"=49 -INPLACE_DIVISION="/="=50 -INPLACE_ADD="+="=51 -INPLACE_SUBTRACT="-="=52 -INPLACE_MULTIPLY="*="=53 -ID="an identifier"=54 -DOUBLE_QUOTED_STRING="a string"=55 -LBRACE="{"=56 -RBRACE="}"=57 -LPAREN="("=58 -RPAREN=")"=59 -DOT="."=60 -COLON=":"=61 -COMMA=","=62 -LBRACK="["=63 -RBRACK="]"=64 -BITWISE_OR="|"=65 -INPLACE_BITWISE_OR="|="=66 -BITWISE_AND="&"=67 -BITWISE_XOR="^"=68 -INPLACE_BITWISE_AND="&="=69 -LOGICAL_OR="||"=70 -LOGICAL_AND="&&"=71 -EOS=";"=72 -ASSIGN="="=73 -INCREMENT="++"=74 -DECREMENT="--"=75 -ADD="+"=76 -SUBTRACT="-"=77 -MODULUS="%"=78 -MULTIPLY="*"=79 -EQUALITY="=="=80 -INEQUALITY="!="=81 -QUESTION_MARK="?"=82 -ONES_COMPLEMENT="~"=83 -REFERENCE_EQUALITY="==="=84 -REFERENCE_INEQUALITY="!=="=85 -LESS_THAN="<"=86 -LESS_THAN_OR_EQUAL="<="=87 -SHIFT_LEFT="<<"=88 -INPLACE_SHIFT_LEFT="<<="=89 -GREATER_THAN=">"=90 -GREATER_THAN_OR_EQUAL=">="=91 -SHIFT_RIGHT=">>"=92 -INPLACE_SHIFT_RIGHT=">>="=93 -AT="@"=94 -SCRIPT_ATTRIBUTE_MARKER="@script"=95 -HASH=96 -INPLACE_BITWISE_XOR=97 -EXCLUSIVE_OR=98 -DIVISION=99 -RE_LITERAL=100 -DOUBLE=101 -INT=102 -LONG=103 -DOUBLE_SUFFIX=104 -EXPONENT=105 -WHITE_SPACE=106 -DQS_ESC=107 -SQS_ESC=108 -SESC=109 -ML_COMMENT=110 -RE_CHAR=111 -RE_ESC=112 -NEWLINE=113 -ID_LETTER=114 -DIGIT=115 -HEXDIGIT=116 +// $ANTLR 2.7.5 (20050517): UnityScript.g -> UnityScriptTokenTypes.txt$ +UnityScript // output token vocab name +AS="as"=4 +BREAK="break"=5 +CATCH="catch"=6 +CLASS="class"=7 +CONTINUE="continue"=8 +ELSE="else"=9 +ENUM="enum"=10 +EXTENDS="extends"=11 +FALSE="false"=12 +FINAL="final"=13 +FINALLY="finally"=14 +FOR="for"=15 +FUNCTION="function"=16 +GET="get"=17 +IF="if"=18 +IMPORT="import"=19 +IMPLEMENTS="implements"=20 +IN="in"=21 +INTERFACE="interface"=22 +INSTANCEOF="instanceof"=23 +NEW="new"=24 +NULL="null"=25 +RETURN="return"=26 +PUBLIC="public"=27 +PROTECTED="protected"=28 +INTERNAL="internal"=29 +OVERRIDE="override"=30 +PARTIAL="partial"=31 +PRAGMA="pragma"=32 +PRIVATE="private"=33 +SET="set"=34 +STATIC="static"=35 +SUPER="super"=36 +THIS="this"=37 +THROW="throw"=38 +TRUE="true"=39 +TRY="try"=40 +TYPEOF="typeof"=41 +VAR="var"=42 +VIRTUAL="virtual"=43 +WHILE="while"=44 +YIELD="yield"=45 +SWITCH="switch"=46 +CASE="case"=47 +DEFAULT="default"=48 +INPLACE_DIVISION="/="=49 +INPLACE_ADD="+="=50 +INPLACE_SUBTRACT="-="=51 +INPLACE_MULTIPLY="*="=52 +ID="an identifier"=53 +DOUBLE_QUOTED_STRING="a string"=54 +LBRACE="{"=55 +RBRACE="}"=56 +LPAREN="("=57 +RPAREN=")"=58 +DOT="."=59 +COLON=":"=60 +COMMA=","=61 +LBRACK="["=62 +RBRACK="]"=63 +BITWISE_OR="|"=64 +INPLACE_BITWISE_OR="|="=65 +BITWISE_AND="&"=66 +BITWISE_XOR="^"=67 +INPLACE_BITWISE_AND="&="=68 +LOGICAL_OR="||"=69 +LOGICAL_AND="&&"=70 +EOS=";"=71 +ASSIGN="="=72 +INCREMENT="++"=73 +DECREMENT="--"=74 +ADD="+"=75 +SUBTRACT="-"=76 +MODULUS="%"=77 +MULTIPLY="*"=78 +EQUALITY="=="=79 +INEQUALITY="!="=80 +QUESTION_MARK="?"=81 +BITWISE_NOT="~"=82 +REFERENCE_EQUALITY="==="=83 +REFERENCE_INEQUALITY="!=="=84 +LESS_THAN="<"=85 +LESS_THAN_OR_EQUAL="<="=86 +SHIFT_LEFT="<<"=87 +INPLACE_SHIFT_LEFT="<<="=88 +GREATER_THAN=">"=89 +GREATER_THAN_OR_EQUAL=">="=90 +SHIFT_RIGHT=">>"=91 +INPLACE_SHIFT_RIGHT=">>="=92 +AT="@"=93 +SCRIPT_ATTRIBUTE_MARKER="@script"=94 +HASH=95 +INPLACE_BITWISE_XOR=96 +NOT=97 +DIVISION=98 +RE_LITERAL=99 +DOUBLE=100 +INT=101 +LONG=102 +DOUBLE_SUFFIX=103 +EXPONENT=104 +WHITE_SPACE=105 +DQS_ESC=106 +SQS_ESC=107 +SESC=108 +ML_COMMENT=109 +RE_CHAR=110 +RE_ESC=111 +NEWLINE=112 +ID_LETTER=113 +DIGIT=114 +HEXDIGIT=115 From 10a7c750a4281c39d5a5f738a0a42535137a3b14 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 11 Jun 2010 22:50:15 -0300 Subject: [PATCH 008/276] ability to categorize test cases (in the nunit sense) --- refresh-tests.boo | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/refresh-tests.boo b/refresh-tests.boo index 998350d..87eddd8 100755 --- a/refresh-tests.boo +++ b/refresh-tests.boo @@ -4,6 +4,7 @@ Generates test fixtures from files under tests/ """ import System import System.IO +import Boo.Lang.PatternMatching //def MapPath(path): // return Path.Combine(Project.BaseDirectory, path) @@ -16,23 +17,26 @@ def WriteTestCases(writer as TextWriter, baseDir as string): for fname in Directory.GetFiles(baseDir): continue unless fname.EndsWith(".js") ++count - ignoreAttribute = IgnoreAttributeFor(fname) + categoryAttribute = CategoryAttributeFor(fname) writer.Write(""" - [Test]${ignoreAttribute} - def ${GetTestCaseName(fname)}(): + ${categoryAttribute} + [Test] def ${GetTestCaseName(fname)}(): RunTestCase("${fname.Replace('\\', '/')}") """) print("${count} test cases found in ${baseDir}.") -def IgnoreAttributeFor(testFile as string): +def CategoryAttributeFor(testFile as string): """ -If the first line of the test case file starts with // ignore -then return a suitable [Ignore()] attribute. +If the first line of the test case file starts with // category CategoryName +then return a suitable [CategoryName()] attribute. """ - m = /\/\/\s*ignore\s+(.*)/.Match(FirstLineOf(testFile)) - if not m.Success: return string.Empty - reason = m.Groups[1].Value.Trim() - return """[Ignore("${reason}")]""" + match FirstLineOf(testFile): + case /\/\/\s*ignore\s+(?.*)/: + return "[Ignore(\"${reason[0].Value.Trim()}\")]" + case /\/\/\s*category\s+(?.*)/: + return "[Category(\"${name[0].Value.Trim()}\")]" + otherwise: + return "" def FirstLineOf(fname as string): using reader=File.OpenText(fname): From 7a357259163c2cb0693a35aa12addac77001a34f Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 11 Jun 2010 22:51:14 -0300 Subject: [PATCH 009/276] add the two failing tests to the FailsOnMono category and exclude them from the build when mono is detected --- default.build | 10 +- .../ErrorMessagesTestFixture.Generated.boo | 108 +-- src/UnityScript.Tests/EvalTestFixture.boo | 84 +-- src/UnityScript.Tests/ExpandoTestFixture.boo | 12 +- .../GenericsTestFixture.Generated.boo | 8 +- .../IntegrationTestFixture.boo | 624 +++++++++--------- .../ParserTestFixture.Generated.boo | 196 +++--- src/UnityScript.Tests/PragmaTestFixture.boo | 16 +- .../SemanticsTestFixture.boo | 36 +- .../StackTraceTestFixture.Generated.boo | 24 +- tests/expando/expando-gc-3.js | 1 + tests/stacktrace/stacktrace-2.js | 1 + 12 files changed, 565 insertions(+), 555 deletions(-) diff --git a/default.build b/default.build index fb45e1a..185b826 100755 --- a/default.build +++ b/default.build @@ -18,12 +18,16 @@ + + + + @@ -69,7 +73,11 @@ - + + + + + diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index 7fcbaf1..5a274ad 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -5,111 +5,111 @@ import NUnit.Framework partial class ErrorMessagesTestFixture: - [Test] - def array_struct_warning(): + + [Test] def array_struct_warning(): RunTestCase("tests/error-messages/array-struct-warning.js") - [Test] - def builtins(): + + [Test] def builtins(): RunTestCase("tests/error-messages/builtins.js") - [Test] - def cannot_convert_error(): + + [Test] def cannot_convert_error(): RunTestCase("tests/error-messages/cannot-convert-error.js") - [Test] - def conditional_compilation_with_pragma_strict(): + + [Test] def conditional_compilation_with_pragma_strict(): RunTestCase("tests/error-messages/conditional-compilation-with-pragma-strict.js") - [Test] - def error_for_final_used_as_identifier(): + + [Test] def error_for_final_used_as_identifier(): RunTestCase("tests/error-messages/error-for-final-used-as-identifier.js") - [Test] - def implicit_main_shouldnt_be_redefined(): + + [Test] def implicit_main_shouldnt_be_redefined(): RunTestCase("tests/error-messages/implicit-main-shouldnt-be-redefined.js") - [Test] - def incompatible_initializer_1(): + + [Test] def incompatible_initializer_1(): RunTestCase("tests/error-messages/incompatible-initializer-1.js") - [Test] - def inner_text(): + + [Test] def inner_text(): RunTestCase("tests/error-messages/inner_text.js") - [Test] - def interface_errors(): + + [Test] def interface_errors(): RunTestCase("tests/error-messages/interface-errors.js") - [Test] - def iterator_warning(): + + [Test] def iterator_warning(): RunTestCase("tests/error-messages/iterator-warning.js") - [Test] - def missing_brace(): + + [Test] def missing_brace(): RunTestCase("tests/error-messages/missing-brace.js") - [Test] - def nolinenumber(): + + [Test] def nolinenumber(): RunTestCase("tests/error-messages/nolinenumber.js") - [Test] - def obsolete_2(): + + [Test] def obsolete_2(): RunTestCase("tests/error-messages/obsolete-2.js") - [Test] - def obsolete(): + + [Test] def obsolete(): RunTestCase("tests/error-messages/obsolete.js") - [Test][Ignore("requires new parser infrastructure")] - def overeager_semicolon(): + [Ignore("requires new parser infrastructure")] + [Test] def overeager_semicolon(): RunTestCase("tests/error-messages/overeager-semicolon.js") - [Test][Ignore("requires new parser infrastructure")] - def overeager_semicolon2(): + [Ignore("requires new parser infrastructure")] + [Test] def overeager_semicolon2(): RunTestCase("tests/error-messages/overeager-semicolon2.js") - [Test] - def pragma_strict_2(): + + [Test] def pragma_strict_2(): RunTestCase("tests/error-messages/pragma-strict-2.js") - [Test] - def pragma_strict_3js(): + + [Test] def pragma_strict_3js(): RunTestCase("tests/error-messages/pragma-strict-3js.js") - [Test] - def pragma_strict_4(): + + [Test] def pragma_strict_4(): RunTestCase("tests/error-messages/pragma-strict-4.js") - [Test] - def pragma_strict(): + + [Test] def pragma_strict(): RunTestCase("tests/error-messages/pragma-strict.js") - [Test] - def semicolon_2(): + + [Test] def semicolon_2(): RunTestCase("tests/error-messages/semicolon-2.js") - [Test] - def semicolon(): + + [Test] def semicolon(): RunTestCase("tests/error-messages/semicolon.js") - [Test] - def unused_variable(): + + [Test] def unused_variable(): RunTestCase("tests/error-messages/unused-variable.js") - [Test] - def virtual_warning(): + + [Test] def virtual_warning(): RunTestCase("tests/error-messages/virtual-warning.js") - [Test] - def void_declaration(): + + [Test] def void_declaration(): RunTestCase("tests/error-messages/void-declaration.js") - [Test] - def void_in_hashtable(): + + [Test] def void_in_hashtable(): RunTestCase("tests/error-messages/void-in-hashtable.js") - [Test] - def voidcomparison(): + + [Test] def voidcomparison(): RunTestCase("tests/error-messages/voidcomparison.js") \ No newline at end of file diff --git a/src/UnityScript.Tests/EvalTestFixture.boo b/src/UnityScript.Tests/EvalTestFixture.boo index 68535d0..00159db 100755 --- a/src/UnityScript.Tests/EvalTestFixture.boo +++ b/src/UnityScript.Tests/EvalTestFixture.boo @@ -6,87 +6,87 @@ import NUnit.Framework [TestFixture] class EvalTestFixture(AbstractIntegrationTestFixture): - [Test] - def assembly_caching_1(): + + [Test] def assembly_caching_1(): RunTestCase("tests/eval/assembly-caching-1.js") - [Test] - def assembly_caching_2(): + + [Test] def assembly_caching_2(): RunTestCase("tests/eval/assembly-caching-2.js") - [Test] - def class_1(): + + [Test] def class_1(): RunTestCase("tests/eval/class-1.js") - [Test] - def class_2(): + + [Test] def class_2(): RunTestCase("tests/eval/class-2.js") - [Test] - def class_3(): + + [Test] def class_3(): RunTestCase("tests/eval/class-3.js") - [Test] - def class_is_visible_1(): + + [Test] def class_is_visible_1(): RunTestCase("tests/eval/class-is-visible-1.js") - [Test] - def eval_in_static_function_1(): + + [Test] def eval_in_static_function_1(): RunTestCase("tests/eval/eval-in-static-function-1.js") - [Test] - def eval_in_static_function_2(): + + [Test] def eval_in_static_function_2(): RunTestCase("tests/eval/eval-in-static-function-2.js") - [Test] - def eval_in_static_function_3(): + + [Test] def eval_in_static_function_3(): RunTestCase("tests/eval/eval-in-static-function-3.js") - [Test] - def functions_1(): + + [Test] def functions_1(): RunTestCase("tests/eval/functions-1.js") - [Test] - def functions_2(): + + [Test] def functions_2(): RunTestCase("tests/eval/functions-2.js") - [Test] - def return_value_2(): + + [Test] def return_value_2(): RunTestCase("tests/eval/return-value-2.js") - [Test] - def return_value_3(): + + [Test] def return_value_3(): RunTestCase("tests/eval/return-value-3.js") - [Test] - def return_value(): + + [Test] def return_value(): RunTestCase("tests/eval/return-value.js") - [Test] - def simple_1(): + + [Test] def simple_1(): RunTestCase("tests/eval/simple-1.js") - [Test] - def variable_initializer_doesnt_move(): + + [Test] def variable_initializer_doesnt_move(): RunTestCase("tests/eval/variable-initializer-doesnt-move.js") - [Test] - def variables_1(): + + [Test] def variables_1(): RunTestCase("tests/eval/variables-1.js") - [Test] - def variables_2(): + + [Test] def variables_2(): RunTestCase("tests/eval/variables-2.js") - [Test] - def variables_3(): + + [Test] def variables_3(): RunTestCase("tests/eval/variables-3.js") - [Test] - def variables_4(): + + [Test] def variables_4(): RunTestCase("tests/eval/variables-4.js") - [Test] - def variables_5(): + + [Test] def variables_5(): RunTestCase("tests/eval/variables-5.js") \ No newline at end of file diff --git a/src/UnityScript.Tests/ExpandoTestFixture.boo b/src/UnityScript.Tests/ExpandoTestFixture.boo index 4114a3f..30a7f72 100755 --- a/src/UnityScript.Tests/ExpandoTestFixture.boo +++ b/src/UnityScript.Tests/ExpandoTestFixture.boo @@ -11,15 +11,15 @@ class ExpandoTestFixture(AbstractIntegrationTestFixture): compiler.Parameters.Expando = true return compiler - [Test] - def expando_1(): + + [Test] def expando_1(): RunTestCase("tests/expando/expando-1.js") - [Test] - def expando_2(): + + [Test] def expando_2(): RunTestCase("tests/expando/expando-2.js") - [Test] - def expando_gc_3(): + [Category("FailsOnMono")] + [Test] def expando_gc_3(): RunTestCase("tests/expando/expando-gc-3.js") \ No newline at end of file diff --git a/src/UnityScript.Tests/GenericsTestFixture.Generated.boo b/src/UnityScript.Tests/GenericsTestFixture.Generated.boo index 9b128d9..e185a75 100644 --- a/src/UnityScript.Tests/GenericsTestFixture.Generated.boo +++ b/src/UnityScript.Tests/GenericsTestFixture.Generated.boo @@ -6,11 +6,11 @@ import NUnit.Framework [TestFixture] class GenericsTestFixture(AbstractIntegrationTestFixture): - [Test] - def generic_list_instantiation_1(): + + [Test] def generic_list_instantiation_1(): RunTestCase("tests/generics/generic-list-instantiation-1.js") - [Test] - def generic_method_1(): + + [Test] def generic_method_1(): RunTestCase("tests/generics/generic-method-1.js") \ No newline at end of file diff --git a/src/UnityScript.Tests/IntegrationTestFixture.boo b/src/UnityScript.Tests/IntegrationTestFixture.boo index 3aac7f9..b43d9aa 100644 --- a/src/UnityScript.Tests/IntegrationTestFixture.boo +++ b/src/UnityScript.Tests/IntegrationTestFixture.boo @@ -6,627 +6,627 @@ import NUnit.Framework [TestFixture] class IntegrationTestFixture(AbstractIntegrationTestFixture): - [Test] - def JSCheckFloatToIntOverflow(): + + [Test] def JSCheckFloatToIntOverflow(): RunTestCase("tests/integration/JSCheckFloatToIntOverflow.js") - [Test] - def JSChooseOverload(): + + [Test] def JSChooseOverload(): RunTestCase("tests/integration/JSChooseOverload.js") - [Test] - def accessor_2_duck(): + + [Test] def accessor_2_duck(): RunTestCase("tests/integration/accessor-2-duck.js") - [Test] - def accessor_2(): + + [Test] def accessor_2(): RunTestCase("tests/integration/accessor-2.js") - [Test] - def accessor_3_duck(): + + [Test] def accessor_3_duck(): RunTestCase("tests/integration/accessor-3-duck.js") - [Test] - def accessor_duck(): + + [Test] def accessor_duck(): RunTestCase("tests/integration/accessor-duck.js") - [Test] - def accessor(): + + [Test] def accessor(): RunTestCase("tests/integration/accessor.js") - [Test] - def ambigous_call(): + + [Test] def ambigous_call(): RunTestCase("tests/integration/ambigous-call.js") - [Test] - def anonymous_function_type_1(): + + [Test] def anonymous_function_type_1(): RunTestCase("tests/integration/anonymous-function-type-1.js") - [Test] - def anonymous_function_type_2(): + + [Test] def anonymous_function_type_2(): RunTestCase("tests/integration/anonymous-function-type-2.js") - [Test] - def anonymous_function_type_3(): + + [Test] def anonymous_function_type_3(): RunTestCase("tests/integration/anonymous-function-type-3.js") - [Test] - def array_Add(): + + [Test] def array_Add(): RunTestCase("tests/integration/array-Add.js") - [Test] - def array_Remove(): + + [Test] def array_Remove(): RunTestCase("tests/integration/array-Remove.js") - [Test] - def array_access(): + + [Test] def array_access(): RunTestCase("tests/integration/array-access.js") - [Test] - def array_cast_2(): + + [Test] def array_cast_2(): RunTestCase("tests/integration/array-cast-2.js") - [Test] - def array_cast_3(): + + [Test] def array_cast_3(): RunTestCase("tests/integration/array-cast-3.js") - [Test] - def array_cast_4(): + + [Test] def array_cast_4(): RunTestCase("tests/integration/array-cast-4.js") - [Test] - def array_cast_5(): + + [Test] def array_cast_5(): RunTestCase("tests/integration/array-cast-5.js") - [Test] - def array_cast_6(): + + [Test] def array_cast_6(): RunTestCase("tests/integration/array-cast-6.js") - [Test] - def array_cast(): + + [Test] def array_cast(): RunTestCase("tests/integration/array-cast.js") - [Test] - def array_concat_1(): + + [Test] def array_concat_1(): RunTestCase("tests/integration/array-concat-1.js") - [Test] - def array_concat_2(): + + [Test] def array_concat_2(): RunTestCase("tests/integration/array-concat-2.js") - [Test] - def array_create(): + + [Test] def array_create(): RunTestCase("tests/integration/array-create.js") - [Test] - def array_ctor_with_single_null_element(): + + [Test] def array_ctor_with_single_null_element(): RunTestCase("tests/integration/array-ctor-with-single-null-element.js") - [Test] - def array_implicit_from_null_enumerable(): + + [Test] def array_implicit_from_null_enumerable(): RunTestCase("tests/integration/array-implicit-from-null-enumerable.js") - [Test] - def array_implicit_from_null(): + + [Test] def array_implicit_from_null(): RunTestCase("tests/integration/array-implicit-from-null.js") - [Test] - def array_iterate(): + + [Test] def array_iterate(): RunTestCase("tests/integration/array-iterate.js") - [Test] - def array_iteration_with_nulls(): + + [Test] def array_iteration_with_nulls(): RunTestCase("tests/integration/array-iteration-with-nulls.js") - [Test] - def array_join(): + + [Test] def array_join(): RunTestCase("tests/integration/array-join.js") - [Test] - def array_length_2(): + + [Test] def array_length_2(): RunTestCase("tests/integration/array-length-2.js") - [Test] - def array_length(): + + [Test] def array_length(): RunTestCase("tests/integration/array-length.js") - [Test] - def array_nest_1(): + + [Test] def array_nest_1(): RunTestCase("tests/integration/array-nest-1.js") - [Test] - def array_nest_2(): + + [Test] def array_nest_2(): RunTestCase("tests/integration/array-nest-2.js") - [Test] - def array_polymorphic_foreach(): + + [Test] def array_polymorphic_foreach(): RunTestCase("tests/integration/array-polymorphic-foreach.js") - [Test] - def array_pop(): + + [Test] def array_pop(): RunTestCase("tests/integration/array-pop.js") - [Test] - def array_push_2(): + + [Test] def array_push_2(): RunTestCase("tests/integration/array-push-2.js") - [Test] - def array_push_typesjs(): + + [Test] def array_push_typesjs(): RunTestCase("tests/integration/array-push-typesjs.js") - [Test] - def array_push(): + + [Test] def array_push(): RunTestCase("tests/integration/array-push.js") - [Test] - def array_shift(): + + [Test] def array_shift(): RunTestCase("tests/integration/array-shift.js") - [Test] - def array_slice(): + + [Test] def array_slice(): RunTestCase("tests/integration/array-slice.js") - [Test] - def array_sort(): + + [Test] def array_sort(): RunTestCase("tests/integration/array-sort.js") - [Test] - def array_splice_2(): + + [Test] def array_splice_2(): RunTestCase("tests/integration/array-splice-2.js") - [Test] - def array_splice(): + + [Test] def array_splice(): RunTestCase("tests/integration/array-splice.js") - [Test] - def array_str(): + + [Test] def array_str(): RunTestCase("tests/integration/array-str.js") - [Test] - def array_toString(): + + [Test] def array_toString(): RunTestCase("tests/integration/array-toString.js") - [Test] - def array_unshift(): + + [Test] def array_unshift(): RunTestCase("tests/integration/array-unshift.js") - [Test] - def arrays_10(): + + [Test] def arrays_10(): RunTestCase("tests/integration/arrays-10.js") - [Test] - def arrays_2(): + + [Test] def arrays_2(): RunTestCase("tests/integration/arrays-2.js") - [Test] - def arrays_3(): + + [Test] def arrays_3(): RunTestCase("tests/integration/arrays-3.js") - [Test] - def arrays_4(): + + [Test] def arrays_4(): RunTestCase("tests/integration/arrays-4.js") - [Test] - def arrays_5(): + + [Test] def arrays_5(): RunTestCase("tests/integration/arrays-5.js") - [Test] - def arrays_6(): + + [Test] def arrays_6(): RunTestCase("tests/integration/arrays-6.js") - [Test] - def arrays_7(): + + [Test] def arrays_7(): RunTestCase("tests/integration/arrays-7.js") - [Test] - def arrays_9(): + + [Test] def arrays_9(): RunTestCase("tests/integration/arrays-9.js") - [Test] - def arrays(): + + [Test] def arrays(): RunTestCase("tests/integration/arrays.js") - [Test] - def assign_iterator(): + + [Test] def assign_iterator(): RunTestCase("tests/integration/assign_iterator.js") - [Test] - def attributes_2(): + + [Test] def attributes_2(): RunTestCase("tests/integration/attributes-2.js") - [Test] - def attributes(): + + [Test] def attributes(): RunTestCase("tests/integration/attributes.js") - [Test] - def auto_coroutine_2_duck(): + + [Test] def auto_coroutine_2_duck(): RunTestCase("tests/integration/auto-coroutine-2-duck.js") - [Test] - def auto_coroutine_2(): + + [Test] def auto_coroutine_2(): RunTestCase("tests/integration/auto-coroutine-2.js") - [Test] - def auto_coroutine_duck(): + + [Test] def auto_coroutine_duck(): RunTestCase("tests/integration/auto-coroutine-duck.js") - [Test] - def auto_coroutine_return_2(): + + [Test] def auto_coroutine_return_2(): RunTestCase("tests/integration/auto-coroutine-return-2.js") - [Test] - def auto_coroutine(): + + [Test] def auto_coroutine(): RunTestCase("tests/integration/auto-coroutine.js") - [Test] - def boolcast(): + + [Test] def boolcast(): RunTestCase("tests/integration/boolcast.js") - [Test] - def chars(): + + [Test] def chars(): RunTestCase("tests/integration/chars.js") - [Test] - def comma_parsing(): + + [Test] def comma_parsing(): RunTestCase("tests/integration/comma-parsing.js") - [Test] - def constructor_1(): + + [Test] def constructor_1(): RunTestCase("tests/integration/constructor-1.js") - [Test] - def constructor_2(): + + [Test] def constructor_2(): RunTestCase("tests/integration/constructor_2.js") - [Test] - def continue_issue(): + + [Test] def continue_issue(): RunTestCase("tests/integration/continue-issue.js") - [Test] - def coroutine_2(): + + [Test] def coroutine_2(): RunTestCase("tests/integration/coroutine-2.js") - [Test] - def coroutine_3(): + + [Test] def coroutine_3(): RunTestCase("tests/integration/coroutine-3.js") - [Test] - def coroutine_4(): + + [Test] def coroutine_4(): RunTestCase("tests/integration/coroutine-4.js") - [Test] - def coroutine_5(): + + [Test] def coroutine_5(): RunTestCase("tests/integration/coroutine-5.js") - [Test] - def coroutine_return_type_1(): + + [Test] def coroutine_return_type_1(): RunTestCase("tests/integration/coroutine-return-type-1.js") - [Test] - def coroutine_return(): + + [Test] def coroutine_return(): RunTestCase("tests/integration/coroutine-return.js") - [Test] - def coroutine_try_catch(): + + [Test] def coroutine_try_catch(): RunTestCase("tests/integration/coroutine-try-catch.js") - [Test] - def coroutine(): + + [Test] def coroutine(): RunTestCase("tests/integration/coroutine.js") - [Test] - def crash(): + + [Test] def crash(): RunTestCase("tests/integration/crash.js") - [Test] - def duck_1(): + + [Test] def duck_1(): RunTestCase("tests/integration/duck-1.js") - [Test] - def duck_equality_operator_1(): + + [Test] def duck_equality_operator_1(): RunTestCase("tests/integration/duck-equality-operator-1.js") - [Test] - def duck_implicit_bool_1(): + + [Test] def duck_implicit_bool_1(): RunTestCase("tests/integration/duck-implicit-bool-1.js") - [Test] - def duck_implicit_bool_full(): + + [Test] def duck_implicit_bool_full(): RunTestCase("tests/integration/duck-implicit-bool-full.js") - [Test] - def duck_implicit_bool_simple(): + + [Test] def duck_implicit_bool_simple(): RunTestCase("tests/integration/duck-implicit-bool-simple.js") - [Test] - def duck_return_property(): + + [Test] def duck_return_property(): RunTestCase("tests/integration/duck-return-property.js") - [Test] - def duck(): + + [Test] def duck(): RunTestCase("tests/integration/duck.js") - [Test] - def ducktyped_1(): + + [Test] def ducktyped_1(): RunTestCase("tests/integration/ducktyped-1.js") - [Test] - def ducktyping_2(): + + [Test] def ducktyping_2(): RunTestCase("tests/integration/ducktyping-2.js") - [Test] - def ducktyping_3(): + + [Test] def ducktyping_3(): RunTestCase("tests/integration/ducktyping-3.js") - [Test] - def ducktyping(): + + [Test] def ducktyping(): RunTestCase("tests/integration/ducktyping.js") - [Test] - def ducky_1(): + + [Test] def ducky_1(): RunTestCase("tests/integration/ducky-1.js") - [Test] - def ducky_2(): + + [Test] def ducky_2(): RunTestCase("tests/integration/ducky_2.js") - [Test] - def ducky_3(): + + [Test] def ducky_3(): RunTestCase("tests/integration/ducky_3.js") - [Test] - def ducky_4(): + + [Test] def ducky_4(): RunTestCase("tests/integration/ducky_4.js") - [Test] - def ducky_5(): + + [Test] def ducky_5(): RunTestCase("tests/integration/ducky_5.js") - [Test] - def ducky_6(): + + [Test] def ducky_6(): RunTestCase("tests/integration/ducky_6.js") - [Test] - def empty_string_array(): + + [Test] def empty_string_array(): RunTestCase("tests/integration/empty-string-array.js") - [Test] - def enum_1(): + + [Test] def enum_1(): RunTestCase("tests/integration/enum-1.js") - [Test] - def enum_2(): + + [Test] def enum_2(): RunTestCase("tests/integration/enum-2.js") - [Test] - def enum_3(): + + [Test] def enum_3(): RunTestCase("tests/integration/enum-3.js") - [Test] - def enum_4(): + + [Test] def enum_4(): RunTestCase("tests/integration/enum-4.js") - [Test] - def enum_5(): + + [Test] def enum_5(): RunTestCase("tests/integration/enum-5.js") - [Test] - def enum_conversion(): + + [Test] def enum_conversion(): RunTestCase("tests/integration/enum-conversion.js") - [Test] - def enumerator_array(): + + [Test] def enumerator_array(): RunTestCase("tests/integration/enumerator-array.js") - [Test] - def explicit_awake_function(): + + [Test] def explicit_awake_function(): RunTestCase("tests/integration/explicit-awake-function.js") - [Test] - def float_1(): + + [Test] def float_1(): RunTestCase("tests/integration/float-1.js") - [Test] - def float_2(): + + [Test] def float_2(): RunTestCase("tests/integration/float-2.js") - [Test] - def for_break_1(): + + [Test] def for_break_1(): RunTestCase("tests/integration/for-break-1.js") - [Test] - def for_continue_1(): + + [Test] def for_continue_1(): RunTestCase("tests/integration/for-continue-1.js") - [Test] - def for_continue_2(): + + [Test] def for_continue_2(): RunTestCase("tests/integration/for-continue-2.js") - [Test] - def for_over_null(): + + [Test] def for_over_null(): RunTestCase("tests/integration/for-over-null.js") - [Test] - def functions_1(): + + [Test] def functions_1(): RunTestCase("tests/integration/functions-1.js") - [Test] - def generator_inheritance_calling_super(): + + [Test] def generator_inheritance_calling_super(): RunTestCase("tests/integration/generator-inheritance-calling-super.js") - [Test] - def generator_inheritance_yielding_super(): + + [Test] def generator_inheritance_yielding_super(): RunTestCase("tests/integration/generator-inheritance-yielding-super.js") - [Test] - def generator_inheritance(): + + [Test] def generator_inheritance(): RunTestCase("tests/integration/generator-inheritance.js") - [Test] - def implicit_conversion(): + + [Test] def implicit_conversion(): RunTestCase("tests/integration/implicit_conversion.js") - [Test] - def initializeorder(): + + [Test] def initializeorder(): RunTestCase("tests/integration/initializeorder.js") - [Test] - def interfaces_1(): + + [Test] def interfaces_1(): RunTestCase("tests/integration/interfaces-1.js") - [Test] - def invalidil(): + + [Test] def invalidil(): RunTestCase("tests/integration/invalidil.js") - [Test] - def length_string(): + + [Test] def length_string(): RunTestCase("tests/integration/length-string.js") - [Test] - def magicclass(): + + [Test] def magicclass(): RunTestCase("tests/integration/magicclass.js") - [Test] - def magicconstructor(): + + [Test] def magicconstructor(): RunTestCase("tests/integration/magicconstructor.js") - [Test] - def magicconstructor_2(): + + [Test] def magicconstructor_2(): RunTestCase("tests/integration/magicconstructor_2.js") - [Test] - def nested_class_1(): + + [Test] def nested_class_1(): RunTestCase("tests/integration/nested-class-1.js") - [Test] - def new_1(): + + [Test] def new_1(): RunTestCase("tests/integration/new-1.js") - [Test] - def null_assign(): + + [Test] def null_assign(): RunTestCase("tests/integration/null-assign.js") - [Test] - def operators_4(): + + [Test] def operators_4(): RunTestCase("tests/integration/operators-4.js") - [Test] - def operators_5(): + + [Test] def operators_5(): RunTestCase("tests/integration/operators-5.js") - [Test] - def override_1(): + + [Test] def override_1(): RunTestCase("tests/integration/override-1.js") - [Test] - def param_test(): + + [Test] def param_test(): RunTestCase("tests/integration/param_test.js") - [Test] - def parse_int(): + + [Test] def parse_int(): RunTestCase("tests/integration/parse_int.js") - [Test] - def pragma_expando_1(): + + [Test] def pragma_expando_1(): RunTestCase("tests/integration/pragma-expando-1.js") - [Test] - def pragma_expando_2(): + + [Test] def pragma_expando_2(): RunTestCase("tests/integration/pragma-expando-2.js") - [Test] - def private_duck(): + + [Test] def private_duck(): RunTestCase("tests/integration/private-duck.js") - [Test] - def properties(): + + [Test] def properties(): RunTestCase("tests/integration/properties.js") - [Test] - def question_mark(): + + [Test] def question_mark(): RunTestCase("tests/integration/question_mark.js") - [Test] - def raw_array_indexing(): + + [Test] def raw_array_indexing(): RunTestCase("tests/integration/raw-array-indexing.js") - [Test] - def script_attributes(): + + [Test] def script_attributes(): RunTestCase("tests/integration/script-attributes.js") - [Test] - def shift_left_bitwise_or(): + + [Test] def shift_left_bitwise_or(): RunTestCase("tests/integration/shift-left-bitwise-or.js") - [Test] - def string_append(): + + [Test] def string_append(): RunTestCase("tests/integration/string-append.js") - [Test] - def string_concat(): + + [Test] def string_concat(): RunTestCase("tests/integration/string-concat.js") - [Test] - def switch_3(): + + [Test] def switch_3(): RunTestCase("tests/integration/switch-3.js") - [Test] - def switch_fallthrough(): + + [Test] def switch_fallthrough(): RunTestCase("tests/integration/switch-fallthrough.js") - [Test] - def switch_simple_2(): + + [Test] def switch_simple_2(): RunTestCase("tests/integration/switch-simple-2.js") - [Test] - def switch_simple(): + + [Test] def switch_simple(): RunTestCase("tests/integration/switch-simple.js") - [Test] - def switch_with_loop(): + + [Test] def switch_with_loop(): RunTestCase("tests/integration/switch-with-loop.js") - [Test] - def switch(): + + [Test] def switch(): RunTestCase("tests/integration/switch.js") - [Test] - def transform_collider_bounds(): + + [Test] def transform_collider_bounds(): RunTestCase("tests/integration/transform-collider-bounds.js") - [Test] - def typecast_1(): + + [Test] def typecast_1(): RunTestCase("tests/integration/typecast-1.js") - [Test] - def typeof_1(): + + [Test] def typeof_1(): RunTestCase("tests/integration/typeof-1.js") - [Test] - def types_1(): + + [Test] def types_1(): RunTestCase("tests/integration/types-1.js") - [Test] - def valuetypes_1(): + + [Test] def valuetypes_1(): RunTestCase("tests/integration/valuetypes-1.js") - [Test] - def variable_declaration_2(): + + [Test] def variable_declaration_2(): RunTestCase("tests/integration/variable-declaration-2.js") - [Test] - def variable_declaration(): + + [Test] def variable_declaration(): RunTestCase("tests/integration/variable-declaration.js") - [Test] - def variables(): + + [Test] def variables(): RunTestCase("tests/integration/variables.js") - [Test] - def vars_1(): + + [Test] def vars_1(): RunTestCase("tests/integration/vars-1.js") - [Test] - def virtual_test(): + + [Test] def virtual_test(): RunTestCase("tests/integration/virtual-test.js") \ No newline at end of file diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index be49a23..765c727 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -5,199 +5,199 @@ import NUnit.Framework partial class ParserTestFixture: - [Test] - def OperationInsideAParam(): + + [Test] def OperationInsideAParam(): RunTestCase("tests/parser/OperationInsideAParam.js") - [Test] - def attributes_1(): + + [Test] def attributes_1(): RunTestCase("tests/parser/attributes-1.js") - [Test] - def class_1(): + + [Test] def class_1(): RunTestCase("tests/parser/class-1.js") - [Test] - def class_2(): + + [Test] def class_2(): RunTestCase("tests/parser/class-2.js") - [Test] - def commentbug(): + + [Test] def commentbug(): RunTestCase("tests/parser/commentbug.js") - [Test] - def final_1(): + + [Test] def final_1(): RunTestCase("tests/parser/final-1.js") - [Test] - def float_literals_1(): + + [Test] def float_literals_1(): RunTestCase("tests/parser/float-literals-1.js") - [Test] - def for_1(): + + [Test] def for_1(): RunTestCase("tests/parser/for-1.js") - [Test] - def for_loop_with_array_1(): + + [Test] def for_loop_with_array_1(): RunTestCase("tests/parser/for-loop-with-array-1.js") - [Test] - def forin_1(): + + [Test] def forin_1(): RunTestCase("tests/parser/forin-1.js") - [Test] - def forin_2(): + + [Test] def forin_2(): RunTestCase("tests/parser/forin-2.js") - [Test] - def function_expression_1(): + + [Test] def function_expression_1(): RunTestCase("tests/parser/function-expression-1.js") - [Test] - def function_types_1(): + + [Test] def function_types_1(): RunTestCase("tests/parser/function-types-1.js") - [Test] - def functions_1(): + + [Test] def functions_1(): RunTestCase("tests/parser/functions-1.js") - [Test] - def functions_2(): + + [Test] def functions_2(): RunTestCase("tests/parser/functions-2.js") - [Test] - def functions_3(): + + [Test] def functions_3(): RunTestCase("tests/parser/functions-3.js") - [Test] - def functions_4(): + + [Test] def functions_4(): RunTestCase("tests/parser/functions-4.js") - [Test] - def functions_5(): + + [Test] def functions_5(): RunTestCase("tests/parser/functions-5.js") - [Test] - def functions_6(): + + [Test] def functions_6(): RunTestCase("tests/parser/functions-6.js") - [Test] - def generic_instantiation_1(): + + [Test] def generic_instantiation_1(): RunTestCase("tests/parser/generic-instantiation-1.js") - [Test] - def globals_1(): + + [Test] def globals_1(): RunTestCase("tests/parser/globals-1.js") - [Test] - def if_1(): + + [Test] def if_1(): RunTestCase("tests/parser/if-1.js") - [Test] - def if_2(): + + [Test] def if_2(): RunTestCase("tests/parser/if-2.js") - [Test] - def if_3(): + + [Test] def if_3(): RunTestCase("tests/parser/if-3.js") - [Test] - def if_4(): + + [Test] def if_4(): RunTestCase("tests/parser/if-4.js") - [Test] - def if_5(): + + [Test] def if_5(): RunTestCase("tests/parser/if-5.js") - [Test] - def if_6(): + + [Test] def if_6(): RunTestCase("tests/parser/if-6.js") - [Test] - def if_7(): + + [Test] def if_7(): RunTestCase("tests/parser/if-7.js") - [Test] - def import_1(): + + [Test] def import_1(): RunTestCase("tests/parser/import-1.js") - [Test] - def inplace_1(): + + [Test] def inplace_1(): RunTestCase("tests/parser/inplace-1.js") - [Test] - def interface_inheritance(): + + [Test] def interface_inheritance(): RunTestCase("tests/parser/interface-inheritance.js") - [Test] - def interfaces_1(): + + [Test] def interfaces_1(): RunTestCase("tests/parser/interfaces-1.js") - [Test] - def new_1(): + + [Test] def new_1(): RunTestCase("tests/parser/new-1.js") - [Test] - def new_2(): + + [Test] def new_2(): RunTestCase("tests/parser/new-2.js") - [Test] - def new_3(): + + [Test] def new_3(): RunTestCase("tests/parser/new-3.js") - [Test] - def new_4(): + + [Test] def new_4(): RunTestCase("tests/parser/new-4.js") - [Test] - def operators_1(): + + [Test] def operators_1(): RunTestCase("tests/parser/operators-1.js") - [Test] - def operators_2(): + + [Test] def operators_2(): RunTestCase("tests/parser/operators-2.js") - [Test] - def operators_3(): + + [Test] def operators_3(): RunTestCase("tests/parser/operators-3.js") - [Test] - def operators_4(): + + [Test] def operators_4(): RunTestCase("tests/parser/operators-4.js") - [Test] - def operators_5(): + + [Test] def operators_5(): RunTestCase("tests/parser/operators-5.js") - [Test] - def override_1(): + + [Test] def override_1(): RunTestCase("tests/parser/override-1.js") - [Test] - def partial_1(): + + [Test] def partial_1(): RunTestCase("tests/parser/partial-1.js") - [Test] - def plusplus_minusminus(): + + [Test] def plusplus_minusminus(): RunTestCase("tests/parser/plusplus-minusminus.js") - [Test] - def scientific_notation(): + + [Test] def scientific_notation(): RunTestCase("tests/parser/scientific-notation.js") - [Test] - def shift_left_bitwise_or(): + + [Test] def shift_left_bitwise_or(): RunTestCase("tests/parser/shift-left-bitwise-or.js") - [Test] - def try_1(): + + [Test] def try_1(): RunTestCase("tests/parser/try-1.js") - [Test] - def var_1(): + + [Test] def var_1(): RunTestCase("tests/parser/var-1.js") - [Test] - def while_1(): + + [Test] def while_1(): RunTestCase("tests/parser/while-1.js") \ No newline at end of file diff --git a/src/UnityScript.Tests/PragmaTestFixture.boo b/src/UnityScript.Tests/PragmaTestFixture.boo index b571568..08a03ef 100644 --- a/src/UnityScript.Tests/PragmaTestFixture.boo +++ b/src/UnityScript.Tests/PragmaTestFixture.boo @@ -6,19 +6,19 @@ import NUnit.Framework [TestFixture] class PragmaTestFixture(AbstractIntegrationTestFixture): - [Test] - def downcast_plus_strict_1(): + + [Test] def downcast_plus_strict_1(): RunTestCase("tests/pragma/downcast-plus-strict-1.js") - [Test] - def downcast_plus_strict_for_arrays(): + + [Test] def downcast_plus_strict_for_arrays(): RunTestCase("tests/pragma/downcast-plus-strict-for-arrays.js") - [Test] - def implicit_1(): + + [Test] def implicit_1(): RunTestCase("tests/pragma/implicit-1.js") - [Test] - def implicit_plus_strict(): + + [Test] def implicit_plus_strict(): RunTestCase("tests/pragma/implicit-plus-strict.js") \ No newline at end of file diff --git a/src/UnityScript.Tests/SemanticsTestFixture.boo b/src/UnityScript.Tests/SemanticsTestFixture.boo index e0c841f..e2eb272 100644 --- a/src/UnityScript.Tests/SemanticsTestFixture.boo +++ b/src/UnityScript.Tests/SemanticsTestFixture.boo @@ -6,39 +6,39 @@ import NUnit.Framework [TestFixture] class SemanticsTestFixture(AbstractSemanticsTestFixture): - [Test] - def Magic2Class(): + + [Test] def Magic2Class(): RunTestCase("tests/semantics/Magic2Class.js") - [Test] - def MagicClass(): + + [Test] def MagicClass(): RunTestCase("tests/semantics/MagicClass.js") - [Test] - def class_3(): + + [Test] def class_3(): RunTestCase("tests/semantics/class-3.js") - [Test] - def coroutine(): + + [Test] def coroutine(): RunTestCase("tests/semantics/coroutine.js") - [Test] - def fields_1(): + + [Test] def fields_1(): RunTestCase("tests/semantics/fields-1.js") - [Test] - def functions_2(): + + [Test] def functions_2(): RunTestCase("tests/semantics/functions-2.js") - [Test] - def magic_members(): + + [Test] def magic_members(): RunTestCase("tests/semantics/magic-members.js") - [Test] - def single_update_function(): + + [Test] def single_update_function(): RunTestCase("tests/semantics/single-update-function.js") - [Test] - def variables(): + + [Test] def variables(): RunTestCase("tests/semantics/variables.js") \ No newline at end of file diff --git a/src/UnityScript.Tests/StackTraceTestFixture.Generated.boo b/src/UnityScript.Tests/StackTraceTestFixture.Generated.boo index 7107afa..21130aa 100755 --- a/src/UnityScript.Tests/StackTraceTestFixture.Generated.boo +++ b/src/UnityScript.Tests/StackTraceTestFixture.Generated.boo @@ -5,27 +5,27 @@ import NUnit.Framework partial class StackTraceTestFixture: - [Test] - def stacktrace_1(): + + [Test] def stacktrace_1(): RunTestCase("tests/stacktrace/stacktrace-1.js") - [Test] - def stacktrace_2(): + [Category("FailsOnMono")] + [Test] def stacktrace_2(): RunTestCase("tests/stacktrace/stacktrace-2.js") - [Test] - def stacktrace_3(): + + [Test] def stacktrace_3(): RunTestCase("tests/stacktrace/stacktrace-3.js") - [Test] - def stacktrace_4(): + + [Test] def stacktrace_4(): RunTestCase("tests/stacktrace/stacktrace-4.js") - [Test] - def stacktrace_5(): + + [Test] def stacktrace_5(): RunTestCase("tests/stacktrace/stacktrace-5.js") - [Test] - def stacktrace_6(): + + [Test] def stacktrace_6(): RunTestCase("tests/stacktrace/stacktrace-6.js") \ No newline at end of file diff --git a/tests/expando/expando-gc-3.js b/tests/expando/expando-gc-3.js index dd38ad2..83fbff8 100755 --- a/tests/expando/expando-gc-3.js +++ b/tests/expando/expando-gc-3.js @@ -1,3 +1,4 @@ +// category FailsOnMono /* 1 0 diff --git a/tests/stacktrace/stacktrace-2.js b/tests/stacktrace/stacktrace-2.js index 81f81c1..35a763c 100644 --- a/tests/stacktrace/stacktrace-2.js +++ b/tests/stacktrace/stacktrace-2.js @@ -1,3 +1,4 @@ +// category FailsOnMono /* stacktrace-2.js:16 stacktrace-2.js:9 From 3bb7c89de3a795990c50afe7dde4b133b528a76b Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 11 Jun 2010 22:58:41 -0300 Subject: [PATCH 010/276] don't exclude any test categories when not running on mono --- default.build | 5 +++-- tests/stacktrace/stacktrace-2.js | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) mode change 100644 => 100755 tests/stacktrace/stacktrace-2.js diff --git a/default.build b/default.build index 185b826..ba8f370 100755 --- a/default.build +++ b/default.build @@ -6,6 +6,7 @@ + @@ -18,7 +19,7 @@ - + @@ -26,7 +27,7 @@ - + diff --git a/tests/stacktrace/stacktrace-2.js b/tests/stacktrace/stacktrace-2.js old mode 100644 new mode 100755 index 35a763c..30dc6f4 --- a/tests/stacktrace/stacktrace-2.js +++ b/tests/stacktrace/stacktrace-2.js @@ -1,7 +1,7 @@ // category FailsOnMono /* -stacktrace-2.js:16 -stacktrace-2.js:9 +stacktrace-2.js:17 +stacktrace-2.js:10 */ import UnityScript.Tests; import System.Runtime.CompilerServices; From 98a8d6f6b426e3b2962487e9a994ed0123d3f1b3 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 12 Jun 2010 11:31:21 -0300 Subject: [PATCH 011/276] minor formatting change --- .../UnityScriptCompilerFactoryTestFixture.boo | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/UnityScript.Tests/UnityScriptCompilerFactoryTestFixture.boo b/src/UnityScript.Tests/UnityScriptCompilerFactoryTestFixture.boo index b332748..db3dddd 100644 --- a/src/UnityScript.Tests/UnityScriptCompilerFactoryTestFixture.boo +++ b/src/UnityScript.Tests/UnityScriptCompilerFactoryTestFixture.boo @@ -12,11 +12,13 @@ class UnityScriptCompilerFactoryTestFixture: options = CommandLineOptions( "-d:FOO", "--define:BAR", - "-method:Awake", "-base:${typeof(MonoBehaviour).FullName}", - "-r:${GetAssemblyLocation()}") + "-method:Awake", "-base:${typeof(MonoBehaviour).FullName}", "-r:${GetAssemblyLocation()}") compiler = UnityScriptCompilerFactory.FromCommandLineOptions(options) Assert.AreEqual(["FOO", "BAR"], [define for define in compiler.Parameters.Defines.Keys]) + + + \ No newline at end of file From 4fee514eec5b93a2b55767baf3fb69ea2b4909a8 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 12 Jun 2010 11:32:05 -0300 Subject: [PATCH 012/276] use generic list instead --- src/us/CommandLineOptions.boo | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/us/CommandLineOptions.boo b/src/us/CommandLineOptions.boo index 13da33e..6e797f3 100755 --- a/src/us/CommandLineOptions.boo +++ b/src/us/CommandLineOptions.boo @@ -16,13 +16,13 @@ class CommandLineOptions(AbstractCommandLine): _outputTarget = CompilerOutputType.Library [getter(Imports)] - _imports = [] + _imports = List of string() [getter(SourceFiles)] - _sourceFiles = [] + _sourceFiles = List of string() [getter(SourceDirs)] - _srcDirs = [] + _srcDirs = List of string() [getter(SuppressedWarnings)] _suppressedWarnings = [] From 312374b5411e8c55eae6cadb2ba20bb7caae5e63 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 12 Jun 2010 11:32:23 -0300 Subject: [PATCH 013/276] fix obsolete api usage --- src/us/us.boo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/us/us.boo b/src/us/us.boo index b5e7dd1..a9f6d13 100755 --- a/src/us/us.boo +++ b/src/us/us.boo @@ -70,7 +70,7 @@ def parseCommandLineOptions(argv as (string)): return CommandLineOptions(*argv) def parseResponseFile(responseFile as string): - args = [] + args = List of string() using reader = File.OpenText(responseFile): for line in reader: @@ -78,7 +78,7 @@ def parseResponseFile(responseFile as string): continue if len(arg) == 0 args.Add(unquote(arg)) - return array(string, args) + return args.ToArray() def unquote(s as string): if s.StartsWith('"'): return s[1:-1] From a12a67b05c17b4daeae93f1a7e6ff55430dc62ba Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 12 Jun 2010 11:33:18 -0300 Subject: [PATCH 014/276] -srcdir:dir should recurse --- .../CommandLineOptionsTestFixture.boo | 32 ++++++++++++++++++- src/us/CommandLineOptions.boo | 9 +++--- src/us/UnityScriptCompilerFactory.boo | 2 +- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo b/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo index 7f72544..afcde51 100644 --- a/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo +++ b/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo @@ -1,5 +1,6 @@ namespace UnityScript.Tests +import System.IO import NUnit.Framework [TestFixture] @@ -8,4 +9,33 @@ class CommandLineOptionsTestFixture: [Test] def Defines(): options = us.CommandLineOptions("-d:FOO", "--define:BAR") - assert options.Defines == ["FOO", "BAR"] \ No newline at end of file + assert options.Defines == ["FOO", "BAR"] + + + [Test] + def SourceDirectoriesAreRecursivelyScanned(): + dir = CreateTempDirectory() + + files = "a.js", "Sub1/b.js", "Sub1/c.js", "Sub1/Sub2/d.js", "Sub1/Sub2/Sub3/Sub4/e.js" + CreateFilesOn(dir, files) + + options = us.CommandLineOptions("-srcdir:${dir}") + + actualFiles = List of string() + options.ForEachSourceFile(actualFiles.Add) + + Assert.AreEqual( + array(Path.Combine(dir, file) for file in files), + actualFiles.ToArray()) + +def CreateFilesOn(dir as string, files as string*): + for file in files: + fullName = Path.Combine(dir, file) + Directory.CreateDirectory(Path.GetDirectoryName(fullName)) + File.WriteAllText(fullName, "") + +def CreateTempDirectory(): + tmp = Path.GetTempFileName() + File.Delete(tmp) + Directory.CreateDirectory(tmp) + return tmp diff --git a/src/us/CommandLineOptions.boo b/src/us/CommandLineOptions.boo index 6e797f3..180e8a7 100755 --- a/src/us/CommandLineOptions.boo +++ b/src/us/CommandLineOptions.boo @@ -1,5 +1,6 @@ namespace us +import System import System.IO import Boo.Lang.Compiler import Boo.Lang.Useful.CommandLine @@ -36,15 +37,13 @@ class CommandLineOptions(AbstractCommandLine): def constructor(*argv as (string)): Parse(argv) - def GetAllSourceFiles(): + def ForEachSourceFile(action as Action of string): for srcFile as string in _sourceFiles: - yield srcFile + action(srcFile) for srcDir in _srcDirs: - for fname in Directory.GetFiles(srcDir, "*.js"): - yield fname - + Useful.IO.forEachFileIn(srcDir, "*.js", action) IsValid: get: diff --git a/src/us/UnityScriptCompilerFactory.boo b/src/us/UnityScriptCompilerFactory.boo index d505da7..a19da39 100644 --- a/src/us/UnityScriptCompilerFactory.boo +++ b/src/us/UnityScriptCompilerFactory.boo @@ -20,7 +20,7 @@ class UnityScriptCompilerFactory: assemblies.Add(asm) compiler.Parameters.References.Add(asm) - for fname in options.GetAllSourceFiles(): + options.ForEachSourceFile() do (fname): compiler.Parameters.Input.Add(FileInput(fname)) for resource in options.Resources: From f5c0bcc394037729adb522f7c16480eb67bfc957 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 12 Jun 2010 11:43:36 -0300 Subject: [PATCH 015/276] normalize directory separators before comparison so test works on all platforms --- src/UnityScript.Tests/CommandLineOptionsTestFixture.boo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 src/UnityScript.Tests/CommandLineOptionsTestFixture.boo diff --git a/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo b/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo old mode 100644 new mode 100755 index afcde51..f5929ac --- a/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo +++ b/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo @@ -25,7 +25,7 @@ class CommandLineOptionsTestFixture: options.ForEachSourceFile(actualFiles.Add) Assert.AreEqual( - array(Path.Combine(dir, file) for file in files), + array(Path.Combine(dir, file).Replace(char('/'), Path.DirectorySeparatorChar) for file in files), actualFiles.ToArray()) def CreateFilesOn(dir as string, files as string*): From 3c9177c0d1e22c6d47067842c5b3a7a1d1e71ba1 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sun, 13 Jun 2010 11:12:28 -0300 Subject: [PATCH 016/276] a bit of documentation --- refresh-tests.boo | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/refresh-tests.boo b/refresh-tests.boo index 87eddd8..777c475 100755 --- a/refresh-tests.boo +++ b/refresh-tests.boo @@ -1,6 +1,10 @@ #!/usr/bin/env booi """ Generates test fixtures from files under tests/ + +First line of test case can specify a nunit attribute to go with it: + * "// ignore reason" for [Ignore("reason")] + * "// category name" for [Category("name")] """ import System import System.IO From ad227fbe5543304b7c715107341d447920973dfe Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sun, 13 Jun 2010 21:42:34 -0300 Subject: [PATCH 017/276] better names --- src/UnityScript/Steps/ApplySemantics.boo | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/UnityScript/Steps/ApplySemantics.boo b/src/UnityScript/Steps/ApplySemantics.boo index a231b5f..c0ad8fd 100755 --- a/src/UnityScript/Steps/ApplySemantics.boo +++ b/src/UnityScript/Steps/ApplySemantics.boo @@ -52,7 +52,7 @@ class ApplySemantics(AbstractVisitorCompilerStep): TransformGlobalVariablesIntoFields(module, script) - main = FindExistingMainMethodOn(script) + main = ExistingMainMethodOn(script) if main is null: main = CreateMainMethod(module) script.Members.Add(main) @@ -67,13 +67,13 @@ class ApplySemantics(AbstractVisitorCompilerStep): return module.Globals.Accept(DeclareGlobalVariables(script)) - def FindExistingMainMethodOn(typeDef as TypeDefinition): + def ExistingMainMethodOn(typeDef as TypeDefinition): for member in typeDef.Members: method = member as Method - found = method is not null \ + isMainMethod = method is not null \ and method.Name == ScriptMainMethod \ and len(method.Parameters) == 0 - return method if found + return method if isMainMethod def SetUpScriptClass(global as ClassDefinition): global.Modifiers |= TypeMemberModifiers.Partial From 7238291901c835d3563675113965a4dd7369df3a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 14 Jun 2010 13:46:14 -0300 Subject: [PATCH 018/276] one more test case for exponential notation --- tests/parser/scientific-notation.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/parser/scientific-notation.js b/tests/parser/scientific-notation.js index a273d5c..a635475 100644 --- a/tests/parser/scientific-notation.js +++ b/tests/parser/scientific-notation.js @@ -2,8 +2,10 @@ f1 = 10.0F f2 = 0.1F f3 = 1.0F +f4 = 0.00173F */ f1 = 0.1e+2; f2 = 10e-2; f3 = 0.0000000001e+10; +f4 = 1.73e-3; From 90c14e0c9b062d804c5a4d44bb2425ca5cddade5 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 23 Jun 2010 10:54:33 -0300 Subject: [PATCH 019/276] simplify the use of Eval from other languages --- .../Scripting/EvaluatorTest.boo | 18 ++++++++++++++++++ .../UnityScript.Tests.booproj | 4 ++++ .../Scripting/EvaluationContext.boo | 3 +++ src/UnityScript/Scripting/Evaluator.boo | 6 ++++++ .../Pipeline/IntroduceScriptingNamespace.boo | 7 ++++++- src/UnityScript/Steps/PreProcess.boo | 1 - src/us/us.boo | 1 - 7 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 src/UnityScript.Tests/Scripting/EvaluatorTest.boo diff --git a/src/UnityScript.Tests/Scripting/EvaluatorTest.boo b/src/UnityScript.Tests/Scripting/EvaluatorTest.boo new file mode 100644 index 0000000..40894dc --- /dev/null +++ b/src/UnityScript.Tests/Scripting/EvaluatorTest.boo @@ -0,0 +1,18 @@ +namespace UnityScript.Tests.Scripting + +import NUnit.Framework +import UnityScript.Scripting + +[TestFixture] +class EvaluatorTest: + + [Test] + def SimpleEvalWithNoImports(): + + Assert.AreEqual(4, Evaluator.Eval(EvaluationContext(), "2 + 2")) + + [Test] + def SimpleEvalWithImports(): + + ctx = EvaluationContext(SimpleEvaluationDomainProvider("System.IO")) + Assert.AreEqual(".js", Evaluator.Eval(ctx, 'Path.GetExtension("file.js")')) diff --git a/src/UnityScript.Tests/UnityScript.Tests.booproj b/src/UnityScript.Tests/UnityScript.Tests.booproj index 16793ba..228a0c8 100755 --- a/src/UnityScript.Tests/UnityScript.Tests.booproj +++ b/src/UnityScript.Tests/UnityScript.Tests.booproj @@ -66,6 +66,7 @@ + @@ -85,4 +86,7 @@ us + + + \ No newline at end of file diff --git a/src/UnityScript/Scripting/EvaluationContext.boo b/src/UnityScript/Scripting/EvaluationContext.boo index 5c2ea85..a208719 100755 --- a/src/UnityScript/Scripting/EvaluationContext.boo +++ b/src/UnityScript/Scripting/EvaluationContext.boo @@ -16,6 +16,9 @@ class EvaluationContext: def constructor(container as IEvaluationDomainProvider): _container = container or SimpleEvaluationDomainProvider() + def constructor(): + _container = SimpleEvaluationDomainProvider() + IsStaticContext: get: return SimpleEvaluationDomainProvider is _container.GetType() diff --git a/src/UnityScript/Scripting/Evaluator.boo b/src/UnityScript/Scripting/Evaluator.boo index 141a230..1f4af41 100755 --- a/src/UnityScript/Scripting/Evaluator.boo +++ b/src/UnityScript/Scripting/Evaluator.boo @@ -29,6 +29,12 @@ inside a static method. private _domain = EvaluationDomain() private _imports as (string) + def constructor(): + pass + + def constructor(*imports as (string)): + _imports = imports + def GetImports(): return _imports diff --git a/src/UnityScript/Scripting/Pipeline/IntroduceScriptingNamespace.boo b/src/UnityScript/Scripting/Pipeline/IntroduceScriptingNamespace.boo index b7ce0b8..fd49ceb 100755 --- a/src/UnityScript/Scripting/Pipeline/IntroduceScriptingNamespace.boo +++ b/src/UnityScript/Scripting/Pipeline/IntroduceScriptingNamespace.boo @@ -67,7 +67,12 @@ class EvaluationContextNamespace(INamespace): _parent = parent _context = context _contextNamespace = tss.Map(_context.GetType()) - _scriptContainerNamespace = tss.Map(_context.GetType().DeclaringType) + + // the UnityScript compiler will nest EvaluationContext subclasses in the type + // doing the eval so it can be discovered and have its members accessible to the + // script + contextContainerType = _context.GetType().DeclaringType + _scriptContainerNamespace = (tss.Map(contextContainerType) if contextContainerType is not null else NullNamespace.Default) _activeScripts = _context.GetActiveScripts() Name: diff --git a/src/UnityScript/Steps/PreProcess.boo b/src/UnityScript/Steps/PreProcess.boo index 59d8287..da301f5 100644 --- a/src/UnityScript/Steps/PreProcess.boo +++ b/src/UnityScript/Steps/PreProcess.boo @@ -10,7 +10,6 @@ class PreProcess(AbstractCompilerStep): override def Run(): processed = List[of ICompilerInput]() - for input in Parameters.Input: processed.Add(RunPreProcessorOn(input)) diff --git a/src/us/us.boo b/src/us/us.boo index a9f6d13..86a7689 100755 --- a/src/us/us.boo +++ b/src/us/us.boo @@ -51,7 +51,6 @@ def banner(): def run(argv as (string)): options = parseCommandLineOptions(argv) - if options.IsValid and not options.DoHelp: try: return compile(options) From 8d99228fcb3ea38446f6ecb11a2d7015fa53b171 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 23 Jun 2010 11:15:37 -0300 Subject: [PATCH 020/276] update-boo-libs is no longer used --- default.build | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/default.build b/default.build index ba8f370..f17335b 100755 --- a/default.build +++ b/default.build @@ -163,20 +163,6 @@ - - - - - - - - - - - - - - From c2e8b802b0799016b6d370b69ebd65ba4091ff4f Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 23 Jun 2010 11:15:53 -0300 Subject: [PATCH 021/276] use generic list instead --- src/us/CommandLineOptions.boo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/us/CommandLineOptions.boo b/src/us/CommandLineOptions.boo index 180e8a7..aaf7236 100755 --- a/src/us/CommandLineOptions.boo +++ b/src/us/CommandLineOptions.boo @@ -29,7 +29,7 @@ class CommandLineOptions(AbstractCommandLine): _suppressedWarnings = [] [getter(Defines)] - _defines = [] + _defines = List of string() [getter(Pragmas)] _pragmas = List of string() From 85163e797d5cbb20817749301baec33d84dc4368 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 23 Jun 2010 12:15:37 -0300 Subject: [PATCH 022/276] TypeSystemServices.GetOptionalEntity has been deprecated --- .../Scripting/Pipeline/ProcessScriptingMethods.boo | 6 +----- src/UnityScript/Steps/ProcessEvalInvocations.boo | 4 ++-- src/UnityScript/Steps/ProcessUnityScriptMethods.boo | 4 ++-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/UnityScript/Scripting/Pipeline/ProcessScriptingMethods.boo b/src/UnityScript/Scripting/Pipeline/ProcessScriptingMethods.boo index 94ad360..d502a90 100755 --- a/src/UnityScript/Scripting/Pipeline/ProcessScriptingMethods.boo +++ b/src/UnityScript/Scripting/Pipeline/ProcessScriptingMethods.boo @@ -25,7 +25,7 @@ they point to EvaluationContext provided members. override def OnReferenceExpression(node as ReferenceExpression): super(node) - entity = GetOptionalEntity(node) as EvaluationContextEntity + entity = node.Entity as EvaluationContextEntity if entity is null: return if not ValidateContext(entity): @@ -86,7 +86,3 @@ they point to EvaluationContext provided members. def GetScriptClassType(): return GetEntity(GetScriptClass(Context)) - - def GetOptionalEntity(node as Node): - return self.TypeSystemServices.GetOptionalEntity(node) - diff --git a/src/UnityScript/Steps/ProcessEvalInvocations.boo b/src/UnityScript/Steps/ProcessEvalInvocations.boo index 5a8ab70..47ae1c2 100755 --- a/src/UnityScript/Steps/ProcessEvalInvocations.boo +++ b/src/UnityScript/Steps/ProcessEvalInvocations.boo @@ -48,7 +48,7 @@ class ProcessEvalInvocations(AbstractVisitorCompilerStep): override def OnReferenceExpression(node as ReferenceExpression): - entity = TypeSystemServices.GetOptionalEntity(node) as IInternalEntity + entity = node.Entity as IInternalEntity if entity is null: return field = GetEvaluationContextField(entity.Node) @@ -148,7 +148,7 @@ class ProcessEvalInvocations(AbstractVisitorCompilerStep): ReplaceEvalByEvaluatorEval(node) def IsEvalInvocation(node as MethodInvocationExpression): - return TypeSystemServices.GetOptionalEntity(node.Target) is UnityScriptTypeSystem.UnityScriptEval + return node.Target.Entity is UnityScriptTypeSystem.UnityScriptEval def ImplementIEvaluationDomainProvider(node as ClassDefinition): node.BaseTypes.Add(CodeBuilder.CreateTypeReference(IEvaluationDomainProvider)) diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index fca306d..04e7025 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -127,7 +127,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): Error(node, CompilerError("UCE0001", node.Target.LexicalInfo, "'typeof' takes a single argument.", null)) return - type = TypeSystemServices.GetOptionalEntity(node.Arguments[0]) as IType + type = node.Arguments[0].Entity as IType if type is not null: node.ParentNode.Replace(node, CodeBuilder.CreateTypeofExpression(type)) return @@ -283,5 +283,5 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): override def OnReferenceExpression(node as ReferenceExpression): if _found: return - referent = _context.TypeSystemServices.GetOptionalEntity(node) + referent = node.Entity _found = referent is _loopVariable From c11f7f8760b64d7aa5ad813ba5b36b8698836c5c Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 23 Jun 2010 12:15:44 -0300 Subject: [PATCH 023/276] fix for Eval --- src/UnityScript/Steps/ProcessEvalInvocations.boo | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/UnityScript/Steps/ProcessEvalInvocations.boo b/src/UnityScript/Steps/ProcessEvalInvocations.boo index 47ae1c2..c6c26cd 100755 --- a/src/UnityScript/Steps/ProcessEvalInvocations.boo +++ b/src/UnityScript/Steps/ProcessEvalInvocations.boo @@ -80,7 +80,7 @@ class ProcessEvalInvocations(AbstractVisitorCompilerStep): CodeBuilder.CreateAssignment( CreateEvaluationContextReference(), CodeBuilder.CreateConstructorInvocation( - DefaultConstructorFor(evaluationContextType), + ConstructorTakingNArgumentsFor(evaluationContextType, 1), GetSelfReferenceIfInInstanceMethod()))) for parameter in CurrentMethodNode.Parameters: @@ -185,16 +185,17 @@ class ProcessEvalInvocations(AbstractVisitorCompilerStep): ifDomainField.TrueBlock.Add( CodeBuilder.CreateFieldAssignment( domainField, - CodeBuilder.CreateConstructorInvocation(DefaultConstructorFor(evaluationDomainType)))) + CodeBuilder.CreateConstructorInvocation(ConstructorTakingNArgumentsFor(evaluationDomainType, 0)))) builder.Body.Add(ifDomainField) // return _domain builder.Body.Add(ReturnStatement(CodeBuilder.CreateReference(domainField))) - def DefaultConstructorFor(type as IType): - first, = type.GetConstructors() - return first + def ConstructorTakingNArgumentsFor(type as IType, arguments as int): + for ctor in type.GetConstructors(): + return ctor if len(ctor.GetParameters()) == arguments + raise "no constructor in $type taking $arguments arguments" def AddVirtualMethod(node as ClassDefinition, name as string, returnType as IType): builder = BooMethodBuilder( From 9633b11d9ea576f95c8b89cad519f5723a97d45e Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 23 Jun 2010 12:22:11 -0300 Subject: [PATCH 024/276] CommandLineOptions.Defines is a generic list now --- src/UnityScript.Tests/CommandLineOptionsTestFixture.boo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo b/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo index f5929ac..8333129 100755 --- a/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo +++ b/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo @@ -9,7 +9,7 @@ class CommandLineOptionsTestFixture: [Test] def Defines(): options = us.CommandLineOptions("-d:FOO", "--define:BAR") - assert options.Defines == ["FOO", "BAR"] + Assert.AreEqual(("FOO", "BAR"), options.Defines.ToArray()) [Test] From 52daa4c6812a4b69039fed6267a16776f835b7ae Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 23 Jun 2010 13:15:16 -0300 Subject: [PATCH 025/276] temporarily remove broken constructors --- src/UnityScript.Tests/Scripting/EvaluatorTest.boo | 6 +++--- src/UnityScript/Scripting/EvaluationContext.boo | 3 --- src/UnityScript/Scripting/Evaluator.boo | 6 ------ src/us/us.boo | 1 - 4 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/UnityScript.Tests/Scripting/EvaluatorTest.boo b/src/UnityScript.Tests/Scripting/EvaluatorTest.boo index 40894dc..6a6a9fc 100644 --- a/src/UnityScript.Tests/Scripting/EvaluatorTest.boo +++ b/src/UnityScript.Tests/Scripting/EvaluatorTest.boo @@ -9,10 +9,10 @@ class EvaluatorTest: [Test] def SimpleEvalWithNoImports(): - Assert.AreEqual(4, Evaluator.Eval(EvaluationContext(), "2 + 2")) + Assert.AreEqual(4, Evaluator.Eval(EvaluationContext(null), "2 + 2")) [Test] def SimpleEvalWithImports(): - + pass /* ctx = EvaluationContext(SimpleEvaluationDomainProvider("System.IO")) - Assert.AreEqual(".js", Evaluator.Eval(ctx, 'Path.GetExtension("file.js")')) + Assert.AreEqual(".js", Evaluator.Eval(ctx, 'Path.GetExtension("file.js")'))*/ diff --git a/src/UnityScript/Scripting/EvaluationContext.boo b/src/UnityScript/Scripting/EvaluationContext.boo index a208719..5c2ea85 100755 --- a/src/UnityScript/Scripting/EvaluationContext.boo +++ b/src/UnityScript/Scripting/EvaluationContext.boo @@ -16,9 +16,6 @@ class EvaluationContext: def constructor(container as IEvaluationDomainProvider): _container = container or SimpleEvaluationDomainProvider() - def constructor(): - _container = SimpleEvaluationDomainProvider() - IsStaticContext: get: return SimpleEvaluationDomainProvider is _container.GetType() diff --git a/src/UnityScript/Scripting/Evaluator.boo b/src/UnityScript/Scripting/Evaluator.boo index 1f4af41..141a230 100755 --- a/src/UnityScript/Scripting/Evaluator.boo +++ b/src/UnityScript/Scripting/Evaluator.boo @@ -29,12 +29,6 @@ inside a static method. private _domain = EvaluationDomain() private _imports as (string) - def constructor(): - pass - - def constructor(*imports as (string)): - _imports = imports - def GetImports(): return _imports diff --git a/src/us/us.boo b/src/us/us.boo index 86a7689..cb21c04 100755 --- a/src/us/us.boo +++ b/src/us/us.boo @@ -25,7 +25,6 @@ def getAssemblyAttribute(type as System.Type): return Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), type) def compile(options as CommandLineOptions): - compiler = UnityScriptCompilerFactory.FromCommandLineOptions(options) results = compiler.Run() if len(results.Errors): From b3b7ccf3a275cbd9e503d87d131683baf1d40bce Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 23 Jun 2010 13:25:28 -0300 Subject: [PATCH 026/276] revert eval change --- .../Scripting/Pipeline/IntroduceScriptingNamespace.boo | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/UnityScript/Scripting/Pipeline/IntroduceScriptingNamespace.boo b/src/UnityScript/Scripting/Pipeline/IntroduceScriptingNamespace.boo index fd49ceb..5f48947 100755 --- a/src/UnityScript/Scripting/Pipeline/IntroduceScriptingNamespace.boo +++ b/src/UnityScript/Scripting/Pipeline/IntroduceScriptingNamespace.boo @@ -67,13 +67,9 @@ class EvaluationContextNamespace(INamespace): _parent = parent _context = context _contextNamespace = tss.Map(_context.GetType()) - - // the UnityScript compiler will nest EvaluationContext subclasses in the type - // doing the eval so it can be discovered and have its members accessible to the - // script - contextContainerType = _context.GetType().DeclaringType - _scriptContainerNamespace = (tss.Map(contextContainerType) if contextContainerType is not null else NullNamespace.Default) _activeScripts = _context.GetActiveScripts() + _scriptContainerNamespace = tss.Map(_context.GetType().DeclaringType) + Name: get: return "EvaluationContext" From 34014eada8982aa48b06c0073bc243933765efd4 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 23 Jun 2010 13:39:55 -0300 Subject: [PATCH 027/276] no more dependencies on Boo.Lang.Interpreter --- default.build | 3 --- 1 file changed, 3 deletions(-) diff --git a/default.build b/default.build index f17335b..892fcd6 100755 --- a/default.build +++ b/default.build @@ -115,9 +115,6 @@ - - - Date: Wed, 23 Jun 2010 13:40:11 -0300 Subject: [PATCH 028/276] allow boo.dir to be specified in build.properties --- default.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.build b/default.build index 892fcd6..ce6398c 100755 --- a/default.build +++ b/default.build @@ -4,7 +4,7 @@ - + From 0876f25c43a3d58e7c0bf8e67a3e2efe8fb07b01 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 23 Jun 2010 13:40:45 -0300 Subject: [PATCH 029/276] extract SimpleEvaluationDomainProvider to its own file --- src/UnityScript/Scripting/Evaluator.boo | 14 -------------- .../SimpleEvaluationDomainProvider.boo | 17 +++++++++++++++++ src/UnityScript/UnityScript.booproj | 1 + 3 files changed, 18 insertions(+), 14 deletions(-) create mode 100644 src/UnityScript/Scripting/SimpleEvaluationDomainProvider.boo diff --git a/src/UnityScript/Scripting/Evaluator.boo b/src/UnityScript/Scripting/Evaluator.boo index 141a230..dbd386d 100755 --- a/src/UnityScript/Scripting/Evaluator.boo +++ b/src/UnityScript/Scripting/Evaluator.boo @@ -21,20 +21,6 @@ Every script in UnityScript defines a new EvaluationDomain. def GetImports() as (string) def GetEvaluationDomain() as EvaluationDomain -class SimpleEvaluationDomainProvider(IEvaluationDomainProvider): -""" -SimpleEvaluationDomainProvider is used whenever there's an eval invocation -inside a static method. -""" - private _domain = EvaluationDomain() - private _imports as (string) - - def GetImports(): - return _imports - - def GetEvaluationDomain() as EvaluationDomain: - return _domain - class EvaluationDomain: """ Groups together a set of related EvaluationScripts instances. diff --git a/src/UnityScript/Scripting/SimpleEvaluationDomainProvider.boo b/src/UnityScript/Scripting/SimpleEvaluationDomainProvider.boo new file mode 100644 index 0000000..da4ac02 --- /dev/null +++ b/src/UnityScript/Scripting/SimpleEvaluationDomainProvider.boo @@ -0,0 +1,17 @@ +namespace UnityScript.Scripting + +class SimpleEvaluationDomainProvider(IEvaluationDomainProvider): +""" +SimpleEvaluationDomainProvider is used whenever there's an eval invocation +inside a static method. +""" + private _domain = EvaluationDomain() + private _imports as (string) + + def GetImports(): + return _imports + + def GetEvaluationDomain(): + return _domain + + diff --git a/src/UnityScript/UnityScript.booproj b/src/UnityScript/UnityScript.booproj index 1ab379e..1755ad3 100755 --- a/src/UnityScript/UnityScript.booproj +++ b/src/UnityScript/UnityScript.booproj @@ -75,6 +75,7 @@ + From 8934cce94bdcbe0b02557be92bb1ae6eaecc0d3e Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 23 Jun 2010 14:04:14 -0300 Subject: [PATCH 030/276] generic lists --- src/UnityScript/Steps/SuppressWarnings.boo | 4 ++-- src/us/CommandLineOptions.boo | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/UnityScript/Steps/SuppressWarnings.boo b/src/UnityScript/Steps/SuppressWarnings.boo index 46143c3..5686120 100755 --- a/src/UnityScript/Steps/SuppressWarnings.boo +++ b/src/UnityScript/Steps/SuppressWarnings.boo @@ -5,9 +5,9 @@ import Boo.Lang.Compiler.Steps class SuppressWarnings(AbstractCompilerStep): - _suppressed as Boo.Lang.List + _suppressed as List of string - def constructor(suppressed as Boo.Lang.List): + def constructor(suppressed as List of string): _suppressed = suppressed override def Run(): diff --git a/src/us/CommandLineOptions.boo b/src/us/CommandLineOptions.boo index aaf7236..8664848 100755 --- a/src/us/CommandLineOptions.boo +++ b/src/us/CommandLineOptions.boo @@ -8,10 +8,10 @@ import Boo.Lang.Useful.CommandLine class CommandLineOptions(AbstractCommandLine): [getter(References)] - _references = [] + _references = List of string() [getter(Resources)] - _resources = [] + _resources = List of string() [getter(OutputType)] _outputTarget = CompilerOutputType.Library @@ -26,7 +26,7 @@ class CommandLineOptions(AbstractCommandLine): _srcDirs = List of string() [getter(SuppressedWarnings)] - _suppressedWarnings = [] + _suppressedWarnings = List of string() [getter(Defines)] _defines = List of string() From cc1efa287e703a98ec111c3a05c605b7d599abc6 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 23 Jun 2010 14:04:44 -0300 Subject: [PATCH 031/276] convenient Eval api is back --- src/UnityScript.Tests/Scripting/EvaluatorTest.boo | 5 ++--- src/UnityScript/Scripting/EvaluationContext.boo | 3 +++ .../Scripting/Pipeline/IntroduceScriptingNamespace.boo | 7 ++++--- .../Scripting/SimpleEvaluationDomainProvider.boo | 6 ++++++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/UnityScript.Tests/Scripting/EvaluatorTest.boo b/src/UnityScript.Tests/Scripting/EvaluatorTest.boo index 6a6a9fc..54ad283 100644 --- a/src/UnityScript.Tests/Scripting/EvaluatorTest.boo +++ b/src/UnityScript.Tests/Scripting/EvaluatorTest.boo @@ -9,10 +9,9 @@ class EvaluatorTest: [Test] def SimpleEvalWithNoImports(): - Assert.AreEqual(4, Evaluator.Eval(EvaluationContext(null), "2 + 2")) + Assert.AreEqual(4, Evaluator.Eval(EvaluationContext(), "2 + 2")) [Test] def SimpleEvalWithImports(): - pass /* ctx = EvaluationContext(SimpleEvaluationDomainProvider("System.IO")) - Assert.AreEqual(".js", Evaluator.Eval(ctx, 'Path.GetExtension("file.js")'))*/ + Assert.AreEqual(".js", Evaluator.Eval(ctx, 'Path.GetExtension("file.js")')) diff --git a/src/UnityScript/Scripting/EvaluationContext.boo b/src/UnityScript/Scripting/EvaluationContext.boo index 5c2ea85..a208719 100755 --- a/src/UnityScript/Scripting/EvaluationContext.boo +++ b/src/UnityScript/Scripting/EvaluationContext.boo @@ -16,6 +16,9 @@ class EvaluationContext: def constructor(container as IEvaluationDomainProvider): _container = container or SimpleEvaluationDomainProvider() + def constructor(): + _container = SimpleEvaluationDomainProvider() + IsStaticContext: get: return SimpleEvaluationDomainProvider is _container.GetType() diff --git a/src/UnityScript/Scripting/Pipeline/IntroduceScriptingNamespace.boo b/src/UnityScript/Scripting/Pipeline/IntroduceScriptingNamespace.boo index 5f48947..dbf6fd9 100755 --- a/src/UnityScript/Scripting/Pipeline/IntroduceScriptingNamespace.boo +++ b/src/UnityScript/Scripting/Pipeline/IntroduceScriptingNamespace.boo @@ -66,10 +66,11 @@ class EvaluationContextNamespace(INamespace): _tss = tss _parent = parent _context = context - _contextNamespace = tss.Map(_context.GetType()) - _activeScripts = _context.GetActiveScripts() - _scriptContainerNamespace = tss.Map(_context.GetType().DeclaringType) + contextType = tss.Map(_context.GetType()) + _contextNamespace = contextType + _scriptContainerNamespace = contextType.DeclaringEntity or NullNamespace.Default + _activeScripts = _context.GetActiveScripts() Name: get: return "EvaluationContext" diff --git a/src/UnityScript/Scripting/SimpleEvaluationDomainProvider.boo b/src/UnityScript/Scripting/SimpleEvaluationDomainProvider.boo index da4ac02..a373c26 100644 --- a/src/UnityScript/Scripting/SimpleEvaluationDomainProvider.boo +++ b/src/UnityScript/Scripting/SimpleEvaluationDomainProvider.boo @@ -8,6 +8,12 @@ inside a static method. private _domain = EvaluationDomain() private _imports as (string) + def constructor(): + pass + + def constructor(*imports as (string)): + _imports = imports + def GetImports(): return _imports From dad0011df7b9e4de5490f1027ea71e5d743e42cd Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 23 Jun 2010 14:22:40 -0300 Subject: [PATCH 032/276] don't try to add referenced assemblies unless the context is coming from unityscript generated code (EvaluationContext would be a nested type then) --- src/UnityScript/Scripting/Evaluator.boo | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/UnityScript/Scripting/Evaluator.boo b/src/UnityScript/Scripting/Evaluator.boo index dbd386d..cd585d3 100755 --- a/src/UnityScript/Scripting/Evaluator.boo +++ b/src/UnityScript/Scripting/Evaluator.boo @@ -122,10 +122,7 @@ class Evaluator: compiler.Parameters.Debug = false compiler.Parameters.GenerateInMemory = true - contextAssembly = _context.GetType().Assembly - compiler.Parameters.References.Add(contextAssembly) - for name in contextAssembly.GetReferencedAssemblies(): - compiler.Parameters.References.Add(System.Reflection.Assembly.Load(name)) + AddEvaluationContextReferencesTo(compiler) _compilationResult = compiler.Run() if len(_compilationResult.Errors): @@ -134,6 +131,16 @@ class Evaluator: #print _compilationResult.CompileUnit.ToCodeString() return _compilationResult.GeneratedAssembly.GetType("script") + private def AddEvaluationContextReferencesTo(compiler as UnityScriptCompiler): + contextType = _context.GetType() + if contextType.DeclaringType is null: + return + + contextAssembly = contextType.Assembly + compiler.Parameters.References.Add(contextAssembly) + for name in contextAssembly.GetReferencedAssemblies(): + compiler.Parameters.References.Add(System.Reflection.Assembly.Load(name)) + static def AdjustPipeline(context as EvaluationContext, pipeline as CompilerPipeline): pipeline.InsertAfter( UnityScript.Steps.IntroduceUnityGlobalNamespaces, From 07c0307c89d213584bb7735a4b1c48b8fa79482a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 26 Jun 2010 12:31:43 -0300 Subject: [PATCH 033/276] moved unityscript type system classes to UnityScript.TypeSystem --- src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo | 4 +++- src/UnityScript/Steps/InitializeUnityScriptTypeSystem.boo | 1 + src/UnityScript/Steps/ProcessEvalInvocations.boo | 1 + src/UnityScript/Steps/ProcessUnityScriptMethods.boo | 3 ++- .../{Steps => TypeSystem}/UnityCallableResolutionService.boo | 2 +- .../{Steps => TypeSystem}/UnityDowncastPermissions.boo | 2 +- .../{Steps => TypeSystem}/UnityScriptTypeSystem.boo | 2 +- 7 files changed, 10 insertions(+), 5 deletions(-) rename src/UnityScript/{Steps => TypeSystem}/UnityCallableResolutionService.boo (94%) rename src/UnityScript/{Steps => TypeSystem}/UnityDowncastPermissions.boo (95%) rename src/UnityScript/{Steps => TypeSystem}/UnityScriptTypeSystem.boo (95%) diff --git a/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo b/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo index 97c00b7..3e29ac3 100755 --- a/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo +++ b/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo @@ -5,6 +5,8 @@ import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.TypeSystem import Boo.Lang.Compiler.Steps +import UnityScript.TypeSystem + class ExpandUnityDuckTypedExpressions(ExpandDuckTypedExpressions): private UnityRuntimeServices_Invoke as IMethod @@ -37,7 +39,7 @@ class ExpandUnityDuckTypedExpressions(ExpandDuckTypedExpressions): def ResolveUnityRuntimeMethod(methodName as string): return NameResolutionService.ResolveMethod(UnityRuntimeServicesType, methodName) - UnityScriptTypeSystem as UnityScript.Steps.UnityScriptTypeSystem: + UnityScriptTypeSystem as UnityScript.TypeSystem.UnityScriptTypeSystem: get: return self.TypeSystemServices UnityScriptParameters as UnityScript.UnityScriptCompilerParameters: diff --git a/src/UnityScript/Steps/InitializeUnityScriptTypeSystem.boo b/src/UnityScript/Steps/InitializeUnityScriptTypeSystem.boo index e2bdf7a..1efa188 100755 --- a/src/UnityScript/Steps/InitializeUnityScriptTypeSystem.boo +++ b/src/UnityScript/Steps/InitializeUnityScriptTypeSystem.boo @@ -1,6 +1,7 @@ namespace UnityScript.Steps import Boo.Lang.Compiler.Steps +import UnityScript.TypeSystem class InitializeUnityScriptTypeSystem(InitializeTypeSystemServices): diff --git a/src/UnityScript/Steps/ProcessEvalInvocations.boo b/src/UnityScript/Steps/ProcessEvalInvocations.boo index c6c26cd..98fc52b 100755 --- a/src/UnityScript/Steps/ProcessEvalInvocations.boo +++ b/src/UnityScript/Steps/ProcessEvalInvocations.boo @@ -7,6 +7,7 @@ import Boo.Lang.Compiler.TypeSystem import Boo.Lang.Compiler.TypeSystem.Internal import Boo.Lang.Compiler.TypeSystem.Builders import UnityScript.Scripting +import UnityScript.TypeSystem class ProcessEvalInvocations(AbstractVisitorCompilerStep): diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index 04e7025..1afda26 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -9,6 +9,7 @@ import Boo.Lang.Compiler.Steps import Boo.Lang.Environments import UnityScript.Macros +import UnityScript.TypeSystem class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): @@ -49,7 +50,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): deferred UnityRuntimeServicesType = TypeSystemServices.Map(UnityScript.Lang.UnityRuntimeServices) - UnityScriptTypeSystem as UnityScript.Steps.UnityScriptTypeSystem: + UnityScriptTypeSystem as UnityScript.TypeSystem.UnityScriptTypeSystem: get: return self.TypeSystemServices UnityScriptParameters as UnityScript.UnityScriptCompilerParameters: diff --git a/src/UnityScript/Steps/UnityCallableResolutionService.boo b/src/UnityScript/TypeSystem/UnityCallableResolutionService.boo similarity index 94% rename from src/UnityScript/Steps/UnityCallableResolutionService.boo rename to src/UnityScript/TypeSystem/UnityCallableResolutionService.boo index 6783679..7ff4b3a 100755 --- a/src/UnityScript/Steps/UnityCallableResolutionService.boo +++ b/src/UnityScript/TypeSystem/UnityCallableResolutionService.boo @@ -1,4 +1,4 @@ -namespace UnityScript.Steps +namespace UnityScript.TypeSystem import Boo.Lang.Compiler import Boo.Lang.Compiler.Ast diff --git a/src/UnityScript/Steps/UnityDowncastPermissions.boo b/src/UnityScript/TypeSystem/UnityDowncastPermissions.boo similarity index 95% rename from src/UnityScript/Steps/UnityDowncastPermissions.boo rename to src/UnityScript/TypeSystem/UnityDowncastPermissions.boo index d96f076..3ce8fdb 100755 --- a/src/UnityScript/Steps/UnityDowncastPermissions.boo +++ b/src/UnityScript/TypeSystem/UnityDowncastPermissions.boo @@ -1,4 +1,4 @@ -namespace UnityScript.Steps +namespace UnityScript.TypeSystem import Boo.Lang.Compiler.TypeSystem import Boo.Lang.Compiler.TypeSystem.Services diff --git a/src/UnityScript/Steps/UnityScriptTypeSystem.boo b/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo similarity index 95% rename from src/UnityScript/Steps/UnityScriptTypeSystem.boo rename to src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo index 09e9412..f71c5de 100755 --- a/src/UnityScript/Steps/UnityScriptTypeSystem.boo +++ b/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo @@ -1,4 +1,4 @@ -namespace UnityScript.Steps +namespace UnityScript.TypeSystem import Boo.Lang.Compiler import Boo.Lang.Compiler.TypeSystem From ac9f972765c1b00358ca1c463c2b80a887135d26 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 26 Jun 2010 12:38:41 -0300 Subject: [PATCH 034/276] IType.GetElementType() => IType.ElementType; IArrayType.GetArrayRank() => IArrayType.Rank --- src/UnityScript/Steps/ProcessUnityScriptMethods.boo | 2 +- src/UnityScript/TypeSystem/UnityDowncastPermissions.boo | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index 1afda26..cbdee92 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -185,7 +185,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): CodeBuilder.CreateMethodInvocation( node.Right, ResolveMethod(right, "ToBuiltin"), - CodeBuilder.CreateTypeofExpression(left.GetElementType()))) + CodeBuilder.CreateTypeofExpression(left.ElementType))) override def OnForStatement(node as ForStatement): assert 1 == len(node.Declarations) diff --git a/src/UnityScript/TypeSystem/UnityDowncastPermissions.boo b/src/UnityScript/TypeSystem/UnityDowncastPermissions.boo index 3ce8fdb..844aaf4 100755 --- a/src/UnityScript/TypeSystem/UnityDowncastPermissions.boo +++ b/src/UnityScript/TypeSystem/UnityDowncastPermissions.boo @@ -16,5 +16,5 @@ class UnityDowncastPermissions(DowncastPermissions): return _enabled or super() private def CanBeReachedByArrayDowncast(expectedType as IArrayType, actualType as IArrayType): - return expectedType.GetArrayRank() == actualType.GetArrayRank() \ - and CanBeReachedByDowncast(expectedType.GetElementType(), actualType.GetElementType()) + return expectedType.Rank == actualType.Rank \ + and CanBeReachedByDowncast(expectedType.ElementType, actualType.ElementType) From 4e538dc4ff888c39fef3998e097fbfb6adace18e Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 28 Jun 2010 11:01:17 -0300 Subject: [PATCH 035/276] use JavaScript type names in error messages --- .../ErrorMessagesTestFixture.Generated.boo | 12 ++++++++++ .../Steps/InitializeUnityScriptTypeSystem.boo | 4 ++++ .../TypeSystem/UnityScriptEntityFormatter.boo | 22 +++++++++++++++++ src/UnityScript/UnityScript.booproj | 14 ++++++++--- tests/error-messages/array-type-name.js | 7 ++++++ tests/error-messages/function-type-name.js | 24 +++++++++++++++++++ tests/error-messages/generic-type-name.js | 7 ++++++ 7 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 src/UnityScript/TypeSystem/UnityScriptEntityFormatter.boo create mode 100755 tests/error-messages/array-type-name.js create mode 100755 tests/error-messages/function-type-name.js create mode 100755 tests/error-messages/generic-type-name.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index 5a274ad..6e67149 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -10,6 +10,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/array-struct-warning.js") + [Test] def array_type_name(): + RunTestCase("tests/error-messages/array-type-name.js") + + [Test] def builtins(): RunTestCase("tests/error-messages/builtins.js") @@ -26,6 +30,14 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/error-for-final-used-as-identifier.js") + [Test] def function_type_name(): + RunTestCase("tests/error-messages/function-type-name.js") + + + [Test] def generic_type_name(): + RunTestCase("tests/error-messages/generic-type-name.js") + + [Test] def implicit_main_shouldnt_be_redefined(): RunTestCase("tests/error-messages/implicit-main-shouldnt-be-redefined.js") diff --git a/src/UnityScript/Steps/InitializeUnityScriptTypeSystem.boo b/src/UnityScript/Steps/InitializeUnityScriptTypeSystem.boo index 1efa188..1660ece 100755 --- a/src/UnityScript/Steps/InitializeUnityScriptTypeSystem.boo +++ b/src/UnityScript/Steps/InitializeUnityScriptTypeSystem.boo @@ -5,6 +5,9 @@ import UnityScript.TypeSystem class InitializeUnityScriptTypeSystem(InitializeTypeSystemServices): + override def CreateEntityFormatter(): + return UnityScriptEntityFormatter() + override def CreateTypeSystemServices(): return UnityScriptTypeSystem(Context) @@ -13,3 +16,4 @@ class InitializeUnityScriptTypeSystem(InitializeTypeSystemServices): override def CreateDowncastPermissions(): return UnityDowncastPermissions() + diff --git a/src/UnityScript/TypeSystem/UnityScriptEntityFormatter.boo b/src/UnityScript/TypeSystem/UnityScriptEntityFormatter.boo new file mode 100644 index 0000000..fbe44d2 --- /dev/null +++ b/src/UnityScript/TypeSystem/UnityScriptEntityFormatter.boo @@ -0,0 +1,22 @@ +namespace UnityScript.TypeSystem + +import Boo.Lang.Compiler.TypeSystem +import Boo.Lang.Compiler.TypeSystem.Services +import Boo.Lang.PatternMatching + +class UnityScriptEntityFormatter(EntityFormatter): + + def FormatType(type as IType) as string: + match type: + case IArrayType(ElementType, Rank): + return "$(FormatType(ElementType))[$(',' * (Rank - 1))]" + case ICallableType(): + return FormatCallableType(type) + otherwise: + return type.FullName + + def FormatCallableType(type as ICallableType): + signature = type.GetSignature() + parameters = join(FormatType(p.Type) for p in signature.Parameters, ", ") + returnType = FormatType(signature.ReturnType) + return "function($parameters): $returnType" diff --git a/src/UnityScript/UnityScript.booproj b/src/UnityScript/UnityScript.booproj index 1755ad3..d8c84c8 100755 --- a/src/UnityScript/UnityScript.booproj +++ b/src/UnityScript/UnityScript.booproj @@ -70,12 +70,13 @@ - - - + + + + @@ -83,4 +84,11 @@ UnityScript.Lang + + + + + + + \ No newline at end of file diff --git a/tests/error-messages/array-type-name.js b/tests/error-messages/array-type-name.js new file mode 100755 index 0000000..207c90a --- /dev/null +++ b/tests/error-messages/array-type-name.js @@ -0,0 +1,7 @@ +/* +array-type-name.js(7,5): BCE0019: 'Foo' is not a member of 'Object[]'. +*/ +#pragma strict + +var com : Object[]; +com.Foo(); \ No newline at end of file diff --git a/tests/error-messages/function-type-name.js b/tests/error-messages/function-type-name.js new file mode 100755 index 0000000..fecafcd --- /dev/null +++ b/tests/error-messages/function-type-name.js @@ -0,0 +1,24 @@ +/* +function-type-name.js(18,4): BCE0019: 'Foo' is not a member of 'function(): void'. +function-type-name.js(21,4): BCE0019: 'Foo' is not a member of 'function(int): void'. +function-type-name.js(24,4): BCE0019: 'Foo' is not a member of 'function(function(): int): int'. +*/ +#pragma strict + +function Bar() { +} + +function Baz(i: int) { +} + +function Gazong(f: function():int): int { +} + +var f1 = Bar; +f1.Foo(); + +var f2 = Baz; +f2.Foo(); + +var f3 = Gazong; +f3.Foo(); \ No newline at end of file diff --git a/tests/error-messages/generic-type-name.js b/tests/error-messages/generic-type-name.js new file mode 100755 index 0000000..a71034c --- /dev/null +++ b/tests/error-messages/generic-type-name.js @@ -0,0 +1,7 @@ +/* +generic-type-name.js(7,3): BCE0019: 'Foo' is not a member of 'System.Collections.Generic.List'. +*/ +#pragma strict + +var l = new System.Collections.Generic.List.(); +l.Foo(); \ No newline at end of file From b53b2d35bb7f144bae9dae05faaa3b23b6170611 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 1 Jul 2010 12:58:44 -0300 Subject: [PATCH 036/276] verify all UnityScript assemblies --- default.build | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/default.build b/default.build index ce6398c..c2a60f4 100755 --- a/default.build +++ b/default.build @@ -11,6 +11,8 @@ + + @@ -18,8 +20,8 @@ - - + + @@ -33,7 +35,26 @@ - + + + + + + + + + + + + + + + + + + + + From eb901911659920cfcfb8fe196724baabb27809a8 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 1 Jul 2010 19:12:38 -0300 Subject: [PATCH 037/276] Assembly.Load(string) instead of Assembly.Load(AssemblyName) which is marked SecurityCritical on the unity profile --- src/UnityScript/Scripting/Evaluator.boo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UnityScript/Scripting/Evaluator.boo b/src/UnityScript/Scripting/Evaluator.boo index cd585d3..a77c60a 100755 --- a/src/UnityScript/Scripting/Evaluator.boo +++ b/src/UnityScript/Scripting/Evaluator.boo @@ -139,7 +139,7 @@ class Evaluator: contextAssembly = contextType.Assembly compiler.Parameters.References.Add(contextAssembly) for name in contextAssembly.GetReferencedAssemblies(): - compiler.Parameters.References.Add(System.Reflection.Assembly.Load(name)) + compiler.Parameters.References.Add(System.Reflection.Assembly.Load(name.ToString())) static def AdjustPipeline(context as EvaluationContext, pipeline as CompilerPipeline): pipeline.InsertAfter( From d371597a3961a9b9f82f5e4d8032f2832a21854f Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 5 Jul 2010 22:01:11 -0300 Subject: [PATCH 038/276] test cases for eval in static functions --- src/UnityScript.Tests/EvalTestFixture.boo | 20 +++++++++++++------ ...y-references-are-visible-inside-eval-1.js} | 0 ...ly-references-are-visible-inside-eval-2.js | 17 ++++++++++++++++ ...s => imports-are-visible-inside-eval-1.js} | 0 .../eval/imports-are-visible-inside-eval-2.js | 14 +++++++++++++ 5 files changed, 45 insertions(+), 6 deletions(-) rename tests/eval/{class-3.js => assembly-references-are-visible-inside-eval-1.js} (100%) create mode 100755 tests/eval/assembly-references-are-visible-inside-eval-2.js rename tests/eval/{class-2.js => imports-are-visible-inside-eval-1.js} (100%) create mode 100755 tests/eval/imports-are-visible-inside-eval-2.js diff --git a/src/UnityScript.Tests/EvalTestFixture.boo b/src/UnityScript.Tests/EvalTestFixture.boo index 00159db..baf4084 100755 --- a/src/UnityScript.Tests/EvalTestFixture.boo +++ b/src/UnityScript.Tests/EvalTestFixture.boo @@ -15,16 +15,16 @@ class EvalTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/eval/assembly-caching-2.js") - [Test] def class_1(): - RunTestCase("tests/eval/class-1.js") + [Test] def assembly_references_are_visible_inside_eval_1(): + RunTestCase("tests/eval/assembly-references-are-visible-inside-eval-1.js") - [Test] def class_2(): - RunTestCase("tests/eval/class-2.js") + [Test] def assembly_references_are_visible_inside_eval_2(): + RunTestCase("tests/eval/assembly-references-are-visible-inside-eval-2.js") - [Test] def class_3(): - RunTestCase("tests/eval/class-3.js") + [Test] def class_1(): + RunTestCase("tests/eval/class-1.js") [Test] def class_is_visible_1(): @@ -51,6 +51,14 @@ class EvalTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/eval/functions-2.js") + [Test] def imports_are_visible_inside_eval_1(): + RunTestCase("tests/eval/imports-are-visible-inside-eval-1.js") + + + [Test] def imports_are_visible_inside_eval_2(): + RunTestCase("tests/eval/imports-are-visible-inside-eval-2.js") + + [Test] def return_value_2(): RunTestCase("tests/eval/return-value-2.js") diff --git a/tests/eval/class-3.js b/tests/eval/assembly-references-are-visible-inside-eval-1.js similarity index 100% rename from tests/eval/class-3.js rename to tests/eval/assembly-references-are-visible-inside-eval-1.js diff --git a/tests/eval/assembly-references-are-visible-inside-eval-2.js b/tests/eval/assembly-references-are-visible-inside-eval-2.js new file mode 100755 index 0000000..61a0748 --- /dev/null +++ b/tests/eval/assembly-references-are-visible-inside-eval-2.js @@ -0,0 +1,17 @@ +/* +1 +Hello World +*/ + +static function test() { + // only referenced assemblies are available to eval scripts + // so let's make sure we have a reference to UnityScript.Tests.CSharp + var v = UnityScript.Tests.CSharp.Vector3(0, 0, 0); + + eval( "var p = UnityScript.Tests.CSharp.Vector3(1,1,1); " + + " print(p.x); "); + + eval( "UnityScript.Tests.CSharp.StaticTest.PrintSomething(\"Hello World\");"); +} + +test(); diff --git a/tests/eval/class-2.js b/tests/eval/imports-are-visible-inside-eval-1.js similarity index 100% rename from tests/eval/class-2.js rename to tests/eval/imports-are-visible-inside-eval-1.js diff --git a/tests/eval/imports-are-visible-inside-eval-2.js b/tests/eval/imports-are-visible-inside-eval-2.js new file mode 100755 index 0000000..d0663d2 --- /dev/null +++ b/tests/eval/imports-are-visible-inside-eval-2.js @@ -0,0 +1,14 @@ +/* +1 +Hello World +*/ +import UnityScript.Tests.CSharp; + +static function test() { + eval( "var p = Vector3(1,1,1); " + + " print(p.x); "); + + eval( "StaticTest.PrintSomething(\"Hello World\");"); +} + +test(); \ No newline at end of file From 9e278e6d4990d0e9fa82ff65793473b0671c18ff Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 5 Jul 2010 22:04:36 -0300 Subject: [PATCH 039/276] extracted classes from ProcessEvalInvocations (EvaluationDomainProviderImplementor and EvalAnnotation); no longer rely on System.Reflection.Assembly.GetReferencedAssemblies which is SecurityCritical on unity --- .../AbstractIntegrationTestFixture.boo | 1 + .../Scripting/EvaluationContext.boo | 2 + src/UnityScript/Scripting/Evaluator.boo | 48 +-------- .../Scripting/IEvaluationDomainProvider.boo | 40 +++++++ .../Pipeline/IntroduceReturnValue.boo | 3 +- .../SimpleEvaluationDomainProvider.boo | 3 + src/UnityScript/Steps/EvalAnnotation.boo | 18 ++++ .../EvaluationDomainProviderImplementor.boo | 101 ++++++++++++++++++ .../Steps/ExpandUnityDuckTypedExpressions.boo | 2 - .../Steps/ProcessEvalInvocations.boo | 84 ++------------- .../Steps/ProcessUnityScriptMethods.boo | 2 +- src/UnityScript/Steps/Utilities.boo | 8 ++ src/UnityScript/UnityScript.booproj | 3 + 13 files changed, 188 insertions(+), 127 deletions(-) create mode 100644 src/UnityScript/Scripting/IEvaluationDomainProvider.boo create mode 100644 src/UnityScript/Steps/EvalAnnotation.boo create mode 100644 src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo diff --git a/src/UnityScript.Tests/AbstractIntegrationTestFixture.boo b/src/UnityScript.Tests/AbstractIntegrationTestFixture.boo index 92a8ea3..d365a1e 100755 --- a/src/UnityScript.Tests/AbstractIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/AbstractIntegrationTestFixture.boo @@ -37,6 +37,7 @@ class AbstractIntegrationTestFixture(AbstractCompilerTestFixture): CopyParentAssembly(GetType()) CopyParentAssembly(UnityScript.Tests.CSharp.FooBarEnum) CopyParentAssembly(Assert) + CopyParentAssembly(MacroMacro) def CopyParentAssembly(type as System.Type): CopyFile(type.Module.FullyQualifiedName) diff --git a/src/UnityScript/Scripting/EvaluationContext.boo b/src/UnityScript/Scripting/EvaluationContext.boo index a208719..1a071d7 100755 --- a/src/UnityScript/Scripting/EvaluationContext.boo +++ b/src/UnityScript/Scripting/EvaluationContext.boo @@ -37,4 +37,6 @@ class EvaluationContext: [lock] def GetActiveScripts(): return _activeScripts.ToArray() + + diff --git a/src/UnityScript/Scripting/Evaluator.boo b/src/UnityScript/Scripting/Evaluator.boo index a77c60a..fbee4ce 100755 --- a/src/UnityScript/Scripting/Evaluator.boo +++ b/src/UnityScript/Scripting/Evaluator.boo @@ -13,44 +13,6 @@ class CompilationErrorsException(Exception): def constructor(errors as CompilerErrorCollection): super(errors.ToString(true)) _errors = errors - -interface IEvaluationDomainProvider: -""" -Every script in UnityScript defines a new EvaluationDomain. -""" - def GetImports() as (string) - def GetEvaluationDomain() as EvaluationDomain - -class EvaluationDomain: -""" -Groups together a set of related EvaluationScripts instances. -""" - _cache = {} - - [lock] - def GetCachedScript(key as EvaluationScriptCacheKey) as System.Type: - return _cache[key] - - [lock] - def CacheScript(key as EvaluationScriptCacheKey, type as System.Type): - _cache[key] = type - -class EvaluationScriptCacheKey: - - _contextType as System.Type - _code as string - - def constructor(contextType as Type, code as string): - _contextType = contextType - _code = code - - override def Equals(o): - other = o as EvaluationScriptCacheKey - if other is null: return false - return other._contextType is _contextType and other._code == _code - - override def GetHashCode(): - return _contextType.GetHashCode() ^ _code.GetHashCode() class EvaluationScript: @@ -132,14 +94,8 @@ class Evaluator: return _compilationResult.GeneratedAssembly.GetType("script") private def AddEvaluationContextReferencesTo(compiler as UnityScriptCompiler): - contextType = _context.GetType() - if contextType.DeclaringType is null: - return - - contextAssembly = contextType.Assembly - compiler.Parameters.References.Add(contextAssembly) - for name in contextAssembly.GetReferencedAssemblies(): - compiler.Parameters.References.Add(System.Reflection.Assembly.Load(name.ToString())) + for assembly in _context.ScriptContainer.GetAssemblyReferences(): + compiler.Parameters.References.Add(assembly) static def AdjustPipeline(context as EvaluationContext, pipeline as CompilerPipeline): pipeline.InsertAfter( diff --git a/src/UnityScript/Scripting/IEvaluationDomainProvider.boo b/src/UnityScript/Scripting/IEvaluationDomainProvider.boo new file mode 100644 index 0000000..602c600 --- /dev/null +++ b/src/UnityScript/Scripting/IEvaluationDomainProvider.boo @@ -0,0 +1,40 @@ +namespace UnityScript.Scripting + +interface IEvaluationDomainProvider: +""" +Every script in UnityScript defines a new EvaluationDomain. +""" + def GetImports() as (string) + def GetAssemblyReferences() as (System.Reflection.Assembly) + def GetEvaluationDomain() as EvaluationDomain + +class EvaluationDomain: +""" +A EvaluationScript cache. +""" + _cache = {} + + [lock] + def GetCachedScript(key as EvaluationScriptCacheKey) as System.Type: + return _cache[key] + + [lock] + def CacheScript(key as EvaluationScriptCacheKey, type as System.Type): + _cache[key] = type + +class EvaluationScriptCacheKey: + + _contextType as System.Type + _code as string + + def constructor(contextType as System.Type, code as string): + _contextType = contextType + _code = code + + override def Equals(o): + other = o as EvaluationScriptCacheKey + if other is null: return false + return other._contextType is _contextType and other._code == _code + + override def GetHashCode(): + return _contextType.GetHashCode() ^ _code.GetHashCode() \ No newline at end of file diff --git a/src/UnityScript/Scripting/Pipeline/IntroduceReturnValue.boo b/src/UnityScript/Scripting/Pipeline/IntroduceReturnValue.boo index b5cf009..1401429 100755 --- a/src/UnityScript/Scripting/Pipeline/IntroduceReturnValue.boo +++ b/src/UnityScript/Scripting/Pipeline/IntroduceReturnValue.boo @@ -5,8 +5,7 @@ import Boo.Lang.Compiler.Ast import UnityScript.Steps class IntroduceReturnValue(AbstractCompilerStep): -""" -""" + override def Run(): klass = GetScriptClass(Context) if klass is null: return diff --git a/src/UnityScript/Scripting/SimpleEvaluationDomainProvider.boo b/src/UnityScript/Scripting/SimpleEvaluationDomainProvider.boo index a373c26..d44304f 100644 --- a/src/UnityScript/Scripting/SimpleEvaluationDomainProvider.boo +++ b/src/UnityScript/Scripting/SimpleEvaluationDomainProvider.boo @@ -19,5 +19,8 @@ inside a static method. def GetEvaluationDomain(): return _domain + + virtual def GetAssemblyReferences(): + return array[of System.Reflection.Assembly](0) diff --git a/src/UnityScript/Steps/EvalAnnotation.boo b/src/UnityScript/Steps/EvalAnnotation.boo new file mode 100644 index 0000000..126c89d --- /dev/null +++ b/src/UnityScript/Steps/EvalAnnotation.boo @@ -0,0 +1,18 @@ +namespace UnityScript.Steps + +import Boo.Lang.Compiler.Ast + +static class EvalAnnotation: + + def Mark(node as Method): + AnnotateEval(node.DeclaringType) + AnnotateEval(node) + + def IsMarked(node as Node): + return node.ContainsAnnotation(Annotation) + + private def AnnotateEval(node as Node): + if IsMarked(node): return + node.Annotate(Annotation) + + final Annotation = object() \ No newline at end of file diff --git a/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo b/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo new file mode 100644 index 0000000..e12a024 --- /dev/null +++ b/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo @@ -0,0 +1,101 @@ +namespace UnityScript.Steps + +import System +import Boo.Lang.Compiler +import Boo.Lang.Compiler.Ast +import Boo.Lang.Compiler.TypeSystem +import Boo.Lang.Compiler.TypeSystem.Reflection +import UnityScript.Scripting + +class EvaluationDomainProviderImplementor(AbstractCompilerComponent): + + def ImplementIEvaluationDomainProviderOn(node as ClassDefinition): + node.BaseTypes.Add(CodeBuilder.CreateTypeReference(IEvaluationDomainProvider)) + ImplementGetEvaluationDomain(node) + ImplementGetImports(node) + ImplementGetAssemblyReferences(node) + + private def ImplementGetImports(node as ClassDefinition): + builder = AddVirtualMethod(node, "GetImports", StringArray()) + builder.Body.Add(ReturnStatement(CreateImportsArray(node))) + + private def CreateImportsArray(node as ClassDefinition): + items = ExpressionCollection() + for i in node.EnclosingModule.Imports: + items.Add(CodeBuilder.CreateStringLiteral(i.Namespace)) + return CodeBuilder.CreateArray(StringArray(), items) + + private def ImplementGetEvaluationDomain(node as ClassDefinition): + evaluationDomainType = Map(EvaluationDomain) + domainField = CodeBuilder.CreateField(Context.GetUniqueName("domain"), evaluationDomainType) + node.Members.Add(domainField) + + builder = AddVirtualMethod(node, "GetEvaluationDomain", evaluationDomainType) + + // if _domain is null: _domain = EvaluationDomain() + ifDomainField = IfStatement(TrueBlock: Block()) + ifDomainField.Condition = CodeBuilder.CreateBoundBinaryExpression( + TypeSystemServices.BoolType, + BinaryOperatorType.ReferenceEquality, + CodeBuilder.CreateReference(domainField), + CodeBuilder.CreateNullLiteral()) + ifDomainField.TrueBlock.Add( + CodeBuilder.CreateFieldAssignment( + domainField, + CodeBuilder.CreateConstructorInvocation(ConstructorTakingNArgumentsFor(evaluationDomainType, 0)))) + + builder.Body.Add(ifDomainField) + + // return _domain + builder.Body.Add(ReturnStatement(CodeBuilder.CreateReference(domainField))) + + private def ImplementGetAssemblyReferences(node as ClassDefinition): + builder = AddVirtualMethod(node, "GetAssemblyReferences", AssemblyArray()) + builder.Body.Add(ReturnStatement(CreateAssemblyReferencesArray(node))) + + private def CreateAssemblyReferencesArray(node as ClassDefinition): + + assemblyProperty = SystemTypeAssemblyProperty().GetGetMethod() + + references = ExpressionCollection() + + // generated assembly reference + references.Add( + CodeBuilder.CreateMethodInvocation( + CodeBuilder.CreateTypeofExpression(node.Entity as IType), assemblyProperty)) + + for reference in Parameters.References: + assemblyRef = reference as IAssemblyReference + continue if assemblyRef is null + publicType = AnyPublicTypeOf(assemblyRef.Assembly) + continue if publicType is null + references.Add( + CodeBuilder.CreateMethodInvocation( + CodeBuilder.CreateTypeofExpression(publicType), assemblyProperty)) + + return CodeBuilder.CreateArray(AssemblyArray(), references) + + private def AddVirtualMethod(node as ClassDefinition, name as string, returnType as IType): + builder = BooMethodBuilder(CodeBuilder, name, returnType, TypeMemberModifiers.Public | TypeMemberModifiers.Virtual) + node.Members.Add(builder.Method) + return builder + + private def SystemTypeAssemblyProperty() as IProperty: + return TypeSystemServices.Map(typeof(System.Type).GetProperty("Assembly")) + + private def AssemblyArray(): + return Map(typeof((System.Reflection.Assembly))) + + private def StringArray(): + return Map(typeof((string))) + + private def Map(type as System.Type): + return TypeSystemServices.Map(type) + + private def AnyPublicTypeOf(assembly as System.Reflection.Assembly): + for t in assembly.GetTypes(): + return t if t.IsPublic and not t.IsGenericType + + + + diff --git a/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo b/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo index 3e29ac3..2c24cf9 100755 --- a/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo +++ b/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo @@ -5,8 +5,6 @@ import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.TypeSystem import Boo.Lang.Compiler.Steps -import UnityScript.TypeSystem - class ExpandUnityDuckTypedExpressions(ExpandDuckTypedExpressions): private UnityRuntimeServices_Invoke as IMethod diff --git a/src/UnityScript/Steps/ProcessEvalInvocations.boo b/src/UnityScript/Steps/ProcessEvalInvocations.boo index 98fc52b..bcda5bd 100755 --- a/src/UnityScript/Steps/ProcessEvalInvocations.boo +++ b/src/UnityScript/Steps/ProcessEvalInvocations.boo @@ -1,6 +1,7 @@ namespace UnityScript.Steps import System +import Boo.Lang.Environments import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.Steps import Boo.Lang.Compiler.TypeSystem @@ -11,26 +12,13 @@ import UnityScript.TypeSystem class ProcessEvalInvocations(AbstractVisitorCompilerStep): - static final ContainsEvalAnnotation = object() - - static def Mark(node as Method): - AnnotateEval(node.DeclaringType) - AnnotateEval(node) - - static def IsMarked(node as Node): - return node.ContainsAnnotation(ContainsEvalAnnotation) - - static private def AnnotateEval(node as Node): - if IsMarked(node): return - node.Annotate(ContainsEvalAnnotation) - static final Evaluator_Eval = typeof(Evaluator).GetMethod("Eval") _currentMethod as InternalMethod _evaluationContextLocal as InternalLocal override def Run(): - if Errors.Count > 0: return + return if Errors.Count > 0 Visit(CompileUnit) override def OnConstructor(node as Constructor): @@ -38,7 +26,7 @@ class ProcessEvalInvocations(AbstractVisitorCompilerStep): override def OnMethod(node as Method): - if not IsMarked(node): return + if not EvalAnnotation.IsMarked(node): return _currentMethod = GetEntity(node) @@ -58,6 +46,11 @@ class ProcessEvalInvocations(AbstractVisitorCompilerStep): node.ParentNode.Replace( node, CreateEvaluationContextFieldReference(field)) + + override def LeaveClassDefinition(node as ClassDefinition): + if not EvalAnnotation.IsMarked(node): return + + my(EvaluationDomainProviderImplementor).ImplementIEvaluationDomainProviderOn(node) def DefineEvaluationContext(): @@ -138,11 +131,6 @@ class ProcessEvalInvocations(AbstractVisitorCompilerStep): ctor.Body.Add(superInvocationStmt) - override def LeaveClassDefinition(node as ClassDefinition): - if not IsMarked(node): return - - ImplementIEvaluationDomainProvider(node) - override def LeaveMethodInvocationExpression(node as MethodInvocationExpression): if not IsEvalInvocation(node): return @@ -151,62 +139,6 @@ class ProcessEvalInvocations(AbstractVisitorCompilerStep): def IsEvalInvocation(node as MethodInvocationExpression): return node.Target.Entity is UnityScriptTypeSystem.UnityScriptEval - def ImplementIEvaluationDomainProvider(node as ClassDefinition): - node.BaseTypes.Add(CodeBuilder.CreateTypeReference(IEvaluationDomainProvider)) - ImplementGetEvaluationDomain(node) - ImplementGetImports(node) - - def StringArray(): - return Map(typeof((string))) - - def ImplementGetImports(node as ClassDefinition): - builder = AddVirtualMethod(node, "GetImports", StringArray()) - builder.Body.Add(ReturnStatement(CreateImportsArray(node))) - - def CreateImportsArray(node as ClassDefinition): - items = ExpressionCollection() - for i in node.EnclosingModule.Imports: - items.Add(CodeBuilder.CreateStringLiteral(i.Namespace)) - return CodeBuilder.CreateArray(StringArray(), items) - - def ImplementGetEvaluationDomain(node as ClassDefinition): - evaluationDomainType = Map(EvaluationDomain) - domainField = CodeBuilder.CreateField(Context.GetUniqueName("domain"), evaluationDomainType) - node.Members.Add(domainField) - - builder = AddVirtualMethod(node, "GetEvaluationDomain", evaluationDomainType) - - // if _domain is null: _domain = EvaluationDomain() - ifDomainField = IfStatement(TrueBlock: Block()) - ifDomainField.Condition = CodeBuilder.CreateBoundBinaryExpression( - TypeSystemServices.BoolType, - BinaryOperatorType.ReferenceEquality, - CodeBuilder.CreateReference(domainField), - CodeBuilder.CreateNullLiteral()) - ifDomainField.TrueBlock.Add( - CodeBuilder.CreateFieldAssignment( - domainField, - CodeBuilder.CreateConstructorInvocation(ConstructorTakingNArgumentsFor(evaluationDomainType, 0)))) - - builder.Body.Add(ifDomainField) - - // return _domain - builder.Body.Add(ReturnStatement(CodeBuilder.CreateReference(domainField))) - - def ConstructorTakingNArgumentsFor(type as IType, arguments as int): - for ctor in type.GetConstructors(): - return ctor if len(ctor.GetParameters()) == arguments - raise "no constructor in $type taking $arguments arguments" - - def AddVirtualMethod(node as ClassDefinition, name as string, returnType as IType): - builder = BooMethodBuilder( - CodeBuilder, - name, - returnType, - TypeMemberModifiers.Public|TypeMemberModifiers.Virtual) - node.Members.Add(builder.Method) - return builder - def Map(type as System.Type): return TypeSystemServices.Map(type) diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index cbdee92..e25613c 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -115,7 +115,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): override protected def ProcessBuiltinInvocation(function as BuiltinFunction, node as MethodInvocationExpression): if function is UnityScriptTypeSystem.UnityScriptEval: - ProcessEvalInvocations.Mark(_currentMethod.Method) + EvalAnnotation.Mark(_currentMethod.Method) BindExpressionType(node, TypeSystemServices.ObjectType) return if function is UnityScriptTypeSystem.UnityScriptTypeof: diff --git a/src/UnityScript/Steps/Utilities.boo b/src/UnityScript/Steps/Utilities.boo index 4a4c3b5..34f83d1 100755 --- a/src/UnityScript/Steps/Utilities.boo +++ b/src/UnityScript/Steps/Utilities.boo @@ -2,6 +2,7 @@ namespace UnityScript.Steps import Boo.Lang.Compiler import Boo.Lang.Compiler.Ast +import Boo.Lang.Compiler.TypeSystem def IsRhsOfAssignment(node as Expression): be = node.ParentNode as BinaryExpression @@ -19,3 +20,10 @@ def SetScriptClass(context as CompilerContext, klass as ClassDefinition): def GetScriptClass(context as CompilerContext) as ClassDefinition: return context["ScriptClass"] + +def ConstructorTakingNArgumentsFor(type as IType, arguments as int): + for ctor in type.GetConstructors(): + return ctor if len(ctor.GetParameters()) == arguments + raise "no constructor in $type taking $arguments arguments" + + diff --git a/src/UnityScript/UnityScript.booproj b/src/UnityScript/UnityScript.booproj index d8c84c8..5654c7c 100755 --- a/src/UnityScript/UnityScript.booproj +++ b/src/UnityScript/UnityScript.booproj @@ -77,6 +77,9 @@ + + + From cf717a62f238fb6dad21e3aadc0661295310367b Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 7 Jul 2010 18:06:32 -0300 Subject: [PATCH 040/276] preserve imports and assembly references for eval in static functions --- .../Scripting/EvaluationContext.boo | 2 +- .../EvaluationDomainProviderImplementor.boo | 129 ++++++++---------- .../Steps/ProcessEvalInvocations.boo | 12 +- 3 files changed, 63 insertions(+), 80 deletions(-) diff --git a/src/UnityScript/Scripting/EvaluationContext.boo b/src/UnityScript/Scripting/EvaluationContext.boo index 1a071d7..3126c2a 100755 --- a/src/UnityScript/Scripting/EvaluationContext.boo +++ b/src/UnityScript/Scripting/EvaluationContext.boo @@ -20,7 +20,7 @@ class EvaluationContext: _container = SimpleEvaluationDomainProvider() IsStaticContext: - get: return SimpleEvaluationDomainProvider is _container.GetType() + get: return _container isa SimpleEvaluationDomainProvider [lock] def AddScript(script): diff --git a/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo b/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo index e12a024..acae149 100644 --- a/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo +++ b/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo @@ -1,96 +1,79 @@ namespace UnityScript.Steps import System +import Boo.Lang.Environments import Boo.Lang.Compiler import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.TypeSystem +import Boo.Lang.Compiler.TypeSystem.Services import Boo.Lang.Compiler.TypeSystem.Reflection import UnityScript.Scripting class EvaluationDomainProviderImplementor(AbstractCompilerComponent): def ImplementIEvaluationDomainProviderOn(node as ClassDefinition): - node.BaseTypes.Add(CodeBuilder.CreateTypeReference(IEvaluationDomainProvider)) - ImplementGetEvaluationDomain(node) - ImplementGetImports(node) - ImplementGetAssemblyReferences(node) - - private def ImplementGetImports(node as ClassDefinition): - builder = AddVirtualMethod(node, "GetImports", StringArray()) - builder.Body.Add(ReturnStatement(CreateImportsArray(node))) - - private def CreateImportsArray(node as ClassDefinition): - items = ExpressionCollection() - for i in node.EnclosingModule.Imports: - items.Add(CodeBuilder.CreateStringLiteral(i.Namespace)) - return CodeBuilder.CreateArray(StringArray(), items) - - private def ImplementGetEvaluationDomain(node as ClassDefinition): - evaluationDomainType = Map(EvaluationDomain) - domainField = CodeBuilder.CreateField(Context.GetUniqueName("domain"), evaluationDomainType) - node.Members.Add(domainField) - - builder = AddVirtualMethod(node, "GetEvaluationDomain", evaluationDomainType) - - // if _domain is null: _domain = EvaluationDomain() - ifDomainField = IfStatement(TrueBlock: Block()) - ifDomainField.Condition = CodeBuilder.CreateBoundBinaryExpression( - TypeSystemServices.BoolType, - BinaryOperatorType.ReferenceEquality, - CodeBuilder.CreateReference(domainField), - CodeBuilder.CreateNullLiteral()) - ifDomainField.TrueBlock.Add( - CodeBuilder.CreateFieldAssignment( - domainField, - CodeBuilder.CreateConstructorInvocation(ConstructorTakingNArgumentsFor(evaluationDomainType, 0)))) + domainField = ReferenceExpression(Context.GetUniqueName("domain")) + evaluationDomainProviderImpl = [| + class _($IEvaluationDomainProvider): - builder.Body.Add(ifDomainField) - - // return _domain - builder.Body.Add(ReturnStatement(CodeBuilder.CreateReference(domainField))) - - private def ImplementGetAssemblyReferences(node as ClassDefinition): - builder = AddVirtualMethod(node, "GetAssemblyReferences", AssemblyArray()) - builder.Body.Add(ReturnStatement(CreateAssemblyReferencesArray(node))) - - private def CreateAssemblyReferencesArray(node as ClassDefinition): - - assemblyProperty = SystemTypeAssemblyProperty().GetGetMethod() - - references = ExpressionCollection() - - // generated assembly reference - references.Add( - CodeBuilder.CreateMethodInvocation( - CodeBuilder.CreateTypeofExpression(node.Entity as IType), assemblyProperty)) + private $domainField as $EvaluationDomain + + def GetEvaluationDomain(): + return $domainField or ($domainField = $EvaluationDomain()) + + def GetImports(): + return $(ImportsArrayFor(node)) + + def GetAssemblyReferences(): + return $(AssemblyReferencesArrayFor(node)) + |] + + my(CodeReifier).MergeInto(node, evaluationDomainProviderImpl) + + def StaticEvaluationDomainProviderFor(node as ClassDefinition) as IField: + providerField as IField = node[StaticEvaluationDomainProviderKey] + if providerField is null: + providerField = CreateStaticEvaluationDomainProviderReferenceOn(node) + node[StaticEvaluationDomainProviderKey] = providerField + return providerField + + private def CreateStaticEvaluationDomainProviderReferenceOn(node as ClassDefinition): + evaluationDomainProviderImpl = [| + internal class StaticEvaluationDomainProvider($SimpleEvaluationDomainProvider): + + public static final Instance = StaticEvaluationDomainProvider() + + def constructor(): + super($(ImportsArrayFor(node))) + + override def GetAssemblyReferences(): + return $(AssemblyReferencesArrayFor(node)) + |] + my(CodeReifier).ReifyInto(node, evaluationDomainProviderImpl) + return evaluationDomainProviderImpl.Members["Instance"].Entity + + private static final StaticEvaluationDomainProviderKey = object() + + private def ImportsArrayFor(node as ClassDefinition): + result = [| (of $string:,) |] + result.Items.Extend([| $(i.Namespace) |] for i in node.EnclosingModule.Imports) + return result + + private def AssemblyReferencesArrayFor(node as ClassDefinition): + // TODO: only actually used assemblies should be part of this array + // otherwise we risk bringing the kitchen sink + + result = [| (of $Assembly:,) |] + result.Items.Add([| typeof($node).Assembly |]) for reference in Parameters.References: assemblyRef = reference as IAssemblyReference continue if assemblyRef is null publicType = AnyPublicTypeOf(assemblyRef.Assembly) continue if publicType is null - references.Add( - CodeBuilder.CreateMethodInvocation( - CodeBuilder.CreateTypeofExpression(publicType), assemblyProperty)) + result.Items.Add([| typeof($publicType).Assembly |]) - return CodeBuilder.CreateArray(AssemblyArray(), references) - - private def AddVirtualMethod(node as ClassDefinition, name as string, returnType as IType): - builder = BooMethodBuilder(CodeBuilder, name, returnType, TypeMemberModifiers.Public | TypeMemberModifiers.Virtual) - node.Members.Add(builder.Method) - return builder - - private def SystemTypeAssemblyProperty() as IProperty: - return TypeSystemServices.Map(typeof(System.Type).GetProperty("Assembly")) - - private def AssemblyArray(): - return Map(typeof((System.Reflection.Assembly))) - - private def StringArray(): - return Map(typeof((string))) - - private def Map(type as System.Type): - return TypeSystemServices.Map(type) + return result private def AnyPublicTypeOf(assembly as System.Reflection.Assembly): for t in assembly.GetTypes(): diff --git a/src/UnityScript/Steps/ProcessEvalInvocations.boo b/src/UnityScript/Steps/ProcessEvalInvocations.boo index bcda5bd..4d6cba9 100755 --- a/src/UnityScript/Steps/ProcessEvalInvocations.boo +++ b/src/UnityScript/Steps/ProcessEvalInvocations.boo @@ -75,7 +75,7 @@ class ProcessEvalInvocations(AbstractVisitorCompilerStep): CreateEvaluationContextReference(), CodeBuilder.CreateConstructorInvocation( ConstructorTakingNArgumentsFor(evaluationContextType, 1), - GetSelfReferenceIfInInstanceMethod()))) + EvaluationDomainProviderReference()))) for parameter in CurrentMethodNode.Parameters: // $context.param = param @@ -86,14 +86,14 @@ class ProcessEvalInvocations(AbstractVisitorCompilerStep): return initializationBlock - def GetSelfReferenceIfInInstanceMethod(): - if _currentMethod.IsStatic: return CodeBuilder.CreateNullLiteral() + def EvaluationDomainProviderReference(): + if _currentMethod.IsStatic: + staticEvaluationDomainProviderField = my(EvaluationDomainProviderImplementor).StaticEvaluationDomainProviderFor(CurrentTypeNode) + return CodeBuilder.CreateReference(staticEvaluationDomainProviderField) return CodeBuilder.CreateSelfReference(CurrentType) def CreateEvaluationContextFieldReference(field as InternalField): - return CodeBuilder.CreateMemberReference( - CreateEvaluationContextReference(), - field) + return CodeBuilder.CreateMemberReference(CreateEvaluationContextReference(), field) def CreateEvaluationContextReference(): return CodeBuilder.CreateReference(_evaluationContextLocal) From c56533ae48db5fe26b3aede6d83e576024bd2768 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 8 Jul 2010 11:37:44 -0300 Subject: [PATCH 041/276] test cases for empty array literals returned and yielded from functions --- src/UnityScript.Tests/IntegrationTestFixture.boo | 8 ++++++++ tests/integration/empty-array-literal-as-return-value.js | 8 ++++++++ tests/integration/empty-array-literal-as-yield-value.js | 9 +++++++++ 3 files changed, 25 insertions(+) create mode 100644 tests/integration/empty-array-literal-as-return-value.js create mode 100644 tests/integration/empty-array-literal-as-yield-value.js diff --git a/src/UnityScript.Tests/IntegrationTestFixture.boo b/src/UnityScript.Tests/IntegrationTestFixture.boo index b43d9aa..92eb06a 100644 --- a/src/UnityScript.Tests/IntegrationTestFixture.boo +++ b/src/UnityScript.Tests/IntegrationTestFixture.boo @@ -387,6 +387,14 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/ducky_6.js") + [Test] def empty_array_literal_as_return_value(): + RunTestCase("tests/integration/empty-array-literal-as-return-value.js") + + + [Test] def empty_array_literal_as_yield_value(): + RunTestCase("tests/integration/empty-array-literal-as-yield-value.js") + + [Test] def empty_string_array(): RunTestCase("tests/integration/empty-string-array.js") diff --git a/tests/integration/empty-array-literal-as-return-value.js b/tests/integration/empty-array-literal-as-return-value.js new file mode 100644 index 0000000..0cd8a76 --- /dev/null +++ b/tests/integration/empty-array-literal-as-return-value.js @@ -0,0 +1,8 @@ +/* +System.String[] +*/ +function foo(): String[] { + return []; +} + +print(foo().GetType()); diff --git a/tests/integration/empty-array-literal-as-yield-value.js b/tests/integration/empty-array-literal-as-yield-value.js new file mode 100644 index 0000000..3ff937d --- /dev/null +++ b/tests/integration/empty-array-literal-as-yield-value.js @@ -0,0 +1,9 @@ +/* +System.String[] +*/ +function foo(): System.Collections.Generic.IEnumerable. { + yield []; +} + +for (var f in foo()) + print(f.GetType()); From 89bba3a8e8dcfe0f1cfc7dfaaa8e9d2428ef7100 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 8 Jul 2010 17:05:47 -0300 Subject: [PATCH 042/276] error message has changed --- tests/error-messages/nolinenumber.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/error-messages/nolinenumber.js b/tests/error-messages/nolinenumber.js index 50cff92..8238cae 100755 --- a/tests/error-messages/nolinenumber.js +++ b/tests/error-messages/nolinenumber.js @@ -1,5 +1,5 @@ /* -nolinenumber.js(14,18): BCE0101: Return type 'void' cannot be used on a generator. Did you mean 'void*' ? Or use a 'System.Collections.IEnumerable' or 'object'. +nolinenumber.js(14,18): BCE0101: Return type 'void' cannot be used on a generator. Did you mean 'void*'? You can also use 'System.Collections.IEnumerable' or 'object'. */ class A From 5aa4c47af3e2324e02ae606c04259685a712bd5a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 8 Jul 2010 19:36:12 -0300 Subject: [PATCH 043/276] extracted AbstractCompilerTest --- .../AbstractCompilerTest.boo | 37 +++++++++++++++++++ .../AbstractCompilerTestFixture.boo | 32 ++-------------- .../Scripting/EvaluatorTest.boo | 1 - .../UnityScript.Tests.booproj | 1 + 4 files changed, 41 insertions(+), 30 deletions(-) create mode 100644 src/UnityScript.Tests/AbstractCompilerTest.boo diff --git a/src/UnityScript.Tests/AbstractCompilerTest.boo b/src/UnityScript.Tests/AbstractCompilerTest.boo new file mode 100644 index 0000000..06cc44a --- /dev/null +++ b/src/UnityScript.Tests/AbstractCompilerTest.boo @@ -0,0 +1,37 @@ +namespace UnityScript.Tests + +import NUnit.Framework +import UnityScript +import Boo.Lang.Compiler + +abstract class AbstractCompilerTest: + + _compiler as UnityScriptCompiler + + Parameters: + get: return _compiler.Parameters + + [TestFixtureSetUp] + virtual def SetUpFixture(): + _compiler = CreateCompiler() + + virtual def CreateCompiler(): + compiler = UnityScriptCompiler() + compiler.Parameters.Ducky = true + compiler.Parameters.ScriptBaseType = MonoBehaviour + compiler.Parameters.ScriptMainMethod = "Awake" + compiler.Parameters.Pipeline = CreateCompilerPipeline() + compiler.Parameters.References.Add(typeof(AbstractCompilerTestFixture).Assembly) + compiler.Parameters.References.Add(typeof(Assert).Assembly) + compiler.Parameters.References.Add(typeof(UnityScript.Tests.CSharp.FooBarEnum).Assembly) + return compiler + + virtual def CompileTestCase([required] input as ICompilerInput): + Parameters.Input.Clear() + Parameters.Input.Add(input) + return _compiler.Run() + + protected abstract def CreateCompilerPipeline() as CompilerPipeline: + pass + + diff --git a/src/UnityScript.Tests/AbstractCompilerTestFixture.boo b/src/UnityScript.Tests/AbstractCompilerTestFixture.boo index 8f794ca..b5fd70c 100755 --- a/src/UnityScript.Tests/AbstractCompilerTestFixture.boo +++ b/src/UnityScript.Tests/AbstractCompilerTestFixture.boo @@ -4,9 +4,8 @@ import System.IO import Boo.Lang.Compiler import Boo.Lang.Compiler.IO import NUnit.Framework from nunit.framework -import UnityScript -abstract class AbstractCompilerTestFixture: +abstract class AbstractCompilerTestFixture(AbstractCompilerTest): virtual DisplayErrorStackTrace: get: return false @@ -19,22 +18,8 @@ abstract class AbstractCompilerTestFixture: private static _basePath as string - _compiler as UnityScriptCompiler - - [TestFixtureSetUp] - virtual def SetUpFixture(): - _compiler = CreateCompiler() - - virtual def CreateCompiler() as UnityScriptCompiler: - compiler = UnityScriptCompiler() - compiler.Parameters.Ducky = true - compiler.Parameters.ScriptBaseType = MonoBehaviour - compiler.Parameters.ScriptMainMethod = "Awake" - compiler.Parameters.Pipeline = CreateCompilerPipeline() - compiler.Parameters.References.Add(typeof(AbstractCompilerTestFixture).Assembly) - compiler.Parameters.References.Add(typeof(Assert).Assembly) - compiler.Parameters.References.Add(typeof(UnityScript.Tests.CSharp.FooBarEnum).Assembly) - return compiler + virtual def CompileTestCase([required] fname as string): + return CompileTestCase(FileInput(fname)) def RunTestCase(fname as string): location = ResolvePath(fname) @@ -42,14 +27,6 @@ abstract class AbstractCompilerTestFixture: CheckTestCaseCompilationResult(result) CheckTestCaseOutput(location, GetActualOutput(result)) - virtual def CompileTestCase([required] fname as string): - return CompileTestCase(FileInput(fname)) - - virtual def CompileTestCase([required] input as ICompilerInput): - _compiler.Parameters.Input.Clear() - _compiler.Parameters.Input.Add(input) - return _compiler.Run() - virtual protected def CheckTestCaseCompilationResult([required] result as CompilerContext): Assert.AreEqual(0, result.Errors.Count, result.Errors.ToString(DisplayErrorStackTrace)) @@ -76,9 +53,6 @@ abstract class AbstractCompilerTestFixture: protected virtual def GetActualOutput(result as CompilerContext) as string: return result.CompileUnit.Modules[0].ToCodeString() - protected abstract def CreateCompilerPipeline() as CompilerPipeline: - pass - def GetExpectedOutput([required] fname as string): contents = ReadAllText(fname) start = contents.IndexOf("/*") diff --git a/src/UnityScript.Tests/Scripting/EvaluatorTest.boo b/src/UnityScript.Tests/Scripting/EvaluatorTest.boo index 54ad283..8e7343d 100644 --- a/src/UnityScript.Tests/Scripting/EvaluatorTest.boo +++ b/src/UnityScript.Tests/Scripting/EvaluatorTest.boo @@ -8,7 +8,6 @@ class EvaluatorTest: [Test] def SimpleEvalWithNoImports(): - Assert.AreEqual(4, Evaluator.Eval(EvaluationContext(), "2 + 2")) [Test] diff --git a/src/UnityScript.Tests/UnityScript.Tests.booproj b/src/UnityScript.Tests/UnityScript.Tests.booproj index 228a0c8..262811b 100755 --- a/src/UnityScript.Tests/UnityScript.Tests.booproj +++ b/src/UnityScript.Tests/UnityScript.Tests.booproj @@ -67,6 +67,7 @@ + From 90cd3cba1e3fd18803970ab982ae47ec7aee08a4 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 8 Jul 2010 19:37:50 -0300 Subject: [PATCH 044/276] only assemblies with referenced types should end up being referenced by eval --- src/UnityScript.Tests/EvalCompilationTest.boo | 45 ++++++++++++ .../UnityScript.Tests.booproj | 1 + src/UnityScript/Macros/PerNodeMacro.boo | 22 ++++++ .../Scripting/IEvaluationDomainProvider.boo | 2 +- .../EvaluationDomainProviderImplementor.boo | 71 +++++++++++++------ src/UnityScript/UnityScript.booproj | 1 + 6 files changed, 118 insertions(+), 24 deletions(-) create mode 100644 src/UnityScript.Tests/EvalCompilationTest.boo create mode 100644 src/UnityScript/Macros/PerNodeMacro.boo diff --git a/src/UnityScript.Tests/EvalCompilationTest.boo b/src/UnityScript.Tests/EvalCompilationTest.boo new file mode 100644 index 0000000..b135ac5 --- /dev/null +++ b/src/UnityScript.Tests/EvalCompilationTest.boo @@ -0,0 +1,45 @@ +namespace UnityScript.Tests + +import System +import System.IO +import System.Reflection + +import NUnit.Framework +import UnityScript +import Boo.Lang.Compiler.IO + +[TestFixture] +class EvalCompilationTest(AbstractCompilerTest): + + override def CreateCompilerPipeline(): + return UnityScriptCompiler.Pipelines.CompileToFile() + + [Test] + def OnlyAssembliesWithReferencedTypesEndUpBeingReferenced(): + + expected = ("mscorlib", "UnityScript", "UnityScript.Tests") + code = """ + eval("print(\"hello\")"); + """ + AssertAssemblyReferencesForEval expected, code + + [Test] + def OnlyAssembliesWithReferencedTypesEndUpBeingReferencedIncludingGenerics(): + + expected = ("Boo.Lang", "mscorlib", "UnityScript", "UnityScript.Tests") + code = """ + var l: Boo.Lang.List.; + eval("print(\"hello\")"); + """ + AssertAssemblyReferencesForEval expected, code + + def AssertAssemblyReferencesForEval(expected as (string), code as string): + + Parameters.OutputAssembly = Path.GetTempFileName() + ".dll" + result = CompileTestCase(StringInput("code.js", code)) + assert len(result.Errors) == 0, result.Errors.ToString() + + actual = array(assemblyName.Name for assemblyName in Assembly.LoadFrom(Parameters.OutputAssembly).GetReferencedAssemblies()) + Array.Sort(actual) + Assert.AreEqual(expected, actual) + diff --git a/src/UnityScript.Tests/UnityScript.Tests.booproj b/src/UnityScript.Tests/UnityScript.Tests.booproj index 262811b..28e7191 100755 --- a/src/UnityScript.Tests/UnityScript.Tests.booproj +++ b/src/UnityScript.Tests/UnityScript.Tests.booproj @@ -67,6 +67,7 @@ + diff --git a/src/UnityScript/Macros/PerNodeMacro.boo b/src/UnityScript/Macros/PerNodeMacro.boo new file mode 100644 index 0000000..c3c4653 --- /dev/null +++ b/src/UnityScript/Macros/PerNodeMacro.boo @@ -0,0 +1,22 @@ +namespace UnityScript.Macros + +import Boo.Lang.Compiler.Ast +import Boo.Lang.PatternMatching + +macro perNode(node as ReferenceExpression): + + match perNode.Body: + case Block(Statements: (ReturnStatement(Expression: value),)): + key = ReferenceExpression(Name: Context.GetUniqueName(node.Name)) + yield [| + static private final $key = object() + |] + yield [| + block: + cached = $node[$key] + return cached if cached is not null + value = $value + $node[$key] = value + return value + |].Body + diff --git a/src/UnityScript/Scripting/IEvaluationDomainProvider.boo b/src/UnityScript/Scripting/IEvaluationDomainProvider.boo index 602c600..272916b 100644 --- a/src/UnityScript/Scripting/IEvaluationDomainProvider.boo +++ b/src/UnityScript/Scripting/IEvaluationDomainProvider.boo @@ -1,6 +1,6 @@ namespace UnityScript.Scripting -interface IEvaluationDomainProvider: +interface IEvaluationDomainProvider: // IEvalHost? """ Every script in UnityScript defines a new EvaluationDomain. """ diff --git a/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo b/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo index acae149..4aae814 100644 --- a/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo +++ b/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo @@ -7,6 +7,7 @@ import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.TypeSystem import Boo.Lang.Compiler.TypeSystem.Services import Boo.Lang.Compiler.TypeSystem.Reflection +import UnityScript.Macros import UnityScript.Scripting class EvaluationDomainProviderImplementor(AbstractCompilerComponent): @@ -25,17 +26,23 @@ class EvaluationDomainProviderImplementor(AbstractCompilerComponent): return $(ImportsArrayFor(node)) def GetAssemblyReferences(): - return $(AssemblyReferencesArrayFor(node)) + return $(AssemblyReferencesArray()) |] my(CodeReifier).MergeInto(node, evaluationDomainProviderImpl) def StaticEvaluationDomainProviderFor(node as ClassDefinition) as IField: - providerField as IField = node[StaticEvaluationDomainProviderKey] - if providerField is null: - providerField = CreateStaticEvaluationDomainProviderReferenceOn(node) - node[StaticEvaluationDomainProviderKey] = providerField - return providerField + perNode node: + return CreateStaticEvaluationDomainProviderReferenceOn(node) + + private def AssemblyReferencesArray() as Expression: + perNode CompileUnit: + return CodeBuilder.CreateReference(CreateAssemblyReferencesArray()) + + private def ImportsArrayFor(node as ClassDefinition): + result = [| (of $string:,) |] + result.Items.Extend([| $(i.Namespace) |] for i in node.EnclosingModule.Imports) + return result private def CreateStaticEvaluationDomainProviderReferenceOn(node as ClassDefinition): evaluationDomainProviderImpl = [| @@ -47,38 +54,56 @@ class EvaluationDomainProviderImplementor(AbstractCompilerComponent): super($(ImportsArrayFor(node))) override def GetAssemblyReferences(): - return $(AssemblyReferencesArrayFor(node)) + return $(AssemblyReferencesArray()) |] my(CodeReifier).ReifyInto(node, evaluationDomainProviderImpl) return evaluationDomainProviderImpl.Members["Instance"].Entity - private static final StaticEvaluationDomainProviderKey = object() - - private def ImportsArrayFor(node as ClassDefinition): - result = [| (of $string:,) |] - result.Items.Extend([| $(i.Namespace) |] for i in node.EnclosingModule.Imports) - return result + private def CreateAssemblyReferencesArray() as IField: - private def AssemblyReferencesArrayFor(node as ClassDefinition): // TODO: only actually used assemblies should be part of this array // otherwise we risk bringing the kitchen sink - + result = [| (of $Assembly:,) |] - result.Items.Add([| typeof($node).Assembly |]) + result.Items.Add([| System.Reflection.Assembly.GetExecutingAssembly() |]) - for reference in Parameters.References: - assemblyRef = reference as IAssemblyReference - continue if assemblyRef is null - publicType = AnyPublicTypeOf(assemblyRef.Assembly) + for assembly in ReferencedAssemblies(): + publicType = AnyPublicTypeOf(assembly) continue if publicType is null result.Items.Add([| typeof($publicType).Assembly |]) - - return result + + arrayHolder = [| + internal class EvalAssemblyReferences: + public static final Value = $result + |] + my(CodeReifier).ReifyInto(CompileUnit.Modules[0], arrayHolder) + return arrayHolder.Members["Value"].Entity private def AnyPublicTypeOf(assembly as System.Reflection.Assembly): for t in assembly.GetTypes(): return t if t.IsPublic and not t.IsGenericType + + private def ReferencedAssemblies(): + collector = ReferencedAssemblyCollector() + CompileUnit.Accept(collector) + return collector.ReferencedAssemblies +class ReferencedAssemblyCollector(DepthFirstVisitor): + + [getter(ReferencedAssemblies)] + _assemblies = Boo.Lang.Compiler.Util.Set of Assembly() + + override def OnReferenceExpression(node as ReferenceExpression): + CheckTypeReference(node) - + override def LeaveMemberReferenceExpression(node as MemberReferenceExpression): + CheckTypeReference(node) + override def OnSimpleTypeReference(node as SimpleTypeReference): + CheckTypeReference(node) + + def CheckTypeReference(node as Node): + type = node.Entity as Boo.Lang.Compiler.TypeSystem.Reflection.ExternalType + if type is null: return + _assemblies.Add(type.ActualType.Assembly) + diff --git a/src/UnityScript/UnityScript.booproj b/src/UnityScript/UnityScript.booproj index 5654c7c..188f3b7 100755 --- a/src/UnityScript/UnityScript.booproj +++ b/src/UnityScript/UnityScript.booproj @@ -80,6 +80,7 @@ + From f5379bc38ec130fec5a4eb680e66224f94786d13 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 8 Jul 2010 21:59:31 -0300 Subject: [PATCH 045/276] code cleanup --- .../Steps/EvaluationDomainProviderImplementor.boo | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo b/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo index 4aae814..fdb2fa1 100644 --- a/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo +++ b/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo @@ -6,7 +6,6 @@ import Boo.Lang.Compiler import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.TypeSystem import Boo.Lang.Compiler.TypeSystem.Services -import Boo.Lang.Compiler.TypeSystem.Reflection import UnityScript.Macros import UnityScript.Scripting @@ -59,22 +58,17 @@ class EvaluationDomainProviderImplementor(AbstractCompilerComponent): my(CodeReifier).ReifyInto(node, evaluationDomainProviderImpl) return evaluationDomainProviderImpl.Members["Instance"].Entity - private def CreateAssemblyReferencesArray() as IField: - - // TODO: only actually used assemblies should be part of this array - // otherwise we risk bringing the kitchen sink - - result = [| (of $Assembly:,) |] - result.Items.Add([| System.Reflection.Assembly.GetExecutingAssembly() |]) + private def CreateAssemblyReferencesArray() as IField: + references = [| (System.Reflection.Assembly.GetExecutingAssembly(),) |] for assembly in ReferencedAssemblies(): publicType = AnyPublicTypeOf(assembly) continue if publicType is null - result.Items.Add([| typeof($publicType).Assembly |]) + references.Items.Add([| typeof($publicType).Assembly |]) arrayHolder = [| internal class EvalAssemblyReferences: - public static final Value = $result + public static final Value = $references |] my(CodeReifier).ReifyInto(CompileUnit.Modules[0], arrayHolder) return arrayHolder.Members["Value"].Entity From 72d0a37c69e5c8c5d1f978647ffa02790f79b47e Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 12 Jul 2010 18:30:23 -0300 Subject: [PATCH 046/276] always reference UnityScript.Lang --- src/UnityScript/UnityScriptCompilerParameters.boo | 1 + 1 file changed, 1 insertion(+) diff --git a/src/UnityScript/UnityScriptCompilerParameters.boo b/src/UnityScript/UnityScriptCompilerParameters.boo index 2b95e6c..e9c300f 100755 --- a/src/UnityScript/UnityScriptCompilerParameters.boo +++ b/src/UnityScript/UnityScriptCompilerParameters.boo @@ -22,4 +22,5 @@ class UnityScriptCompilerParameters(CompilerParameters): def constructor(): self.Ducky = true self.OutputType = CompilerOutputType.Library + self.References.Add(typeof(UnityScript.Lang.Array).Assembly) self.References.Add(GetType().Assembly) From 0b8e5a67bdf469f67e3759dfbff12578d2eb546a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 12 Jul 2010 23:24:20 -0300 Subject: [PATCH 047/276] fix for confusing array related error messages (#363820 and #355233) --- .../ErrorMessagesTestFixture.Generated.boo | 4 ++++ src/UnityScript.Tests/IntegrationTestFixture.boo | 8 ++++++++ src/UnityScript/Parser/CodeFactory.boo | 2 +- .../array-instantiation-with-array-multiplication.js | 7 +++++++ ...tantiation-with-object-argument-in-strict-mode.js | 12 ++++++++++++ .../array-instantiation-with-object-argument.js | 10 ++++++++++ 6 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 tests/error-messages/array-instantiation-with-array-multiplication.js create mode 100644 tests/integration/array-instantiation-with-object-argument-in-strict-mode.js create mode 100644 tests/integration/array-instantiation-with-object-argument.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index 6e67149..07447ec 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -6,6 +6,10 @@ import NUnit.Framework partial class ErrorMessagesTestFixture: + [Test] def array_instantiation_with_array_multiplication(): + RunTestCase("tests/error-messages/array-instantiation-with-array-multiplication.js") + + [Test] def array_struct_warning(): RunTestCase("tests/error-messages/array-struct-warning.js") diff --git a/src/UnityScript.Tests/IntegrationTestFixture.boo b/src/UnityScript.Tests/IntegrationTestFixture.boo index 92eb06a..e68f887 100644 --- a/src/UnityScript.Tests/IntegrationTestFixture.boo +++ b/src/UnityScript.Tests/IntegrationTestFixture.boo @@ -111,6 +111,14 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-implicit-from-null.js") + [Test] def array_instantiation_with_object_argument_in_strict_mode(): + RunTestCase("tests/integration/array-instantiation-with-object-argument-in-strict-mode.js") + + + [Test] def array_instantiation_with_object_argument(): + RunTestCase("tests/integration/array-instantiation-with-object-argument.js") + + [Test] def array_iterate(): RunTestCase("tests/integration/array-iterate.js") diff --git a/src/UnityScript/Parser/CodeFactory.boo b/src/UnityScript/Parser/CodeFactory.boo index a4fd84f..418d5c0 100755 --- a/src/UnityScript/Parser/CodeFactory.boo +++ b/src/UnityScript/Parser/CodeFactory.boo @@ -5,7 +5,7 @@ import Boo.Lang.Compiler.Ast static class CodeFactory: def NewArrayInitializer(location as LexicalInfo, elementType as TypeReference, count as Expression): - return [| Boo.Lang.Builtins.array[of $elementType]($count) |].WithLocation(location) + return [| Boo.Lang.Builtins.array[of $elementType](cast(int, $count)) |].WithLocation(location) [Extension] def WithLocation[of T(Node)](node as T, location as LexicalInfo): diff --git a/tests/error-messages/array-instantiation-with-array-multiplication.js b/tests/error-messages/array-instantiation-with-array-multiplication.js new file mode 100644 index 0000000..994eb35 --- /dev/null +++ b/tests/error-messages/array-instantiation-with-array-multiplication.js @@ -0,0 +1,7 @@ +/* +array-instantiation-with-array-multiplication.js(6,21): BCE0022: Cannot convert 'System.Array' to 'int'. +*/ +function start() { + var a = new int[2]; + var b = new int[a*3]; +} diff --git a/tests/integration/array-instantiation-with-object-argument-in-strict-mode.js b/tests/integration/array-instantiation-with-object-argument-in-strict-mode.js new file mode 100644 index 0000000..23b52fb --- /dev/null +++ b/tests/integration/array-instantiation-with-object-argument-in-strict-mode.js @@ -0,0 +1,12 @@ +/* +2 +*/ +#pragma strict + +function newStringArray(i) { + return new String[i]; +} + +print(newStringArray(2).Length); + + diff --git a/tests/integration/array-instantiation-with-object-argument.js b/tests/integration/array-instantiation-with-object-argument.js new file mode 100644 index 0000000..bc0140f --- /dev/null +++ b/tests/integration/array-instantiation-with-object-argument.js @@ -0,0 +1,10 @@ +/* +2 +*/ +function newStringArray(i) { + return new String[i]; +} + +print(newStringArray(2).Length); + + From f04af8b88f22bffa7763a576bafd87eb3febb06f Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 12 Jul 2010 23:59:11 -0300 Subject: [PATCH 048/276] don't allow loop variable to hide method variable (#364005) --- .../ErrorMessagesTestFixture.Generated.boo | 4 ++++ src/UnityScript/Core/DeclarationAnnotations.boo | 14 ++++++++++++++ src/UnityScript/Parser/UnityScriptParser.boo | 4 +++- .../Steps/ProcessUnityScriptMethods.boo | 7 +++++++ src/UnityScript/UnityScript.booproj | 1 + src/UnityScript/UnityScript.g | 9 ++------- .../error-messages/for-variable-already-defined.js | 12 ++++++++++++ 7 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 src/UnityScript/Core/DeclarationAnnotations.boo create mode 100644 tests/error-messages/for-variable-already-defined.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index 07447ec..2e6fc83 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -34,6 +34,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/error-for-final-used-as-identifier.js") + [Test] def for_variable_already_defined(): + RunTestCase("tests/error-messages/for-variable-already-defined.js") + + [Test] def function_type_name(): RunTestCase("tests/error-messages/function-type-name.js") diff --git a/src/UnityScript/Core/DeclarationAnnotations.boo b/src/UnityScript/Core/DeclarationAnnotations.boo new file mode 100644 index 0000000..6617f7e --- /dev/null +++ b/src/UnityScript/Core/DeclarationAnnotations.boo @@ -0,0 +1,14 @@ +namespace UnityScript.Core + +import Boo.Lang.Compiler.Ast + +static class DeclarationAnnotations: + + def ForceNewVariable(d as Declaration): + d.Annotate(NewVariableAnnotation) + + def ShouldForceNewVariableFor(d as Declaration): + return d.ContainsAnnotation(NewVariableAnnotation) + + NewVariableAnnotation = object() + diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 810a5fe..5903944 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -2760,9 +2760,11 @@ class UnityScriptParser(antlr.LLkParser): id = LT(1) match(ID) if 0 == inputState.guessing: - d = Declaration(ToLexicalInfo(id), Name: id.getText()) + d = Declaration(ToLexicalInfo(id), Name: id.getText()) elif ((_givenValue == VAR)): // 1831 d=declaration() + if 0 == inputState.guessing: + DeclarationAnnotations.ForceNewVariable(d) else: // line 1969 raise NoViableAltException(LT(1), getFilename()) match(IN) diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index e25613c..e067b1e 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -8,6 +8,7 @@ import Boo.Lang.Compiler.Steps import Boo.Lang.Environments +import UnityScript.Core import UnityScript.Macros import UnityScript.TypeSystem @@ -72,6 +73,12 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): BindQuack(node); return super(node, ns) + + override protected def LocalToReuseFor(d as Declaration): + if DeclarationAnnotations.ShouldForceNewVariableFor(d): + AssertUniqueLocal(d) + return null + return super(d) override def OnModule(module as Module): Parameters.Strict = _strict = module.ContainsAnnotation("strict") diff --git a/src/UnityScript/UnityScript.booproj b/src/UnityScript/UnityScript.booproj index 188f3b7..c6666a5 100755 --- a/src/UnityScript/UnityScript.booproj +++ b/src/UnityScript/UnityScript.booproj @@ -81,6 +81,7 @@ + diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index afd5e5f..d030808 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -883,13 +883,8 @@ for_in [Block container] returns [Statement stmt] { }: ( - ( - id:ID - { - d = Declaration(ToLexicalInfo(id), Name: id.getText()) - } - ) - | d=declaration + (id:ID { d = Declaration(ToLexicalInfo(id), Name: id.getText()) }) + | d=declaration { DeclarationAnnotations.ForceNewVariable(d) } ) IN iterator=expression { diff --git a/tests/error-messages/for-variable-already-defined.js b/tests/error-messages/for-variable-already-defined.js new file mode 100644 index 0000000..21490f5 --- /dev/null +++ b/tests/error-messages/for-variable-already-defined.js @@ -0,0 +1,12 @@ +/* +for-variable-already-defined.js(11,18): BCE0067: There is already a local variable with the name 's'. +*/ +function Start() +{ + var ss = new String[1]; + var s = ""; + + for (s in ss) { print(s); } // reuse the variable + + for (var s in ss) { print(s); } // declaring a new one, disallow +} From 380ca2029304d393986e6fc7ba08dea1f149a68a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 15 Jul 2010 18:27:43 -0300 Subject: [PATCH 049/276] acceptance tests for short circuit expression evaluation involving implicit boolean conversions (#364889) --- .../IntegrationTestFixture.boo | 12 ++++ .../duck-implicit-bool-and-with-simple-ref.js | 22 ++++++++ tests/integration/duck-implicit-bool-and.js | 14 +++++ tests/integration/implict-bool-hierarchy.js | 56 +++++++++++++++++++ 4 files changed, 104 insertions(+) create mode 100644 tests/integration/duck-implicit-bool-and-with-simple-ref.js create mode 100644 tests/integration/duck-implicit-bool-and.js create mode 100644 tests/integration/implict-bool-hierarchy.js diff --git a/src/UnityScript.Tests/IntegrationTestFixture.boo b/src/UnityScript.Tests/IntegrationTestFixture.boo index e68f887..3067a7a 100644 --- a/src/UnityScript.Tests/IntegrationTestFixture.boo +++ b/src/UnityScript.Tests/IntegrationTestFixture.boo @@ -339,6 +339,14 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/duck-implicit-bool-1.js") + [Test] def duck_implicit_bool_and_with_simple_ref(): + RunTestCase("tests/integration/duck-implicit-bool-and-with-simple-ref.js") + + + [Test] def duck_implicit_bool_and(): + RunTestCase("tests/integration/duck-implicit-bool-and.js") + + [Test] def duck_implicit_bool_full(): RunTestCase("tests/integration/duck-implicit-bool-full.js") @@ -483,6 +491,10 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/implicit_conversion.js") + [Test] def implict_bool_hierarchy(): + RunTestCase("tests/integration/implict-bool-hierarchy.js") + + [Test] def initializeorder(): RunTestCase("tests/integration/initializeorder.js") diff --git a/tests/integration/duck-implicit-bool-and-with-simple-ref.js b/tests/integration/duck-implicit-bool-and-with-simple-ref.js new file mode 100644 index 0000000..f53a227 --- /dev/null +++ b/tests/integration/duck-implicit-bool-and-with-simple-ref.js @@ -0,0 +1,22 @@ +/* +yes +*/ +import UnityScript.Tests.CSharp; + +class Foo extends OperatorBoolProperties { + + function foo() { + print("foo"); + return false; + } + + function run() { + + if (boolOperatorTestFalse && foo()) + print ("Fail"); + else + print ("yes"); + } +} + +new Foo().run(); \ No newline at end of file diff --git a/tests/integration/duck-implicit-bool-and.js b/tests/integration/duck-implicit-bool-and.js new file mode 100644 index 0000000..8943bea --- /dev/null +++ b/tests/integration/duck-implicit-bool-and.js @@ -0,0 +1,14 @@ +/* +yes +*/ +import UnityScript.Tests.CSharp; + +function foo() { + print("foo"); + return false; +} + +if (OperatorBoolProperties.boolOperatorTestFalse && foo()) + print ("Fail"); +else + print ("yes"); \ No newline at end of file diff --git a/tests/integration/implict-bool-hierarchy.js b/tests/integration/implict-bool-hierarchy.js new file mode 100644 index 0000000..0ed08bb --- /dev/null +++ b/tests/integration/implict-bool-hierarchy.js @@ -0,0 +1,56 @@ +/* +yes +yes +*/ +class Component { + static function op_Implicit(self: Component): boolean { + return self.enabled; + } + + function Component(enabled: boolean) { + this.enabled = enabled; + } + + private var enabled: boolean; +} + +class Rigidbody extends Component { + function Rigidbody() { + super(false); + } + + function get isKinematic() { + return true; + } +} + +class Collider extends Component { + function Collider() { + super(true); + } +} + +class Behaviour extends Component { + + function Behaviour() { super(true); } + + function get rigidbody() { return new Rigidbody(); } + function get collider() { return new Collider(); } +} + +class Foo extends Behaviour { + function Start() { + + if (rigidbody && rigidbody.isKinematic) + print("fail"); + else + print("yes"); + + if (!collider) + print("fail"); + else + print("yes"); + } +} + +new Foo().Start(); From d2420b9d2af025d6aa6e4f3c86d4b242f20cfc37 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 16 Jul 2010 12:56:08 -0300 Subject: [PATCH 050/276] use double precision when literal cant be properly as a single (to single.Epsilon precision) --- .../IntegrationTestFixture.boo | 4 +++ src/UnityScript/Parser/CodeFactory.boo | 12 +++++++ src/UnityScript/Parser/UnityScriptLexer.boo | 8 ----- src/UnityScript/Parser/UnityScriptParser.boo | 7 +---- src/UnityScript/UnityScript.g | 14 ++------- ...uble-precision-can-be-used-for-literals.js | 7 +++++ tests/integration/float-1.js | 31 ++++++++++++++++--- 7 files changed, 54 insertions(+), 29 deletions(-) create mode 100644 tests/integration/double-precision-can-be-used-for-literals.js diff --git a/src/UnityScript.Tests/IntegrationTestFixture.boo b/src/UnityScript.Tests/IntegrationTestFixture.boo index 3067a7a..f7ee071 100644 --- a/src/UnityScript.Tests/IntegrationTestFixture.boo +++ b/src/UnityScript.Tests/IntegrationTestFixture.boo @@ -327,6 +327,10 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/crash.js") + [Test] def double_precision_can_be_used_for_literals(): + RunTestCase("tests/integration/double-precision-can-be-used-for-literals.js") + + [Test] def duck_1(): RunTestCase("tests/integration/duck-1.js") diff --git a/src/UnityScript/Parser/CodeFactory.boo b/src/UnityScript/Parser/CodeFactory.boo index 418d5c0..a706647 100755 --- a/src/UnityScript/Parser/CodeFactory.boo +++ b/src/UnityScript/Parser/CodeFactory.boo @@ -1,5 +1,6 @@ namespace UnityScript.Parser +import System.Globalization import Boo.Lang.Compiler.Ast static class CodeFactory: @@ -7,6 +8,17 @@ static class CodeFactory: def NewArrayInitializer(location as LexicalInfo, elementType as TypeReference, count as Expression): return [| Boo.Lang.Builtins.array[of $elementType](cast(int, $count)) |].WithLocation(location) + def NewDoubleLiteralExpression(location as LexicalInfo, literal as string): + if literal.EndsWith('f') or literal.EndsWith('F'): + return DoubleLiteralExpression(location, ParseDouble(literal[:-1]), IsSingle: true) + + value = ParseDouble(literal) + s as single = value + return DoubleLiteralExpression(location, value, IsSingle: (value - s) < single.Epsilon) + + private def ParseDouble(text as string): + return double.Parse(text, CultureInfo.InvariantCulture) + [Extension] def WithLocation[of T(Node)](node as T, location as LexicalInfo): node.LexicalInfo = location diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index 5defaae..0ef8928 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -725,13 +725,9 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 _givenValue = cached_LA1 if ((_givenValue == char('f'))): // 1831 - _saveIndex = text.Length match('f') - text.Length = _saveIndex elif ((_givenValue == char('F'))): // 1831 - _saveIndex = text.Length match('F') - text.Length = _saveIndex else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) if 0 == inputState.guessing: @@ -817,13 +813,9 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 _givenValue = cached_LA1 if ((_givenValue == char('f'))): // 1831 - _saveIndex = text.Length match('f') - text.Length = _saveIndex elif ((_givenValue == char('F'))): // 1831 - _saveIndex = text.Length match('F') - text.Length = _saveIndex else: // line 1969 pass // 947 if (_createToken and (_token is null) and (_ttype != Token.SKIP)): diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 5903944..beba658 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -200,9 +200,6 @@ class UnityScriptParser(antlr.LLkParser): tokenLength = (0 if text is null else len(text)-1) return SourceLocation(token.getLine(), token.getColumn()+tokenLength) - static def ParseDouble(text as string): - return double.Parse(text, CultureInfo.InvariantCulture) - static def ParseIntegerLiteralExpression(token as antlr.IToken, s as string, isLong as bool): @@ -661,9 +658,7 @@ class UnityScriptParser(antlr.LLkParser): value = LT(1) match(DOUBLE) if 0 == inputState.guessing: - rle = DoubleLiteralExpression(ToLexicalInfo(value), - ParseDouble(value.getText()), - IsSingle: true); + rle = CodeFactory.NewDoubleLiteralExpression(ToLexicalInfo(value), value.getText()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index d030808..d4f15af 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -177,9 +177,6 @@ tokens tokenLength = (0 if text is null else len(text)-1) return SourceLocation(token.getLine(), token.getColumn()+tokenLength) - static def ParseDouble(text as string): - return double.Parse(text, CultureInfo.InvariantCulture) - static def ParseIntegerLiteralExpression(token as antlr.IToken, s as string, isLong as bool): @@ -1693,12 +1690,7 @@ re_literal returns [RELiteralExpression re] double_literal returns [DoubleLiteralExpression rle] { }: - value:DOUBLE - { - rle = DoubleLiteralExpression(ToLexicalInfo(value), - ParseDouble(value.getText()), - IsSingle: true); - } + value:DOUBLE { rle = CodeFactory.NewDoubleLiteralExpression(ToLexicalInfo(value), value.getText()) } ; self_literal returns [SelfLiteralExpression e] @@ -1791,7 +1783,7 @@ INT: (DIGIT)+ ( ('l' | 'L') { $setType(LONG); } | - ('f'! | 'F'!) { $setType(DOUBLE); } | + ('f' | 'F') { $setType(DOUBLE); } | ('.' DOUBLE_SUFFIX) { $setType(DOUBLE); } | EXPONENT { $setType(DOUBLE); } | ) @@ -1800,7 +1792,7 @@ INT: DOT: '.' (DOUBLE_SUFFIX {$setType(DOUBLE);})?; protected -DOUBLE_SUFFIX: (DIGIT)+ (EXPONENT)? ('f'! | 'F'!)?; +DOUBLE_SUFFIX: (DIGIT)+ (EXPONENT)? ('f' | 'F')?; protected EXPONENT: ('e' | 'E') ('+' | '-')? (DIGIT)+; diff --git a/tests/integration/double-precision-can-be-used-for-literals.js b/tests/integration/double-precision-can-be-used-for-literals.js new file mode 100644 index 0000000..2b0ce9f --- /dev/null +++ b/tests/integration/double-precision-can-be-used-for-literals.js @@ -0,0 +1,7 @@ +/* +-4.42330604244772 +*/ +var e:double = -4.42330604244772; +var g = System.Convert.ToString(e); +print(g); + diff --git a/tests/integration/float-1.js b/tests/integration/float-1.js index cc8a4eb..a929a36 100644 --- a/tests/integration/float-1.js +++ b/tests/integration/float-1.js @@ -1,10 +1,33 @@ /* System.Single System.Single +System.Single +System.Single +System.Single +System.Single +System.Double +System.Single */ -value = .5; -System.Console.WriteLine(value.GetType()); +v1 = .5; +print(v1.GetType()); + +v2 = .5f; +print(v2.GetType()); + +v3 = .55; +print(v3.GetType()); + +v4 = .55f; +print(v4.GetType()); + +v5 = .555; +print(v5.GetType()); + +v6 = .555f; +print(v6.GetType()); -value = .5f; -System.Console.WriteLine(value.GetType()); +v7 = .5555; // infered as double +print(v7.GetType()); +v8 = .5555f; // forces single precision +print(v8.GetType()); From db33d1c11a930cbcefa7454ff37f2dc5e59d7305 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 22 Jul 2010 11:25:02 -0300 Subject: [PATCH 051/276] use generic types whenever possible --- src/UnityScript.Lang/ExpandoServices.boo | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/UnityScript.Lang/ExpandoServices.boo b/src/UnityScript.Lang/ExpandoServices.boo index db5309b..91dfbab 100755 --- a/src/UnityScript.Lang/ExpandoServices.boo +++ b/src/UnityScript.Lang/ExpandoServices.boo @@ -1,12 +1,12 @@ namespace UnityScript.Lang import System -import System.Collections +import System.Collections.Generic internal class Expando: _target as WeakReference - _attributes = Hashtable() + _attributes = Dictionary[of string, object]() def constructor(target): _target = WeakReference(target) @@ -14,9 +14,8 @@ internal class Expando: Target: get: return _target.Target - Item[key]: - get: - return _attributes[key] + Item[key as string]: + get: return _attributes[key] set: if value is null: @@ -26,7 +25,7 @@ internal class Expando: static class ExpandoServices: - _expandos = List() + _expandos = List[of Expando]() def GetExpandoProperty(target, name as string): expando = GetExpandoFor(target) From dcf15dac191a00e3ee24d703e7c7283464549652 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 22 Jul 2010 11:41:55 -0300 Subject: [PATCH 052/276] always use UnityRuntimeServices.GetProperty to ensure all the extensions are properly registered (fixes #366552) --- src/UnityScript.Tests/IntegrationTestFixture.boo | 4 ++++ src/UnityScript.Tests/MonoBehaviour.boo | 4 ++++ .../Steps/ExpandUnityDuckTypedExpressions.boo | 5 +++-- tests/integration/array-length-duck-typed.js | 15 +++++++++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 tests/integration/array-length-duck-typed.js diff --git a/src/UnityScript.Tests/IntegrationTestFixture.boo b/src/UnityScript.Tests/IntegrationTestFixture.boo index f7ee071..ae1d8d6 100644 --- a/src/UnityScript.Tests/IntegrationTestFixture.boo +++ b/src/UnityScript.Tests/IntegrationTestFixture.boo @@ -135,6 +135,10 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-length-2.js") + [Test] def array_length_duck_typed(): + RunTestCase("tests/integration/array-length-duck-typed.js") + + [Test] def array_length(): RunTestCase("tests/integration/array-length.js") diff --git a/src/UnityScript.Tests/MonoBehaviour.boo b/src/UnityScript.Tests/MonoBehaviour.boo index a4b07ef..cff0176 100755 --- a/src/UnityScript.Tests/MonoBehaviour.boo +++ b/src/UnityScript.Tests/MonoBehaviour.boo @@ -96,6 +96,10 @@ class MonoBehaviour(Component): def GetComponent(type as System.Type) as Component: return _foo if ComponentFoo is type return _bar + + [DuckTyped] + def GetComponents(type as System.Type) as (Component): + return (GetComponent(type),) [DuckTyped] def implicit_bool_test_false() as ImplicitBoolTest: diff --git a/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo b/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo index 2c24cf9..2978364 100755 --- a/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo +++ b/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo @@ -8,11 +8,13 @@ import Boo.Lang.Compiler.Steps class ExpandUnityDuckTypedExpressions(ExpandDuckTypedExpressions): private UnityRuntimeServices_Invoke as IMethod + private UnityRuntimeServices_GetProperty as IMethod private _expando as bool override def Initialize(context as CompilerContext): super(context) UnityRuntimeServices_Invoke = ResolveUnityRuntimeMethod("Invoke") + UnityRuntimeServices_GetProperty = ResolveUnityRuntimeMethod("GetProperty") override def EnterModule(module as Module): _expando = UnityScriptParameters.Expando or module.ContainsAnnotation("expando") @@ -23,8 +25,7 @@ class ExpandUnityDuckTypedExpressions(ExpandDuckTypedExpressions): return ResolveUnityRuntimeMethod("SetProperty") override def GetGetPropertyMethod(): - if not _expando: return super() - return ResolveUnityRuntimeMethod("GetProperty") + return UnityRuntimeServices_GetProperty override def ExpandQuackInvocation(node as MethodInvocationExpression): if not IsPossibleStartCoroutineInvocation(node): diff --git a/tests/integration/array-length-duck-typed.js b/tests/integration/array-length-duck-typed.js new file mode 100644 index 0000000..9b99a7a --- /dev/null +++ b/tests/integration/array-length-duck-typed.js @@ -0,0 +1,15 @@ +/* +1 +1 +*/ +import UnityScript.Tests; + +function run() { + var components = GetComponents(ComponentFoo); + print(components.length); + + var cpnts:Component[] = components; + print(cpnts.length); +} + +run(); From bd13e91ada91024ae457b3611eb43ef6c2847778 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 22 Jul 2010 14:31:06 -0300 Subject: [PATCH 053/276] test case for untyped variable declarations (with null initializer and without any initializer) --- src/UnityScript.Tests/IntegrationTestFixture.boo | 8 ++++++++ tests/integration/null-initializer.js | 10 ++++++++++ tests/integration/var-with-no-initializer.js | 10 ++++++++++ 3 files changed, 28 insertions(+) create mode 100644 tests/integration/null-initializer.js create mode 100644 tests/integration/var-with-no-initializer.js diff --git a/src/UnityScript.Tests/IntegrationTestFixture.boo b/src/UnityScript.Tests/IntegrationTestFixture.boo index ae1d8d6..ae17dbb 100644 --- a/src/UnityScript.Tests/IntegrationTestFixture.boo +++ b/src/UnityScript.Tests/IntegrationTestFixture.boo @@ -543,6 +543,10 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/null-assign.js") + [Test] def null_initializer(): + RunTestCase("tests/integration/null-initializer.js") + + [Test] def operators_4(): RunTestCase("tests/integration/operators-4.js") @@ -647,6 +651,10 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/valuetypes-1.js") + [Test] def var_with_no_initializer(): + RunTestCase("tests/integration/var-with-no-initializer.js") + + [Test] def variable_declaration_2(): RunTestCase("tests/integration/variable-declaration-2.js") diff --git a/tests/integration/null-initializer.js b/tests/integration/null-initializer.js new file mode 100644 index 0000000..0f30bfc --- /dev/null +++ b/tests/integration/null-initializer.js @@ -0,0 +1,10 @@ +/* +0 +*/ +function run() { + var obj = null; + obj = new Object[0]; + print(obj.length); +} + +run(); diff --git a/tests/integration/var-with-no-initializer.js b/tests/integration/var-with-no-initializer.js new file mode 100644 index 0000000..b8140f6 --- /dev/null +++ b/tests/integration/var-with-no-initializer.js @@ -0,0 +1,10 @@ +/* +0 +*/ +function run() { + var obj; + obj = new Object[0]; + print(obj.length); +} + +run(); From 36e9d14b37d8cf1f2ca4dad172fd55ff26e2fa9e Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 26 Jul 2010 15:47:21 -0300 Subject: [PATCH 054/276] use 'double' in error messages instead of 'Number' --- .../ErrorMessagesTestFixture.Generated.boo | 4 ++++ src/UnityScript.Tests/IntegrationTestFixture.boo | 4 ++++ src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo | 2 +- .../double-array-in-float-array-var-initializer.js | 5 +++++ tests/integration/float-array-literal.js | 10 ++++++++++ 5 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tests/error-messages/double-array-in-float-array-var-initializer.js create mode 100644 tests/integration/float-array-literal.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index 2e6fc83..518be74 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -30,6 +30,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/conditional-compilation-with-pragma-strict.js") + [Test] def double_array_in_float_array_var_initializer(): + RunTestCase("tests/error-messages/double-array-in-float-array-var-initializer.js") + + [Test] def error_for_final_used_as_identifier(): RunTestCase("tests/error-messages/error-for-final-used-as-identifier.js") diff --git a/src/UnityScript.Tests/IntegrationTestFixture.boo b/src/UnityScript.Tests/IntegrationTestFixture.boo index ae17dbb..76633d7 100644 --- a/src/UnityScript.Tests/IntegrationTestFixture.boo +++ b/src/UnityScript.Tests/IntegrationTestFixture.boo @@ -463,6 +463,10 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/float-2.js") + [Test] def float_array_literal(): + RunTestCase("tests/integration/float-array-literal.js") + + [Test] def for_break_1(): RunTestCase("tests/integration/for-break-1.js") diff --git a/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo b/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo index f71c5de..12abf93 100755 --- a/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo +++ b/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo @@ -58,9 +58,9 @@ class UnityScriptTypeSystem(TypeSystemServices): AddPrimitiveType("uint", UIntType) AddPrimitiveType("long", LongType) AddPrimitiveType("ulong", ULongType) + AddPrimitiveType("Number", DoubleType) AddPrimitiveType("float", SingleType) AddPrimitiveType("double", DoubleType) - AddPrimitiveType("Number", DoubleType) AddPrimitiveType("Function", ICallableType) AddPrimitiveType("Array", Map(UnityScript.Lang.Array)) diff --git a/tests/error-messages/double-array-in-float-array-var-initializer.js b/tests/error-messages/double-array-in-float-array-var-initializer.js new file mode 100644 index 0000000..9100f30 --- /dev/null +++ b/tests/error-messages/double-array-in-float-array-var-initializer.js @@ -0,0 +1,5 @@ +/* +double-array-in-float-array-var-initializer.js(4,22): BCE0022: Cannot convert 'double[]' to 'float[]'. +*/ +var floats:float[] = [1.0, 0.7 /* 0.7 inferred as double for precision */]; + diff --git a/tests/integration/float-array-literal.js b/tests/integration/float-array-literal.js new file mode 100644 index 0000000..a35789e --- /dev/null +++ b/tests/integration/float-array-literal.js @@ -0,0 +1,10 @@ +/* +1 +0.7 +*/ +function run() { + var floats:float[] = [1.0, 0.7f]; + for (var f in floats) print(f); +} + +run(); From 18795fa4d2ed56d95a8904c30acafee942c00b6b Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 26 Jul 2010 19:13:34 -0300 Subject: [PATCH 055/276] test case for uint literals (fixed in the boo compiler) --- src/UnityScript.Tests/IntegrationTestFixture.boo | 4 ++++ tests/integration/uint-1.js | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100644 tests/integration/uint-1.js diff --git a/src/UnityScript.Tests/IntegrationTestFixture.boo b/src/UnityScript.Tests/IntegrationTestFixture.boo index 76633d7..7c842ef 100644 --- a/src/UnityScript.Tests/IntegrationTestFixture.boo +++ b/src/UnityScript.Tests/IntegrationTestFixture.boo @@ -651,6 +651,10 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/types-1.js") + [Test] def uint_1(): + RunTestCase("tests/integration/uint-1.js") + + [Test] def valuetypes_1(): RunTestCase("tests/integration/valuetypes-1.js") diff --git a/tests/integration/uint-1.js b/tests/integration/uint-1.js new file mode 100644 index 0000000..7b2bba1 --- /dev/null +++ b/tests/integration/uint-1.js @@ -0,0 +1,9 @@ +/* +2147483648 +*/ +function run() { + var myUInt : uint = 2147483648; + print(myUInt); +} + +run(); From 064ecbe62a1c5b8b4fa268ff45d5e7975b3e925e Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 28 Jul 2010 11:21:17 -0300 Subject: [PATCH 056/276] test case cleanup --- tests/error-messages/array-struct-warning.js | 1 - tests/error-messages/incompatible-initializer-1.js | 6 ++---- tests/error-messages/iterator-warning.js | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/error-messages/array-struct-warning.js b/tests/error-messages/array-struct-warning.js index 84e89d0..28e4534 100644 --- a/tests/error-messages/array-struct-warning.js +++ b/tests/error-messages/array-struct-warning.js @@ -1,7 +1,6 @@ /* */ -// Gives a warning about writing to a temporary but it actually works correctly. var arr = new UnityScript.Tests.CSharp.Vector3[5]; for (var i=0;i Date: Wed, 28 Jul 2010 11:23:24 -0300 Subject: [PATCH 057/276] support for try block followed immediately by finally block (no catch blocks) --- .../ParserTestFixture.Generated.boo | 4 ++ src/UnityScript/UnityScript.g | 37 ++++++++----------- tests/parser/try-finally.js | 11 ++++++ 3 files changed, 31 insertions(+), 21 deletions(-) create mode 100644 tests/parser/try-finally.js diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index 765c727..92f000f 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -194,6 +194,10 @@ partial class ParserTestFixture: RunTestCase("tests/parser/try-1.js") + [Test] def try_finally(): + RunTestCase("tests/parser/try-finally.js") + + [Test] def var_1(): RunTestCase("tests/parser/var-1.js") diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index d4f15af..f8e7a7d 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -977,29 +977,24 @@ try_statement[Block container] } compound_or_single_stmt[b] ( - ( - ct:CATCH LPAREN id:ID (COLON tr=type_reference)? RPAREN - { - tr = SimpleTypeReference(ToLexicalInfo(id), "System.Exception") if tr is null - handler = ExceptionHandler( - ToLexicalInfo(ct), - Declaration: Declaration( - ToLexicalInfo(id), - Name: id.getText(), - Type: tr)) - s.ExceptionHandlers.Add(handler) - b = handler.Block - tr = null - } - compound_or_single_stmt[b] - )+ - ( - finally_block[s] - )? - ) | + ct:CATCH LPAREN id:ID (COLON tr=type_reference)? RPAREN + { + tr = SimpleTypeReference(ToLexicalInfo(id), "System.Exception") if tr is null + handler = ExceptionHandler( + ToLexicalInfo(ct), + Declaration: Declaration( + ToLexicalInfo(id), + Name: id.getText(), + Type: tr)) + s.ExceptionHandlers.Add(handler) + b = handler.Block + tr = null + } + compound_or_single_stmt[b] + )* ( finally_block[s] - ) + )? ; finally_block[TryStatement s] diff --git a/tests/parser/try-finally.js b/tests/parser/try-finally.js new file mode 100644 index 0000000..1f983b0 --- /dev/null +++ b/tests/parser/try-finally.js @@ -0,0 +1,11 @@ +/* +try: + raise System.ApplicationException('testing...') +ensure: + print('yes...') +*/ +try { + throw new System.ApplicationException("testing..."); +} finally { + print("yes..."); +} From a4b84b4565897ac633dd41a853db9f84450a1acb Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 28 Jul 2010 11:23:42 -0300 Subject: [PATCH 058/276] antlr generated files --- src/UnityScript/Parser/UnityScriptLexer.boo | 98 ++++----- src/UnityScript/Parser/UnityScriptParser.boo | 209 +++++++++---------- 2 files changed, 144 insertions(+), 163 deletions(-) diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index 0ef8928..24ae79d 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -578,8 +578,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mDIGIT(false) else: // line 1969 - goto _loop305_breakloop - :_loop305_breakloop + goto _loop303_breakloop + :_loop303_breakloop _ttype = testLiteralsTable(_ttype) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -672,17 +672,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): match("0x") - _cnt309 as int = 0 + _cnt307 as int = 0 while true: if ((tokenSet_0_.member(cast(int, cached_LA1)))): mHEXDIGIT(false) else: - if (_cnt309 >= 1): - goto _loop309_breakloop + if (_cnt307 >= 1): + goto _loop307_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt309 - :_loop309_breakloop + ++_cnt307 + :_loop307_breakloop if ((cached_LA1==char('L') or cached_LA1==char('l'))): _givenValue = cached_LA1 if ((_givenValue == char('l'))): // 1831 @@ -696,17 +696,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): else: // line 2053 pass // 947 elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt313 as int = 0 + _cnt311 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt313 >= 1): - goto _loop313_breakloop + if (_cnt311 >= 1): + goto _loop311_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt313 - :_loop313_breakloop + ++_cnt311 + :_loop311_breakloop _givenValue = cached_LA1 if ((_givenValue == char('L')) or (_givenValue ==char('l')) @@ -796,17 +796,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_SUFFIX - _cnt322 as int = 0 + _cnt320 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt322 >= 1): - goto _loop322_breakloop + if (_cnt320 >= 1): + goto _loop320_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt322 - :_loop322_breakloop + ++_cnt320 + :_loop320_breakloop if ((cached_LA1==char('E') or cached_LA1==char('e'))): mEXPONENT(false) else: // line 2053 @@ -853,17 +853,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt329 as int = 0 + _cnt327 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt329 >= 1): - goto _loop329_breakloop + if (_cnt327 >= 1): + goto _loop327_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt329 - :_loop329_breakloop + ++_cnt327 + :_loop327_breakloop if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1335,18 +1335,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched377 as bool = false + synPredMatched375 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m377 as int = mark() - synPredMatched377 = true + _m375 as int = mark() + synPredMatched375 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched377 = false - rewind(_m377) + synPredMatched375 = false + rewind(_m375) --inputState.guessing - if synPredMatched377: + if synPredMatched375: mML_COMMENT(false) if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1359,8 +1359,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop382_breakloop - :_loop382_breakloop + goto _loop380_breakloop + :_loop380_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; elif ((_givenValue == char('='))): // 1831 @@ -1389,8 +1389,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop407_breakloop - :_loop407_breakloop + goto _loop405_breakloop + :_loop405_breakloop match("*/") if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1403,7 +1403,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt386 as int = 0 + _cnt384 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1417,12 +1417,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt386 >= 1): - goto _loop386_breakloop + if (_cnt384 >= 1): + goto _loop384_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt386 - :_loop386_breakloop + ++_cnt384 + :_loop384_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1465,8 +1465,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop390_breakloop - :_loop390_breakloop + goto _loop388_breakloop + :_loop388_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1596,17 +1596,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt410 as int = 0 + _cnt408 as int = 0 while true: if ((tokenSet_4_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt410 >= 1): - goto _loop410_breakloop + if (_cnt408 >= 1): + goto _loop408_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt410 - :_loop410_breakloop + ++_cnt408 + :_loop408_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1664,17 +1664,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt416 as int = 0 + _cnt414 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_6_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt416 >= 1): - goto _loop416_breakloop + if (_cnt414 >= 1): + goto _loop414_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt416 - :_loop416_breakloop + ++_cnt414 + :_loop414_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index beba658..73b735e 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -421,8 +421,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling _givenValue = LA(1) - if ((_givenValue == FINALLY) - or (_givenValue ==FOR) + if ((_givenValue == FOR) or (_givenValue ==IF) or (_givenValue ==TRY) or (_givenValue ==WHILE) @@ -435,9 +434,7 @@ class UnityScriptParser(antlr.LLkParser): for_statement(b) elif ((_givenValue == IF)): // 1831 if_statement(b) - elif ((_givenValue == FINALLY) - or (_givenValue ==TRY) - ): // 1827 + elif ((_givenValue == TRY)): // 1831 try_statement(b) elif ((_givenValue == SWITCH)): // 1831 switch_statement(b) @@ -788,8 +785,8 @@ class UnityScriptParser(antlr.LLkParser): else: // line 1969 raise NoViableAltException(LT(1), getFilename()) else: - goto _loop196_breakloop - :_loop196_breakloop + goto _loop194_breakloop + :_loop194_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1419,7 +1416,6 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==ENUM) or (_givenValue ==FALSE) or (_givenValue ==FINAL) - or (_givenValue ==FINALLY) or (_givenValue ==FOR) or (_givenValue ==FUNCTION) or (_givenValue ==IF) @@ -1479,7 +1475,6 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==ENUM) or (_givenValue ==FALSE) or (_givenValue ==FINAL) - or (_givenValue ==FINALLY) or (_givenValue ==FOR) or (_givenValue ==FUNCTION) or (_givenValue ==IF) @@ -1653,61 +1648,50 @@ class UnityScriptParser(antlr.LLkParser): id as IToken = null try: // for error handling - _givenValue = LA(1) - if ((_givenValue == TRY)): // 1831 - tt = LT(1) - match(TRY) - if 0 == inputState.guessing: - s = TryStatement(ToLexicalInfo(tt)) - b = s.ProtectedBlock - container.Add(s) - compound_or_single_stmt(b) - _cnt154 as int = 0 - while true: - if ((LA(1)==CATCH) and (LA(2)==LPAREN)): - ct = LT(1) - match(CATCH) - match(LPAREN) - id = LT(1) - match(ID) - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RPAREN) - if 0 == inputState.guessing: - tr = SimpleTypeReference(ToLexicalInfo(id), "System.Exception") if tr is null - handler = ExceptionHandler( - ToLexicalInfo(ct), - Declaration: Declaration( - ToLexicalInfo(id), - Name: id.getText(), - Type: tr)) - s.ExceptionHandlers.Add(handler) - b = handler.Block - tr = null - compound_or_single_stmt(b) - else: - if (_cnt154 >= 1): - goto _loop154_breakloop - else: + tt = LT(1) + match(TRY) + if 0 == inputState.guessing: + s = TryStatement(ToLexicalInfo(tt)) + b = s.ProtectedBlock + container.Add(s) + compound_or_single_stmt(b) + while true: + if ((LA(1)==CATCH) and (LA(2)==LPAREN)): + ct = LT(1) + match(CATCH) + match(LPAREN) + id = LT(1) + match(ID) + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + elif ((_givenValue == RPAREN)): // 1831 + pass // 947 + else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - ++_cnt154 - :_loop154_breakloop - if ((LA(1)==FINALLY) and (tokenSet_38_.member(cast(int, LA(2))))): - finally_block(s) - elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 - pass // 947 + match(RPAREN) + if 0 == inputState.guessing: + tr = SimpleTypeReference(ToLexicalInfo(id), "System.Exception") if tr is null + handler = ExceptionHandler( + ToLexicalInfo(ct), + Declaration: Declaration( + ToLexicalInfo(id), + Name: id.getText(), + Type: tr)) + s.ExceptionHandlers.Add(handler) + b = handler.Block + tr = null + compound_or_single_stmt(b) else: - raise NoViableAltException(LT(1), getFilename()) - elif ((_givenValue == FINALLY)): // 1831 + goto _loop153_breakloop + :_loop153_breakloop + if ((LA(1)==FINALLY) and (tokenSet_38_.member(cast(int, LA(2))))): finally_block(s) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) + elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -2039,8 +2023,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: typeReferences.Add(tr) else: - goto _loop179_breakloop - :_loop179_breakloop + goto _loop177_breakloop + :_loop177_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -2365,8 +2349,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling _givenValue = LA(1) - if ((_givenValue == FINALLY) - or (_givenValue ==FOR) + if ((_givenValue == FOR) or (_givenValue ==IF) or (_givenValue ==TRY) or (_givenValue ==WHILE) @@ -2379,9 +2362,7 @@ class UnityScriptParser(antlr.LLkParser): for_statement(b) elif ((_givenValue == IF)): // 1831 if_statement(b) - elif ((_givenValue == FINALLY) - or (_givenValue ==TRY) - ): // 1827 + elif ((_givenValue == TRY)): // 1831 try_statement(b) elif ((_givenValue == SWITCH)): // 1831 switch_statement(b) @@ -3085,8 +3066,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) else: - goto _loop171_breakloop - :_loop171_breakloop + goto _loop169_breakloop + :_loop169_breakloop elif ((_givenValue == RPAREN)): // 1831 pass // 947 else: // line 1969 @@ -3150,8 +3131,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop245_breakloop - :_loop245_breakloop + goto _loop243_breakloop + :_loop243_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3180,18 +3161,18 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched183 as bool = false + synPredMatched181 as bool = false if ((LA(1)==NEW) and (LA(2)==ID)): - _m183 as int = mark() - synPredMatched183 = true + _m181 as int = mark() + synPredMatched181 = true ++inputState.guessing try: new_array_expression() except x as RecognitionException: - synPredMatched183 = false - rewind(_m183) + synPredMatched181 = false + rewind(_m181) --inputState.guessing - if synPredMatched183: + if synPredMatched181: e=new_array_expression() elif ((LA(1)==NEW) and (LA(2)==ID)): // line 2102 match(NEW) @@ -3252,8 +3233,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ec.Add(e); else: - goto _loop211_breakloop - :_loop211_breakloop + goto _loop209_breakloop + :_loop209_breakloop elif ((_givenValue == RPAREN) or (_givenValue ==RBRACK) ): // 1827 @@ -3568,8 +3549,8 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) slice(se) else: - goto _loop227_breakloop - :_loop227_breakloop + goto _loop225_breakloop + :_loop225_breakloop match(RBRACK) elif ((LA(1)==DOT) and (LA(2)==GET or LA(2)==SET or LA(2)==ID)): // line 2102 match(DOT) @@ -3587,8 +3568,8 @@ class UnityScriptParser(antlr.LLkParser): expression_list(args) match(RPAREN) else: - goto _loop230_breakloop - :_loop230_breakloop + goto _loop228_breakloop + :_loop228_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3756,8 +3737,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop241_breakloop - :_loop241_breakloop + goto _loop239_breakloop + :_loop239_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3793,8 +3774,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop249_breakloop - :_loop249_breakloop + goto _loop247_breakloop + :_loop247_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3873,8 +3854,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop261_breakloop - :_loop261_breakloop + goto _loop259_breakloop + :_loop259_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3922,8 +3903,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), op, e, r) else: - goto _loop269_breakloop - :_loop269_breakloop + goto _loop267_breakloop + :_loop267_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3949,8 +3930,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop272_breakloop - :_loop272_breakloop + goto _loop270_breakloop + :_loop270_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3976,8 +3957,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop275_breakloop - :_loop275_breakloop + goto _loop273_breakloop + :_loop273_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4003,8 +3984,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop278_breakloop - :_loop278_breakloop + goto _loop276_breakloop + :_loop276_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4031,8 +4012,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop281_breakloop - :_loop281_breakloop + goto _loop279_breakloop + :_loop279_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4059,8 +4040,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop284_breakloop - :_loop284_breakloop + goto _loop282_breakloop + :_loop282_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4135,8 +4116,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dle.Items.Add(pair); else: - goto _loop293_breakloop - :_loop293_breakloop + goto _loop291_breakloop + :_loop291_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 @@ -4353,11 +4334,11 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) private static def mk_tokenSet_2_() as (long): - data = (4818983474080108832L, 523986277888L, 0L, 0L, ) + data = (4818983474080092448L, 523986277888L, 0L, 0L, ) return data public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) private static def mk_tokenSet_3_() as (long): - data = (-3747417124987603534L, 547608330239L, 0L, 0L, ) + data = (-3747417124987619918L, 547608330239L, 0L, 0L, ) return data public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) private static def mk_tokenSet_4_() as (long): @@ -4365,7 +4346,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) private static def mk_tokenSet_5_() as (long): - data = (4818992316214539682L, 527744374272L, 0L, 0L, ) + data = (4818992316214523298L, 527744374272L, 0L, 0L, ) return data public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) private static def mk_tokenSet_6_() as (long): @@ -4373,7 +4354,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) private static def mk_tokenSet_7_() as (long): - data = (4818992316214015394L, 525596890624L, 0L, 0L, ) + data = (4818992316213999010L, 525596890624L, 0L, 0L, ) return data public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) private static def mk_tokenSet_8_() as (long): @@ -4425,11 +4406,11 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) private static def mk_tokenSet_20_() as (long): - data = (4818992317287757218L, 525596890624L, 0L, 0L, ) + data = (4818992317287740834L, 525596890624L, 0L, 0L, ) return data public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) private static def mk_tokenSet_21_() as (long): - data = (-3747417106733861454L, 547608330239L, 0L, 0L, ) + data = (-3747417106733877838L, 547608330239L, 0L, 0L, ) return data public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) private static def mk_tokenSet_22_() as (long): @@ -4485,7 +4466,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) private static def mk_tokenSet_35_() as (long): - data = (4891049911325685154L, 525596890624L, 0L, 0L, ) + data = (4891049911325668770L, 525596890624L, 0L, 0L, ) return data public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) private static def mk_tokenSet_36_() as (long): @@ -4497,7 +4478,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) private static def mk_tokenSet_38_() as (long): - data = (4818983474080108832L, 523986278016L, 0L, 0L, ) + data = (4818983474080092448L, 523986278016L, 0L, 0L, ) return data public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) private static def mk_tokenSet_39_() as (long): @@ -4533,7 +4514,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) private static def mk_tokenSet_47_() as (long): - data = (6043971415932532130L, 525596891008L, 0L, 0L, ) + data = (6043971415932515746L, 525596891008L, 0L, 0L, ) return data public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) private static def mk_tokenSet_48_() as (long): @@ -4541,7 +4522,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) private static def mk_tokenSet_49_() as (long): - data = (4891041068118036768L, 523986278016L, 0L, 0L, ) + data = (4891041068118020384L, 523986278016L, 0L, 0L, ) return data public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) private static def mk_tokenSet_50_() as (long): From 806c8fa91b82605106de3546858e2b290c6eec74 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 5 Aug 2010 10:30:05 -0300 Subject: [PATCH 059/276] custom services are now to be configured through CompilerParameters.Environment --- .../AbstractSemanticsTestFixture.boo | 1 - .../Steps/InitializeUnityScriptTypeSystem.boo | 19 ------------------- .../UnityCallableResolutionService.boo | 3 --- .../TypeSystem/UnityScriptTypeSystem.boo | 3 +-- src/UnityScript/UnityScript.booproj | 1 - src/UnityScript/UnityScriptCompiler.boo | 3 --- .../UnityScriptCompilerParameters.boo | 10 ++++++++++ 7 files changed, 11 insertions(+), 29 deletions(-) delete mode 100755 src/UnityScript/Steps/InitializeUnityScriptTypeSystem.boo diff --git a/src/UnityScript.Tests/AbstractSemanticsTestFixture.boo b/src/UnityScript.Tests/AbstractSemanticsTestFixture.boo index 3aa2fcc..4312319 100755 --- a/src/UnityScript.Tests/AbstractSemanticsTestFixture.boo +++ b/src/UnityScript.Tests/AbstractSemanticsTestFixture.boo @@ -13,7 +13,6 @@ class AbstractSemanticsTestFixture(AbstractCompilerTestFixture): override protected def CreateCompilerPipeline(): pipeline = CompilerPipeline() pipeline.Add(UnityScript.Steps.Parse()) - pipeline.Add(Boo.Lang.Compiler.Steps.InitializeTypeSystemServices()) pipeline.Add(Boo.Lang.Compiler.Steps.PreErrorChecking()) pipeline.Add(UnityScript.Steps.ApplySemantics()) return pipeline diff --git a/src/UnityScript/Steps/InitializeUnityScriptTypeSystem.boo b/src/UnityScript/Steps/InitializeUnityScriptTypeSystem.boo deleted file mode 100755 index 1660ece..0000000 --- a/src/UnityScript/Steps/InitializeUnityScriptTypeSystem.boo +++ /dev/null @@ -1,19 +0,0 @@ -namespace UnityScript.Steps - -import Boo.Lang.Compiler.Steps -import UnityScript.TypeSystem - -class InitializeUnityScriptTypeSystem(InitializeTypeSystemServices): - - override def CreateEntityFormatter(): - return UnityScriptEntityFormatter() - - override def CreateTypeSystemServices(): - return UnityScriptTypeSystem(Context) - - override def CreateCallableResolutionService(): - return UnityCallableResolutionService(Context) - - override def CreateDowncastPermissions(): - return UnityDowncastPermissions() - diff --git a/src/UnityScript/TypeSystem/UnityCallableResolutionService.boo b/src/UnityScript/TypeSystem/UnityCallableResolutionService.boo index 7ff4b3a..ef1cccd 100755 --- a/src/UnityScript/TypeSystem/UnityCallableResolutionService.boo +++ b/src/UnityScript/TypeSystem/UnityCallableResolutionService.boo @@ -6,9 +6,6 @@ import Boo.Lang.Compiler.TypeSystem class UnityCallableResolutionService(CallableResolutionService): - def constructor(context as CompilerContext): - super(context) - override def CheckVarArgsParameter(parameters as (IParameter), args as ExpressionCollection): return super(parameters, args) diff --git a/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo b/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo index 12abf93..81e1686 100755 --- a/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo +++ b/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo @@ -13,8 +13,7 @@ class UnityScriptTypeSystem(TypeSystemServices): _ScriptBaseType as IType _AbstractGenerator as IType - def constructor(context as CompilerContext): - super(context) + def constructor(): self._ScriptBaseType = Map(UnityScriptParameters.ScriptBaseType) self._AbstractGenerator = Map(Boo.Lang.AbstractGenerator) diff --git a/src/UnityScript/UnityScript.booproj b/src/UnityScript/UnityScript.booproj index c6666a5..ad927dd 100755 --- a/src/UnityScript/UnityScript.booproj +++ b/src/UnityScript/UnityScript.booproj @@ -61,7 +61,6 @@ - diff --git a/src/UnityScript/UnityScriptCompiler.boo b/src/UnityScript/UnityScriptCompiler.boo index 296ef17..9b8e0ea 100755 --- a/src/UnityScript/UnityScriptCompiler.boo +++ b/src/UnityScript/UnityScriptCompiler.boo @@ -44,9 +44,6 @@ class UnityScriptCompiler: pipeline.Replace(Boo.Lang.Parser.BooParsingStep, UnityScript.Steps.Parse()) - pipeline.Replace(Boo.Lang.Compiler.Steps.InitializeTypeSystemServices, - UnityScript.Steps.InitializeUnityScriptTypeSystem()) - pipeline.Replace(Boo.Lang.Compiler.Steps.IntroduceGlobalNamespaces, UnityScript.Steps.IntroduceUnityGlobalNamespaces()) diff --git a/src/UnityScript/UnityScriptCompilerParameters.boo b/src/UnityScript/UnityScriptCompilerParameters.boo index e9c300f..ff7369b 100755 --- a/src/UnityScript/UnityScriptCompilerParameters.boo +++ b/src/UnityScript/UnityScriptCompilerParameters.boo @@ -1,6 +1,10 @@ namespace UnityScript +import Boo.Lang.Environments import Boo.Lang.Compiler +import Boo.Lang.Compiler.TypeSystem +import Boo.Lang.Compiler.TypeSystem.Services +import UnityScript.TypeSystem class UnityScriptCompilerParameters(CompilerParameters): @@ -24,3 +28,9 @@ class UnityScriptCompilerParameters(CompilerParameters): self.OutputType = CompilerOutputType.Library self.References.Add(typeof(UnityScript.Lang.Array).Assembly) self.References.Add(GetType().Assembly) + self.Environment = DeferredEnvironment() { + EntityFormatter: { UnityScriptEntityFormatter() }, + TypeSystemServices: { UnityScriptTypeSystem() }, + CallableResolutionService: { UnityCallableResolutionService() }, + DowncastPermissions: { UnityDowncastPermissions() } + } From 78d4a63dc9150fe29ac4c84a8b470a1b0cc42f98 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 6 Aug 2010 08:02:55 -0300 Subject: [PATCH 060/276] better name for test case --- .../{pragma-strict-4.js => pragma-strict-disallows-downcast.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/error-messages/{pragma-strict-4.js => pragma-strict-disallows-downcast.js} (100%) diff --git a/tests/error-messages/pragma-strict-4.js b/tests/error-messages/pragma-strict-disallows-downcast.js similarity index 100% rename from tests/error-messages/pragma-strict-4.js rename to tests/error-messages/pragma-strict-disallows-downcast.js From d3bfa3ca591387dfaaea3a80491470eacf5dab2a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 6 Aug 2010 08:15:39 -0300 Subject: [PATCH 061/276] better name for test case --- .../{pragma-strict-4.js => pragma-strict-disallows-downcast.js} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename tests/error-messages/{pragma-strict-4.js => pragma-strict-disallows-downcast.js} (56%) diff --git a/tests/error-messages/pragma-strict-4.js b/tests/error-messages/pragma-strict-disallows-downcast.js similarity index 56% rename from tests/error-messages/pragma-strict-4.js rename to tests/error-messages/pragma-strict-disallows-downcast.js index 4f396db..68501f3 100644 --- a/tests/error-messages/pragma-strict-4.js +++ b/tests/error-messages/pragma-strict-disallows-downcast.js @@ -1,5 +1,5 @@ /* -pragma-strict-4.js(13,15): BCE0022: Cannot convert 'Foo' to 'Bar'. +pragma-strict-disallows-downcast.js(13,15): BCE0022: Cannot convert 'Foo' to 'Bar'. */ #pragma strict From bce9ca1480d2b3c14e11121d803702d95fa9af35 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 9 Aug 2010 14:17:15 -0300 Subject: [PATCH 062/276] updated to conform to the latest boo compiler API changes. --- .../Steps/ExpandUnityDuckTypedExpressions.boo | 2 +- src/UnityScript/UnityScriptCompiler.boo | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo b/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo index 2978364..5fe6aac 100755 --- a/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo +++ b/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo @@ -42,7 +42,7 @@ class ExpandUnityDuckTypedExpressions(ExpandDuckTypedExpressions): get: return self.TypeSystemServices UnityScriptParameters as UnityScript.UnityScriptCompilerParameters: - get: return _context.Parameters + get: return self.Parameters UnityRuntimeServicesType: get: return self.TypeSystemServices.Map(typeof(UnityScript.Lang.UnityRuntimeServices)) diff --git a/src/UnityScript/UnityScriptCompiler.boo b/src/UnityScript/UnityScriptCompiler.boo index 9b8e0ea..781019d 100755 --- a/src/UnityScript/UnityScriptCompiler.boo +++ b/src/UnityScript/UnityScriptCompiler.boo @@ -17,15 +17,10 @@ class UnityScriptCompiler: static class Pipelines: def RawParsing(): - pipeline = CompilerPipeline() - pipeline.Add(UnityScript.Steps.PreProcess()) - pipeline.Add(UnityScript.Steps.Parse()) - return pipeline + return CompilerPipeline() { UnityScript.Steps.PreProcess(), UnityScript.Steps.Parse() } def Parse(): - pipeline = RawParsing() - pipeline.Add(UnityScript.Steps.ApplySemantics()) - return pipeline + return RawParsing() { UnityScript.Steps.ApplySemantics() } def Compile(): return AdjustBooPipeline(Boo.Lang.Compiler.Pipelines.Compile()) @@ -42,7 +37,7 @@ class UnityScriptCompiler: def AdjustBooPipeline(pipeline as CompilerPipeline): pipeline.Insert(0, UnityScript.Steps.PreProcess()) - pipeline.Replace(Boo.Lang.Parser.BooParsingStep, UnityScript.Steps.Parse()) + pipeline.Replace(Boo.Lang.Compiler.Steps.Parsing, UnityScript.Steps.Parse()) pipeline.Replace(Boo.Lang.Compiler.Steps.IntroduceGlobalNamespaces, UnityScript.Steps.IntroduceUnityGlobalNamespaces()) From 803d080c97dfd839fd02c68ab73e3331a7e187ba Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 9 Aug 2010 14:34:46 -0300 Subject: [PATCH 063/276] minor formatting change --- src/UnityScript/Parser/UnityScriptParser.boo | 5 +---- src/UnityScript/UnityScript.g | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 73b735e..88eedb7 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -1675,10 +1675,7 @@ class UnityScriptParser(antlr.LLkParser): tr = SimpleTypeReference(ToLexicalInfo(id), "System.Exception") if tr is null handler = ExceptionHandler( ToLexicalInfo(ct), - Declaration: Declaration( - ToLexicalInfo(id), - Name: id.getText(), - Type: tr)) + Declaration: Declaration(ToLexicalInfo(id), Name: id.getText(), Type: tr)) s.ExceptionHandlers.Add(handler) b = handler.Block tr = null diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index f8e7a7d..05a16a7 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -982,10 +982,7 @@ try_statement[Block container] tr = SimpleTypeReference(ToLexicalInfo(id), "System.Exception") if tr is null handler = ExceptionHandler( ToLexicalInfo(ct), - Declaration: Declaration( - ToLexicalInfo(id), - Name: id.getText(), - Type: tr)) + Declaration: Declaration(ToLexicalInfo(id), Name: id.getText(), Type: tr)) s.ExceptionHandlers.Add(handler) b = handler.Block tr = null From 593b1bf8c7f22f5cb45cad0b2a7bf601b241bba0 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 9 Aug 2010 14:35:55 -0300 Subject: [PATCH 064/276] try/catch/finally test cases --- .../invalid-generator-return-type.js | 8 ++++++++ tests/error-messages/rethrow-outside-catch.js | 4 ++++ .../yield-from-try-catch-finally.js | 12 ++++++++++++ tests/integration/rethrow.js | 18 ++++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 tests/error-messages/invalid-generator-return-type.js create mode 100644 tests/error-messages/rethrow-outside-catch.js create mode 100644 tests/error-messages/yield-from-try-catch-finally.js create mode 100644 tests/integration/rethrow.js diff --git a/tests/error-messages/invalid-generator-return-type.js b/tests/error-messages/invalid-generator-return-type.js new file mode 100644 index 0000000..7f69ce5 --- /dev/null +++ b/tests/error-messages/invalid-generator-return-type.js @@ -0,0 +1,8 @@ +/* +invalid-generator-return-type.js(4,17): BCE0101: Return type 'String[]' cannot be used on a generator. Did you mean 'IEnumerator'? You can also use 'System.Collections.IEnumerable' or 'object'. +*/ +function foo(): String[] { + yield "foo"; +} + +foo(); diff --git a/tests/error-messages/rethrow-outside-catch.js b/tests/error-messages/rethrow-outside-catch.js new file mode 100644 index 0000000..77dd895 --- /dev/null +++ b/tests/error-messages/rethrow-outside-catch.js @@ -0,0 +1,4 @@ +/* +rethrow-outside-catch.js(4,1): BCE0081: A throw statement with no arguments is not allowed outside an exception handler. +*/ +throw; diff --git a/tests/error-messages/yield-from-try-catch-finally.js b/tests/error-messages/yield-from-try-catch-finally.js new file mode 100644 index 0000000..51682ea --- /dev/null +++ b/tests/error-messages/yield-from-try-catch-finally.js @@ -0,0 +1,12 @@ +/* +yield-from-try-catch-finally.js(7,15): BCE0099: yield cannot be used inside a try, catch or finally block. +yield-from-try-catch-finally.js(8,21): BCE0099: yield cannot be used inside a try, catch or finally block. +yield-from-try-catch-finally.js(9,19): BCE0099: yield cannot be used inside a try, catch or finally block. +*/ +function foo() { + try { yield 42; } + catch (e) { yield 42; } + finally { yield 42; } +} + +foo(); diff --git a/tests/integration/rethrow.js b/tests/integration/rethrow.js new file mode 100644 index 0000000..c5d6bc4 --- /dev/null +++ b/tests/integration/rethrow.js @@ -0,0 +1,18 @@ +/* +caught +recaught +*/ +function rethrow() { + try { + throw new System.ApplicationException(); + } catch (e) { + print("caught"); + throw; + } +} + +try { + rethrow(); +} catch (e:System.ApplicationException) { + print("recaught"); +} From f2d713ad4c6f73d384da521768fbf4b9508f27b7 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 9 Aug 2010 15:24:00 -0300 Subject: [PATCH 065/276] unused imports --- src/UnityScript/TypeSystem/UnityCallableResolutionService.boo | 1 - src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo | 1 - 2 files changed, 2 deletions(-) diff --git a/src/UnityScript/TypeSystem/UnityCallableResolutionService.boo b/src/UnityScript/TypeSystem/UnityCallableResolutionService.boo index ef1cccd..6be3ba6 100755 --- a/src/UnityScript/TypeSystem/UnityCallableResolutionService.boo +++ b/src/UnityScript/TypeSystem/UnityCallableResolutionService.boo @@ -1,6 +1,5 @@ namespace UnityScript.TypeSystem -import Boo.Lang.Compiler import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.TypeSystem diff --git a/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo b/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo index 81e1686..b309f87 100755 --- a/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo +++ b/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo @@ -1,6 +1,5 @@ namespace UnityScript.TypeSystem -import Boo.Lang.Compiler import Boo.Lang.Compiler.TypeSystem class UnityScriptTypeSystem(TypeSystemServices): From d7bc90c1a03d7d9b898d2364c9da293eecf18a6c Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 9 Aug 2010 15:25:56 -0300 Subject: [PATCH 066/276] use javascript keywords and operators in error messages --- .../ErrorMessagesTestFixture.Generated.boo | 16 ++++++++-- .../IntegrationTestFixture.boo | 8 +++++ .../TypeSystem/UnityScriptAmbiance.boo | 30 +++++++++++++++++++ src/UnityScript/UnityScript.booproj | 1 + .../UnityScriptCompilerParameters.boo | 4 ++- tests/error-messages/nolinenumber.js | 2 +- 6 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 src/UnityScript/TypeSystem/UnityScriptAmbiance.boo diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index 518be74..1ac3a95 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -66,6 +66,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/interface-errors.js") + [Test] def invalid_generator_return_type(): + RunTestCase("tests/error-messages/invalid-generator-return-type.js") + + [Test] def iterator_warning(): RunTestCase("tests/error-messages/iterator-warning.js") @@ -102,14 +106,18 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/pragma-strict-3js.js") - [Test] def pragma_strict_4(): - RunTestCase("tests/error-messages/pragma-strict-4.js") + [Test] def pragma_strict_disallows_downcast(): + RunTestCase("tests/error-messages/pragma-strict-disallows-downcast.js") [Test] def pragma_strict(): RunTestCase("tests/error-messages/pragma-strict.js") + [Test] def rethrow_outside_catch(): + RunTestCase("tests/error-messages/rethrow-outside-catch.js") + + [Test] def semicolon_2(): RunTestCase("tests/error-messages/semicolon-2.js") @@ -136,4 +144,8 @@ partial class ErrorMessagesTestFixture: [Test] def voidcomparison(): RunTestCase("tests/error-messages/voidcomparison.js") + + + [Test] def yield_from_try_catch_finally(): + RunTestCase("tests/error-messages/yield-from-try-catch-finally.js") \ No newline at end of file diff --git a/src/UnityScript.Tests/IntegrationTestFixture.boo b/src/UnityScript.Tests/IntegrationTestFixture.boo index 7c842ef..71dde87 100644 --- a/src/UnityScript.Tests/IntegrationTestFixture.boo +++ b/src/UnityScript.Tests/IntegrationTestFixture.boo @@ -467,6 +467,10 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/float-array-literal.js") + [Test] def float_overload_is_preferred_over_int_for_double_argument(): + RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument.js") + + [Test] def for_break_1(): RunTestCase("tests/integration/for-break-1.js") @@ -595,6 +599,10 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/raw-array-indexing.js") + [Test] def rethrow(): + RunTestCase("tests/integration/rethrow.js") + + [Test] def script_attributes(): RunTestCase("tests/integration/script-attributes.js") diff --git a/src/UnityScript/TypeSystem/UnityScriptAmbiance.boo b/src/UnityScript/TypeSystem/UnityScriptAmbiance.boo new file mode 100644 index 0000000..4cb1229 --- /dev/null +++ b/src/UnityScript/TypeSystem/UnityScriptAmbiance.boo @@ -0,0 +1,30 @@ +namespace UnityScript.TypeSystem + +import Boo.Lang.Compiler.Services + +class UnityScriptAmbiance(LanguageAmbiance): + + override def DefaultGeneratorTypeFor(typeName as string): + return "IEnumerator" + + override SelfKeyword: + get: return "this" + + override IsaKeyword: + get: return "instanceof" + + override IsKeyword: + get: return "===" + + override ExceptKeyword: + get: return "catch" + + override EnsureKeyword: + get: return "finally" + + override RaiseKeyword: + get: return "throw" + + override CallableKeyword: + get: return "function" + diff --git a/src/UnityScript/UnityScript.booproj b/src/UnityScript/UnityScript.booproj index ad927dd..f7fe2a7 100755 --- a/src/UnityScript/UnityScript.booproj +++ b/src/UnityScript/UnityScript.booproj @@ -81,6 +81,7 @@ + diff --git a/src/UnityScript/UnityScriptCompilerParameters.boo b/src/UnityScript/UnityScriptCompilerParameters.boo index ff7369b..3d846c7 100755 --- a/src/UnityScript/UnityScriptCompilerParameters.boo +++ b/src/UnityScript/UnityScriptCompilerParameters.boo @@ -2,6 +2,7 @@ namespace UnityScript import Boo.Lang.Environments import Boo.Lang.Compiler +import Boo.Lang.Compiler.Services import Boo.Lang.Compiler.TypeSystem import Boo.Lang.Compiler.TypeSystem.Services import UnityScript.TypeSystem @@ -32,5 +33,6 @@ class UnityScriptCompilerParameters(CompilerParameters): EntityFormatter: { UnityScriptEntityFormatter() }, TypeSystemServices: { UnityScriptTypeSystem() }, CallableResolutionService: { UnityCallableResolutionService() }, - DowncastPermissions: { UnityDowncastPermissions() } + DowncastPermissions: { UnityDowncastPermissions() }, + LanguageAmbiance: { UnityScriptAmbiance() } } diff --git a/tests/error-messages/nolinenumber.js b/tests/error-messages/nolinenumber.js index 8238cae..3f3ab5f 100755 --- a/tests/error-messages/nolinenumber.js +++ b/tests/error-messages/nolinenumber.js @@ -1,5 +1,5 @@ /* -nolinenumber.js(14,18): BCE0101: Return type 'void' cannot be used on a generator. Did you mean 'void*'? You can also use 'System.Collections.IEnumerable' or 'object'. +nolinenumber.js(14,18): BCE0101: Return type 'void' cannot be used on a generator. Did you mean 'IEnumerator'? You can also use 'System.Collections.IEnumerable' or 'object'. */ class A From e14d2aeff86009c66f90681757c158794d679e4b Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 9 Aug 2010 15:55:54 -0300 Subject: [PATCH 067/276] test case for reported regression on method overload selection --- .../NumericOverloads.cs | 18 ++++++++++++++++++ .../UnityScript.Tests.CSharp.csproj | 1 + .../IntegrationTestFixture.boo | 8 ++++++++ ...preferred-over-int-for-double-argument-2.js | 7 +++++++ ...rred-over-int-for-double-argument-strict.js | 9 +++++++++ ...s-preferred-over-int-for-double-argument.js | 7 +++++++ 6 files changed, 50 insertions(+) create mode 100644 src/UnityScript.Tests.CSharp/NumericOverloads.cs create mode 100644 tests/integration/float-overload-is-preferred-over-int-for-double-argument-2.js create mode 100644 tests/integration/float-overload-is-preferred-over-int-for-double-argument-strict.js create mode 100644 tests/integration/float-overload-is-preferred-over-int-for-double-argument.js diff --git a/src/UnityScript.Tests.CSharp/NumericOverloads.cs b/src/UnityScript.Tests.CSharp/NumericOverloads.cs new file mode 100644 index 0000000..38f61be --- /dev/null +++ b/src/UnityScript.Tests.CSharp/NumericOverloads.cs @@ -0,0 +1,18 @@ +using System; + +namespace UnityScript.Tests.CSharp +{ + public static class NumericOverloads + { + public static void F(float x, float y) + { + Console.WriteLine("F(float, float)"); + } + + public static void F(int x, int y) + { + Console.WriteLine("F(int, int)"); + } + } +} + diff --git a/src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj b/src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj index 8a1b8d5..77397e6 100755 --- a/src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj +++ b/src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj @@ -45,6 +45,7 @@ + \ No newline at end of file diff --git a/src/UnityScript.Tests/IntegrationTestFixture.boo b/src/UnityScript.Tests/IntegrationTestFixture.boo index 71dde87..03c7c9a 100644 --- a/src/UnityScript.Tests/IntegrationTestFixture.boo +++ b/src/UnityScript.Tests/IntegrationTestFixture.boo @@ -467,6 +467,14 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/float-array-literal.js") + [Test] def float_overload_is_preferred_over_int_for_double_argument_2(): + RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument-2.js") + + + [Test] def float_overload_is_preferred_over_int_for_double_argument_strict(): + RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument-strict.js") + + [Test] def float_overload_is_preferred_over_int_for_double_argument(): RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument.js") diff --git a/tests/integration/float-overload-is-preferred-over-int-for-double-argument-2.js b/tests/integration/float-overload-is-preferred-over-int-for-double-argument-2.js new file mode 100644 index 0000000..f21c849 --- /dev/null +++ b/tests/integration/float-overload-is-preferred-over-int-for-double-argument-2.js @@ -0,0 +1,7 @@ +/* +F(float, float) +*/ + +import UnityScript.Tests.CSharp; + +NumericOverloads.F(0.16, 0.19); diff --git a/tests/integration/float-overload-is-preferred-over-int-for-double-argument-strict.js b/tests/integration/float-overload-is-preferred-over-int-for-double-argument-strict.js new file mode 100644 index 0000000..e9f4931 --- /dev/null +++ b/tests/integration/float-overload-is-preferred-over-int-for-double-argument-strict.js @@ -0,0 +1,9 @@ +/* +F(float, float) +*/ + +#pragma strict + +function F(a:float, b:float) { print("F(float, float)"); } +function F(a:int, b:int) {} +F(0.16, 0.19); diff --git a/tests/integration/float-overload-is-preferred-over-int-for-double-argument.js b/tests/integration/float-overload-is-preferred-over-int-for-double-argument.js new file mode 100644 index 0000000..7c9ca41 --- /dev/null +++ b/tests/integration/float-overload-is-preferred-over-int-for-double-argument.js @@ -0,0 +1,7 @@ +/* +F(float, float) +*/ + +function F(a:float, b:float) { print("F(float, float)"); } +function F(a:int, b:int) {} +F(0.16, 0.19); From 35c39e344964cbfcda7a3537498e8150337610f5 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 9 Aug 2010 16:23:06 -0300 Subject: [PATCH 068/276] generic method arguments --- src/UnityScript.Tests.CSharp/Generics.cs | 5 ++ .../GenericsTestFixture.Generated.boo | 4 ++ src/UnityScript/UnityScript.g | 47 ++++++++++--------- tests/generics/generic-method-arguments.js | 11 +++++ 4 files changed, 44 insertions(+), 23 deletions(-) create mode 100644 tests/generics/generic-method-arguments.js diff --git a/src/UnityScript.Tests.CSharp/Generics.cs b/src/UnityScript.Tests.CSharp/Generics.cs index 131c42d..56af5fd 100644 --- a/src/UnityScript.Tests.CSharp/Generics.cs +++ b/src/UnityScript.Tests.CSharp/Generics.cs @@ -5,6 +5,11 @@ public static class Generics public static T Identity(T o) { return o; + } + + public static T Instantiate() where T:new() + { + return new T(); } } } diff --git a/src/UnityScript.Tests/GenericsTestFixture.Generated.boo b/src/UnityScript.Tests/GenericsTestFixture.Generated.boo index e185a75..829b8cb 100644 --- a/src/UnityScript.Tests/GenericsTestFixture.Generated.boo +++ b/src/UnityScript.Tests/GenericsTestFixture.Generated.boo @@ -13,4 +13,8 @@ class GenericsTestFixture(AbstractIntegrationTestFixture): [Test] def generic_method_1(): RunTestCase("tests/generics/generic-method-1.js") + + + [Test] def generic_method_arguments(): + RunTestCase("tests/generics/generic-method-arguments.js") \ No newline at end of file diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 05a16a7..cce0667 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -1184,28 +1184,32 @@ reference_expression returns [Expression e] }: e=simple_reference_expression ( - DOT - ( - ( - memberName=member - { - e = MemberReferenceExpression(ToLexicalInfo(memberName), Target: e, Name: memberName.getText()) - } - ) - | - ( - lbrack:LESS_THAN - { - e = gre = GenericReferenceExpression(ToLexicalInfo(lbrack), Target: e) - genericArguments = gre.GenericArguments - } - type_reference_list[genericArguments] - GREATER_THAN - ) - ) + DOT e=member_reference_expression[e] )* ; +member_reference_expression[Expression target] returns [Expression e] +{ + e = target; +}: + ( + lbrack:LESS_THAN + { + e = gre = GenericReferenceExpression(ToLexicalInfo(lbrack), Target: e) + genericArguments = gre.GenericArguments + } + type_reference_list[genericArguments] + GREATER_THAN + ) + | + ( + memberName=member + { + e = MemberReferenceExpression(ToLexicalInfo(memberName), Target: e, Name: memberName.getText()) + } + ) +; + paren_expression returns [Expression e] { }: @@ -1346,10 +1350,7 @@ slicing_expression returns [Expression e] ) | ( - DOT memberName=member - { - e = MemberReferenceExpression(ToLexicalInfo(memberName), Target: e, Name: memberName.getText()) - } + DOT e=member_reference_expression[e] ) | ( diff --git a/tests/generics/generic-method-arguments.js b/tests/generics/generic-method-arguments.js new file mode 100644 index 0000000..358b85e --- /dev/null +++ b/tests/generics/generic-method-arguments.js @@ -0,0 +1,11 @@ +/* +Foo.Bar +*/ +import UnityScript.Tests.CSharp; + +class Foo { + function Bar() { print("Foo.Bar"); } +} + +var foo = Generics.Instantiate.(); +foo.Bar(); From 968a4c1d150627753a90c3f0d1d452f179367cbc Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 9 Aug 2010 16:23:18 -0300 Subject: [PATCH 069/276] antlr generated files --- src/UnityScript/Parser/UnityScriptParser.boo | 81 ++++++++++++-------- 1 file changed, 50 insertions(+), 31 deletions(-) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 88eedb7..be3f990 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -759,34 +759,16 @@ class UnityScriptParser(antlr.LLkParser): public def reference_expression() as Expression : //throws RecognitionException, TokenStreamException e as Expression - lbrack as IToken = null try: // for error handling e=simple_reference_expression() while true: if ((LA(1)==DOT)): match(DOT) - _givenValue = LA(1) - if ((_givenValue == GET) - or (_givenValue ==SET) - or (_givenValue ==ID) - ): // 1827 - memberName=member() - if 0 == inputState.guessing: - e = MemberReferenceExpression(ToLexicalInfo(memberName), Target: e, Name: memberName.getText()) - elif ((_givenValue == LESS_THAN)): // 1831 - lbrack = LT(1) - match(LESS_THAN) - if 0 == inputState.guessing: - e = gre = GenericReferenceExpression(ToLexicalInfo(lbrack), Target: e) - genericArguments = gre.GenericArguments - type_reference_list(genericArguments) - match(GREATER_THAN) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) + e=member_reference_expression(e) else: - goto _loop194_breakloop - :_loop194_breakloop + goto _loop191_breakloop + :_loop191_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3383,6 +3365,41 @@ class UnityScriptParser(antlr.LLkParser): raise return e + public def member_reference_expression( + target as Expression + ) as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + lbrack as IToken = null + e = target; + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == LESS_THAN)): // 1831 + lbrack = LT(1) + match(LESS_THAN) + if 0 == inputState.guessing: + e = gre = GenericReferenceExpression(ToLexicalInfo(lbrack), Target: e) + genericArguments = gre.GenericArguments + type_reference_list(genericArguments) + match(GREATER_THAN) + elif ((_givenValue == GET) + or (_givenValue ==SET) + or (_givenValue ==ID) + ): // 1827 + memberName=member() + if 0 == inputState.guessing: + e = MemberReferenceExpression(ToLexicalInfo(memberName), Target: e, Name: memberName.getText()) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + public def slice( se as SlicingExpression ) as void: //throws RecognitionException, TokenStreamException @@ -3549,12 +3566,10 @@ class UnityScriptParser(antlr.LLkParser): goto _loop225_breakloop :_loop225_breakloop match(RBRACK) - elif ((LA(1)==DOT) and (LA(2)==GET or LA(2)==SET or LA(2)==ID)): // line 2102 + elif ((LA(1)==DOT) and (tokenSet_57_.member(cast(int, LA(2))))): // line 2102 match(DOT) - memberName=member() - if 0 == inputState.guessing: - e = MemberReferenceExpression(ToLexicalInfo(memberName), Target: e, Name: memberName.getText()) - elif ((LA(1)==LPAREN) and (tokenSet_57_.member(cast(int, LA(2))))): // line 2102 + e=member_reference_expression(e) + elif ((LA(1)==LPAREN) and (tokenSet_58_.member(cast(int, LA(2))))): // line 2102 lparen = LT(1) match(LPAREN) if 0 == inputState.guessing: @@ -3797,7 +3812,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=shift() while true: - if ((tokenSet_58_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((tokenSet_59_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == IN) or (_givenValue ==LESS_THAN) @@ -3872,7 +3887,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=comparison() while true: - if ((tokenSet_59_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((tokenSet_60_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == EQUALITY)): // 1831 te = LT(1) @@ -4551,15 +4566,19 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) private static def mk_tokenSet_57_() as (long): - data = (5107084932426043392L, 523986277888L, 0L, 0L, ) + data = (9007216434741248L, 2097152L, 0L, 0L, ) return data public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) private static def mk_tokenSet_58_() as (long): - data = (10485760L, 106954752L, 0L, 0L, ) + data = (5107084932426043392L, 523986277888L, 0L, 0L, ) return data public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) private static def mk_tokenSet_59_() as (long): - data = (0L, 1671168L, 0L, 0L, ) + data = (10485760L, 106954752L, 0L, 0L, ) return data public static final tokenSet_59_ = BitSet(mk_tokenSet_59_()) + private static def mk_tokenSet_60_() as (long): + data = (0L, 1671168L, 0L, 0L, ) + return data + public static final tokenSet_60_ = BitSet(mk_tokenSet_60_()) From 7e0399ff0b118ce6226040016bbb86a874e92cf1 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 9 Aug 2010 16:42:23 -0300 Subject: [PATCH 070/276] test case for usage of generic method declared in generic class --- src/UnityScript.Tests.CSharp/Generics.cs | 10 ++++++++++ .../GenericsTestFixture.Generated.boo | 4 ++++ .../generic-method-arguments-in-generic-class.js | 6 ++++++ 3 files changed, 20 insertions(+) create mode 100644 tests/generics/generic-method-arguments-in-generic-class.js diff --git a/src/UnityScript.Tests.CSharp/Generics.cs b/src/UnityScript.Tests.CSharp/Generics.cs index 56af5fd..1969038 100644 --- a/src/UnityScript.Tests.CSharp/Generics.cs +++ b/src/UnityScript.Tests.CSharp/Generics.cs @@ -1,3 +1,5 @@ +using System; + namespace UnityScript.Tests.CSharp { public static class Generics @@ -11,5 +13,13 @@ public static T Instantiate() where T:new() { return new T(); } + + public static class GenericClass + { + public static void GenericMethod(T t, U u) + { + Console.WriteLine("GenericMethod({0}, {1})", typeof(T), typeof(U)); + } + } } } diff --git a/src/UnityScript.Tests/GenericsTestFixture.Generated.boo b/src/UnityScript.Tests/GenericsTestFixture.Generated.boo index 829b8cb..0c6b19c 100644 --- a/src/UnityScript.Tests/GenericsTestFixture.Generated.boo +++ b/src/UnityScript.Tests/GenericsTestFixture.Generated.boo @@ -15,6 +15,10 @@ class GenericsTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/generics/generic-method-1.js") + [Test] def generic_method_arguments_in_generic_class(): + RunTestCase("tests/generics/generic-method-arguments-in-generic-class.js") + + [Test] def generic_method_arguments(): RunTestCase("tests/generics/generic-method-arguments.js") \ No newline at end of file diff --git a/tests/generics/generic-method-arguments-in-generic-class.js b/tests/generics/generic-method-arguments-in-generic-class.js new file mode 100644 index 0000000..85a6bf1 --- /dev/null +++ b/tests/generics/generic-method-arguments-in-generic-class.js @@ -0,0 +1,6 @@ +/* +GenericMethod(System.String, System.Int32) +*/ +import UnityScript.Tests.CSharp; + +Generics.GenericClass..GenericMethod.("", 42); From 28e0365d9313d87602a5391289d0d82aea8a91fe Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 13 Aug 2010 15:47:18 -0300 Subject: [PATCH 071/276] cast operator --- .../IntegrationTestFixture.boo | 8 + src/UnityScript/Parser/UnityScriptLexer.boo | 400 ++++++++-------- src/UnityScript/Parser/UnityScriptParser.boo | 442 +++++++++--------- .../Parser/UnityScriptTokenTypes.boo | 221 ++++----- .../Parser/UnityScriptTokenTypes.txt | 221 ++++----- src/UnityScript/UnityScript.g | 35 +- tests/integration/cast-operator-1.js | 8 + tests/integration/cast-operator-precedence.js | 5 + 8 files changed, 696 insertions(+), 644 deletions(-) create mode 100644 tests/integration/cast-operator-1.js create mode 100644 tests/integration/cast-operator-precedence.js diff --git a/src/UnityScript.Tests/IntegrationTestFixture.boo b/src/UnityScript.Tests/IntegrationTestFixture.boo index 03c7c9a..0694630 100644 --- a/src/UnityScript.Tests/IntegrationTestFixture.boo +++ b/src/UnityScript.Tests/IntegrationTestFixture.boo @@ -275,6 +275,14 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/boolcast.js") + [Test] def cast_operator_1(): + RunTestCase("tests/integration/cast-operator-1.js") + + + [Test] def cast_operator_precedence(): + RunTestCase("tests/integration/cast-operator-precedence.js") + + [Test] def chars(): RunTestCase("tests/integration/chars.js") diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index 24ae79d..e73a378 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -34,116 +34,117 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): public static final NULL_TREE_LOOKAHEAD = 3 public static final AS = 4 public static final BREAK = 5 - public static final CATCH = 6 - public static final CLASS = 7 - public static final CONTINUE = 8 - public static final ELSE = 9 - public static final ENUM = 10 - public static final EXTENDS = 11 - public static final FALSE = 12 - public static final FINAL = 13 - public static final FINALLY = 14 - public static final FOR = 15 - public static final FUNCTION = 16 - public static final GET = 17 - public static final IF = 18 - public static final IMPORT = 19 - public static final IMPLEMENTS = 20 - public static final IN = 21 - public static final INTERFACE = 22 - public static final INSTANCEOF = 23 - public static final NEW = 24 - public static final NULL = 25 - public static final RETURN = 26 - public static final PUBLIC = 27 - public static final PROTECTED = 28 - public static final INTERNAL = 29 - public static final OVERRIDE = 30 - public static final PARTIAL = 31 - public static final PRAGMA = 32 - public static final PRIVATE = 33 - public static final SET = 34 - public static final STATIC = 35 - public static final SUPER = 36 - public static final THIS = 37 - public static final THROW = 38 - public static final TRUE = 39 - public static final TRY = 40 - public static final TYPEOF = 41 - public static final VAR = 42 - public static final VIRTUAL = 43 - public static final WHILE = 44 - public static final YIELD = 45 - public static final SWITCH = 46 - public static final CASE = 47 - public static final DEFAULT = 48 - public static final INPLACE_DIVISION = 49 - public static final INPLACE_ADD = 50 - public static final INPLACE_SUBTRACT = 51 - public static final INPLACE_MULTIPLY = 52 - public static final ID = 53 - public static final DOUBLE_QUOTED_STRING = 54 - public static final LBRACE = 55 - public static final RBRACE = 56 - public static final LPAREN = 57 - public static final RPAREN = 58 - public static final DOT = 59 - public static final COLON = 60 - public static final COMMA = 61 - public static final LBRACK = 62 - public static final RBRACK = 63 - public static final BITWISE_OR = 64 - public static final INPLACE_BITWISE_OR = 65 - public static final BITWISE_AND = 66 - public static final BITWISE_XOR = 67 - public static final INPLACE_BITWISE_AND = 68 - public static final LOGICAL_OR = 69 - public static final LOGICAL_AND = 70 - public static final EOS = 71 - public static final ASSIGN = 72 - public static final INCREMENT = 73 - public static final DECREMENT = 74 - public static final ADD = 75 - public static final SUBTRACT = 76 - public static final MODULUS = 77 - public static final MULTIPLY = 78 - public static final EQUALITY = 79 - public static final INEQUALITY = 80 - public static final QUESTION_MARK = 81 - public static final BITWISE_NOT = 82 - public static final REFERENCE_EQUALITY = 83 - public static final REFERENCE_INEQUALITY = 84 - public static final LESS_THAN = 85 - public static final LESS_THAN_OR_EQUAL = 86 - public static final SHIFT_LEFT = 87 - public static final INPLACE_SHIFT_LEFT = 88 - public static final GREATER_THAN = 89 - public static final GREATER_THAN_OR_EQUAL = 90 - public static final SHIFT_RIGHT = 91 - public static final INPLACE_SHIFT_RIGHT = 92 - public static final AT = 93 - public static final SCRIPT_ATTRIBUTE_MARKER = 94 - public static final HASH = 95 - public static final INPLACE_BITWISE_XOR = 96 - public static final NOT = 97 - public static final DIVISION = 98 - public static final RE_LITERAL = 99 - public static final DOUBLE = 100 - public static final INT = 101 - public static final LONG = 102 - public static final DOUBLE_SUFFIX = 103 - public static final EXPONENT = 104 - public static final WHITE_SPACE = 105 - public static final DQS_ESC = 106 - public static final SQS_ESC = 107 - public static final SESC = 108 - public static final ML_COMMENT = 109 - public static final RE_CHAR = 110 - public static final RE_ESC = 111 - public static final NEWLINE = 112 - public static final ID_LETTER = 113 - public static final DIGIT = 114 - public static final HEXDIGIT = 115 + public static final CAST = 6 + public static final CATCH = 7 + public static final CLASS = 8 + public static final CONTINUE = 9 + public static final ELSE = 10 + public static final ENUM = 11 + public static final EXTENDS = 12 + public static final FALSE = 13 + public static final FINAL = 14 + public static final FINALLY = 15 + public static final FOR = 16 + public static final FUNCTION = 17 + public static final GET = 18 + public static final IF = 19 + public static final IMPORT = 20 + public static final IMPLEMENTS = 21 + public static final IN = 22 + public static final INTERFACE = 23 + public static final INSTANCEOF = 24 + public static final NEW = 25 + public static final NULL = 26 + public static final RETURN = 27 + public static final PUBLIC = 28 + public static final PROTECTED = 29 + public static final INTERNAL = 30 + public static final OVERRIDE = 31 + public static final PARTIAL = 32 + public static final PRAGMA = 33 + public static final PRIVATE = 34 + public static final SET = 35 + public static final STATIC = 36 + public static final SUPER = 37 + public static final THIS = 38 + public static final THROW = 39 + public static final TRUE = 40 + public static final TRY = 41 + public static final TYPEOF = 42 + public static final VAR = 43 + public static final VIRTUAL = 44 + public static final WHILE = 45 + public static final YIELD = 46 + public static final SWITCH = 47 + public static final CASE = 48 + public static final DEFAULT = 49 + public static final INPLACE_DIVISION = 50 + public static final INPLACE_ADD = 51 + public static final INPLACE_SUBTRACT = 52 + public static final INPLACE_MULTIPLY = 53 + public static final ID = 54 + public static final DOUBLE_QUOTED_STRING = 55 + public static final LBRACE = 56 + public static final RBRACE = 57 + public static final LPAREN = 58 + public static final RPAREN = 59 + public static final DOT = 60 + public static final COLON = 61 + public static final COMMA = 62 + public static final LBRACK = 63 + public static final RBRACK = 64 + public static final BITWISE_OR = 65 + public static final INPLACE_BITWISE_OR = 66 + public static final BITWISE_AND = 67 + public static final BITWISE_XOR = 68 + public static final INPLACE_BITWISE_AND = 69 + public static final LOGICAL_OR = 70 + public static final LOGICAL_AND = 71 + public static final EOS = 72 + public static final ASSIGN = 73 + public static final INCREMENT = 74 + public static final DECREMENT = 75 + public static final ADD = 76 + public static final SUBTRACT = 77 + public static final MODULUS = 78 + public static final MULTIPLY = 79 + public static final EQUALITY = 80 + public static final INEQUALITY = 81 + public static final QUESTION_MARK = 82 + public static final BITWISE_NOT = 83 + public static final REFERENCE_EQUALITY = 84 + public static final REFERENCE_INEQUALITY = 85 + public static final LESS_THAN = 86 + public static final LESS_THAN_OR_EQUAL = 87 + public static final SHIFT_LEFT = 88 + public static final INPLACE_SHIFT_LEFT = 89 + public static final GREATER_THAN = 90 + public static final GREATER_THAN_OR_EQUAL = 91 + public static final SHIFT_RIGHT = 92 + public static final INPLACE_SHIFT_RIGHT = 93 + public static final AT = 94 + public static final SCRIPT_ATTRIBUTE_MARKER = 95 + public static final HASH = 96 + public static final INPLACE_BITWISE_XOR = 97 + public static final NOT = 98 + public static final DIVISION = 99 + public static final RE_LITERAL = 100 + public static final DOUBLE = 101 + public static final INT = 102 + public static final LONG = 103 + public static final DOUBLE_SUFFIX = 104 + public static final EXPONENT = 105 + public static final WHITE_SPACE = 106 + public static final DQS_ESC = 107 + public static final SQS_ESC = 108 + public static final SESC = 109 + public static final ML_COMMENT = 110 + public static final RE_CHAR = 111 + public static final RE_ESC = 112 + public static final NEWLINE = 113 + public static final ID_LETTER = 114 + public static final DIGIT = 115 + public static final HEXDIGIT = 116 static def IsDigit(ch as char): @@ -165,97 +166,98 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): caseSensitiveLiterals = true setCaseSensitive(true) literals = Hashtable(100, 0.4, null, Comparer.Default) - literals.Add(",", 61) - literals.Add("public", 27) - literals.Add("a string", 54) - literals.Add("an identifier", 53) - literals.Add("]", 63) - literals.Add("case", 47) + literals.Add(",", 62) + literals.Add("public", 28) + literals.Add("a string", 55) + literals.Add("an identifier", 54) + literals.Add("]", 64) + literals.Add("case", 48) literals.Add("break", 5) - literals.Add("while", 44) - literals.Add("new", 24) - literals.Add("||", 69) - literals.Add("+", 75) - literals.Add("instanceof", 23) - literals.Add("implements", 20) - literals.Add("*", 78) - literals.Add("|=", 65) - literals.Add("typeof", 41) - literals.Add("[", 62) - literals.Add(">>=", 92) - literals.Add("return", 26) - literals.Add("throw", 38) - literals.Add("var", 42) - literals.Add(")", 58) - literals.Add("==", 79) - literals.Add("null", 25) - literals.Add("protected", 28) - literals.Add("@script", 94) - literals.Add("class", 7) - literals.Add("(", 57) - literals.Add("~", 82) - literals.Add("function", 16) - literals.Add("/=", 49) - literals.Add("super", 36) - literals.Add("@", 93) - literals.Add("-=", 51) - literals.Add("set", 34) - literals.Add("+=", 50) - literals.Add("!==", 84) - literals.Add("}", 56) - literals.Add("interface", 22) - literals.Add("?", 81) - literals.Add("&", 66) - literals.Add("internal", 29) - literals.Add("final", 13) - literals.Add("yield", 45) - literals.Add("!=", 80) - literals.Add("===", 83) - literals.Add("if", 18) - literals.Add("|", 64) - literals.Add("override", 30) - literals.Add(">", 89) + literals.Add("while", 45) + literals.Add("new", 25) + literals.Add("||", 70) + literals.Add("+", 76) + literals.Add("instanceof", 24) + literals.Add("implements", 21) + literals.Add("*", 79) + literals.Add("|=", 66) + literals.Add("typeof", 42) + literals.Add("[", 63) + literals.Add(">>=", 93) + literals.Add("return", 27) + literals.Add("throw", 39) + literals.Add("var", 43) + literals.Add(")", 59) + literals.Add("==", 80) + literals.Add("null", 26) + literals.Add("protected", 29) + literals.Add("@script", 95) + literals.Add("class", 8) + literals.Add("(", 58) + literals.Add("~", 83) + literals.Add("function", 17) + literals.Add("/=", 50) + literals.Add("super", 37) + literals.Add("@", 94) + literals.Add("-=", 52) + literals.Add("set", 35) + literals.Add("+=", 51) + literals.Add("!==", 85) + literals.Add("}", 57) + literals.Add("interface", 23) + literals.Add("?", 82) + literals.Add("&", 67) + literals.Add("internal", 30) + literals.Add("final", 14) + literals.Add("yield", 46) + literals.Add("!=", 81) + literals.Add("===", 84) + literals.Add("if", 19) + literals.Add("|", 65) + literals.Add("override", 31) + literals.Add(">", 90) literals.Add("as", 4) - literals.Add("%", 77) - literals.Add("pragma", 32) - literals.Add("catch", 6) - literals.Add("try", 40) - literals.Add("{", 55) - literals.Add("=", 72) - literals.Add("enum", 10) - literals.Add("for", 15) - literals.Add(">>", 91) - literals.Add("extends", 11) - literals.Add("private", 33) - literals.Add("default", 48) - literals.Add("--", 74) - literals.Add("<", 85) - literals.Add("false", 12) - literals.Add("this", 37) - literals.Add("static", 35) - literals.Add(">=", 90) - literals.Add("<=", 86) - literals.Add("partial", 31) - literals.Add(";", 71) - literals.Add("get", 17) - literals.Add("<<=", 88) - literals.Add("continue", 8) - literals.Add("&&", 70) - literals.Add("<<", 87) - literals.Add(".", 59) - literals.Add("finally", 14) - literals.Add("else", 9) - literals.Add("import", 19) - literals.Add("++", 73) - literals.Add(":", 60) - literals.Add("in", 21) - literals.Add("switch", 46) - literals.Add("true", 39) - literals.Add("-", 76) - literals.Add("*=", 52) - literals.Add("virtual", 43) - literals.Add("^", 67) - literals.Add("&=", 68) + literals.Add("%", 78) + literals.Add("pragma", 33) + literals.Add("catch", 7) + literals.Add("try", 41) + literals.Add("{", 56) + literals.Add("=", 73) + literals.Add("enum", 11) + literals.Add("for", 16) + literals.Add(">>", 92) + literals.Add("extends", 12) + literals.Add("private", 34) + literals.Add("default", 49) + literals.Add("--", 75) + literals.Add("<", 86) + literals.Add("false", 13) + literals.Add("this", 38) + literals.Add("static", 36) + literals.Add(">=", 91) + literals.Add("<=", 87) + literals.Add("partial", 32) + literals.Add(";", 72) + literals.Add("get", 18) + literals.Add("<<=", 89) + literals.Add("continue", 9) + literals.Add("&&", 71) + literals.Add("cast", 6) + literals.Add("<<", 88) + literals.Add(".", 60) + literals.Add("finally", 15) + literals.Add("else", 10) + literals.Add("import", 20) + literals.Add("++", 74) + literals.Add(":", 61) + literals.Add("in", 22) + literals.Add("switch", 47) + literals.Add("true", 40) + literals.Add("-", 77) + literals.Add("*=", 53) + literals.Add("virtual", 44) + literals.Add("^", 68) + literals.Add("&=", 69) override def nextToken() as IToken: theRetToken as IToken diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index be3f990..df07c7d 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -32,116 +32,117 @@ class UnityScriptParser(antlr.LLkParser): public static final NULL_TREE_LOOKAHEAD = 3 public static final AS = 4 public static final BREAK = 5 - public static final CATCH = 6 - public static final CLASS = 7 - public static final CONTINUE = 8 - public static final ELSE = 9 - public static final ENUM = 10 - public static final EXTENDS = 11 - public static final FALSE = 12 - public static final FINAL = 13 - public static final FINALLY = 14 - public static final FOR = 15 - public static final FUNCTION = 16 - public static final GET = 17 - public static final IF = 18 - public static final IMPORT = 19 - public static final IMPLEMENTS = 20 - public static final IN = 21 - public static final INTERFACE = 22 - public static final INSTANCEOF = 23 - public static final NEW = 24 - public static final NULL = 25 - public static final RETURN = 26 - public static final PUBLIC = 27 - public static final PROTECTED = 28 - public static final INTERNAL = 29 - public static final OVERRIDE = 30 - public static final PARTIAL = 31 - public static final PRAGMA = 32 - public static final PRIVATE = 33 - public static final SET = 34 - public static final STATIC = 35 - public static final SUPER = 36 - public static final THIS = 37 - public static final THROW = 38 - public static final TRUE = 39 - public static final TRY = 40 - public static final TYPEOF = 41 - public static final VAR = 42 - public static final VIRTUAL = 43 - public static final WHILE = 44 - public static final YIELD = 45 - public static final SWITCH = 46 - public static final CASE = 47 - public static final DEFAULT = 48 - public static final INPLACE_DIVISION = 49 - public static final INPLACE_ADD = 50 - public static final INPLACE_SUBTRACT = 51 - public static final INPLACE_MULTIPLY = 52 - public static final ID = 53 - public static final DOUBLE_QUOTED_STRING = 54 - public static final LBRACE = 55 - public static final RBRACE = 56 - public static final LPAREN = 57 - public static final RPAREN = 58 - public static final DOT = 59 - public static final COLON = 60 - public static final COMMA = 61 - public static final LBRACK = 62 - public static final RBRACK = 63 - public static final BITWISE_OR = 64 - public static final INPLACE_BITWISE_OR = 65 - public static final BITWISE_AND = 66 - public static final BITWISE_XOR = 67 - public static final INPLACE_BITWISE_AND = 68 - public static final LOGICAL_OR = 69 - public static final LOGICAL_AND = 70 - public static final EOS = 71 - public static final ASSIGN = 72 - public static final INCREMENT = 73 - public static final DECREMENT = 74 - public static final ADD = 75 - public static final SUBTRACT = 76 - public static final MODULUS = 77 - public static final MULTIPLY = 78 - public static final EQUALITY = 79 - public static final INEQUALITY = 80 - public static final QUESTION_MARK = 81 - public static final BITWISE_NOT = 82 - public static final REFERENCE_EQUALITY = 83 - public static final REFERENCE_INEQUALITY = 84 - public static final LESS_THAN = 85 - public static final LESS_THAN_OR_EQUAL = 86 - public static final SHIFT_LEFT = 87 - public static final INPLACE_SHIFT_LEFT = 88 - public static final GREATER_THAN = 89 - public static final GREATER_THAN_OR_EQUAL = 90 - public static final SHIFT_RIGHT = 91 - public static final INPLACE_SHIFT_RIGHT = 92 - public static final AT = 93 - public static final SCRIPT_ATTRIBUTE_MARKER = 94 - public static final HASH = 95 - public static final INPLACE_BITWISE_XOR = 96 - public static final NOT = 97 - public static final DIVISION = 98 - public static final RE_LITERAL = 99 - public static final DOUBLE = 100 - public static final INT = 101 - public static final LONG = 102 - public static final DOUBLE_SUFFIX = 103 - public static final EXPONENT = 104 - public static final WHITE_SPACE = 105 - public static final DQS_ESC = 106 - public static final SQS_ESC = 107 - public static final SESC = 108 - public static final ML_COMMENT = 109 - public static final RE_CHAR = 110 - public static final RE_ESC = 111 - public static final NEWLINE = 112 - public static final ID_LETTER = 113 - public static final DIGIT = 114 - public static final HEXDIGIT = 115 + public static final CAST = 6 + public static final CATCH = 7 + public static final CLASS = 8 + public static final CONTINUE = 9 + public static final ELSE = 10 + public static final ENUM = 11 + public static final EXTENDS = 12 + public static final FALSE = 13 + public static final FINAL = 14 + public static final FINALLY = 15 + public static final FOR = 16 + public static final FUNCTION = 17 + public static final GET = 18 + public static final IF = 19 + public static final IMPORT = 20 + public static final IMPLEMENTS = 21 + public static final IN = 22 + public static final INTERFACE = 23 + public static final INSTANCEOF = 24 + public static final NEW = 25 + public static final NULL = 26 + public static final RETURN = 27 + public static final PUBLIC = 28 + public static final PROTECTED = 29 + public static final INTERNAL = 30 + public static final OVERRIDE = 31 + public static final PARTIAL = 32 + public static final PRAGMA = 33 + public static final PRIVATE = 34 + public static final SET = 35 + public static final STATIC = 36 + public static final SUPER = 37 + public static final THIS = 38 + public static final THROW = 39 + public static final TRUE = 40 + public static final TRY = 41 + public static final TYPEOF = 42 + public static final VAR = 43 + public static final VIRTUAL = 44 + public static final WHILE = 45 + public static final YIELD = 46 + public static final SWITCH = 47 + public static final CASE = 48 + public static final DEFAULT = 49 + public static final INPLACE_DIVISION = 50 + public static final INPLACE_ADD = 51 + public static final INPLACE_SUBTRACT = 52 + public static final INPLACE_MULTIPLY = 53 + public static final ID = 54 + public static final DOUBLE_QUOTED_STRING = 55 + public static final LBRACE = 56 + public static final RBRACE = 57 + public static final LPAREN = 58 + public static final RPAREN = 59 + public static final DOT = 60 + public static final COLON = 61 + public static final COMMA = 62 + public static final LBRACK = 63 + public static final RBRACK = 64 + public static final BITWISE_OR = 65 + public static final INPLACE_BITWISE_OR = 66 + public static final BITWISE_AND = 67 + public static final BITWISE_XOR = 68 + public static final INPLACE_BITWISE_AND = 69 + public static final LOGICAL_OR = 70 + public static final LOGICAL_AND = 71 + public static final EOS = 72 + public static final ASSIGN = 73 + public static final INCREMENT = 74 + public static final DECREMENT = 75 + public static final ADD = 76 + public static final SUBTRACT = 77 + public static final MODULUS = 78 + public static final MULTIPLY = 79 + public static final EQUALITY = 80 + public static final INEQUALITY = 81 + public static final QUESTION_MARK = 82 + public static final BITWISE_NOT = 83 + public static final REFERENCE_EQUALITY = 84 + public static final REFERENCE_INEQUALITY = 85 + public static final LESS_THAN = 86 + public static final LESS_THAN_OR_EQUAL = 87 + public static final SHIFT_LEFT = 88 + public static final INPLACE_SHIFT_LEFT = 89 + public static final GREATER_THAN = 90 + public static final GREATER_THAN_OR_EQUAL = 91 + public static final SHIFT_RIGHT = 92 + public static final INPLACE_SHIFT_RIGHT = 93 + public static final AT = 94 + public static final SCRIPT_ATTRIBUTE_MARKER = 95 + public static final HASH = 96 + public static final INPLACE_BITWISE_XOR = 97 + public static final NOT = 98 + public static final DIVISION = 99 + public static final RE_LITERAL = 100 + public static final DOUBLE = 101 + public static final INT = 102 + public static final LONG = 103 + public static final DOUBLE_SUFFIX = 104 + public static final EXPONENT = 105 + public static final WHITE_SPACE = 106 + public static final DQS_ESC = 107 + public static final SQS_ESC = 108 + public static final SESC = 109 + public static final ML_COMMENT = 110 + public static final RE_CHAR = 111 + public static final RE_ESC = 112 + public static final NEWLINE = 113 + public static final ID_LETTER = 114 + public static final DIGIT = 115 + public static final HEXDIGIT = 116 [property(CompilerContext)] @@ -3625,12 +3626,8 @@ class UnityScriptParser(antlr.LLkParser): public def unary_expression() as Expression : //throws RecognitionException, TokenStreamException e as Expression - sub as IToken = null - inc as IToken = null - dec as IToken = null - nt as IToken = null - oc as IToken = null - t as IToken = null + tc as IToken = null + c as IToken = null uOperator = UnaryOperatorType.None try: // for error handling @@ -3641,37 +3638,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==BITWISE_NOT) or (_givenValue ==NOT) ): // 1827 - _givenValue = LA(1) - if ((_givenValue == SUBTRACT)): // 1831 - sub = LT(1) - match(SUBTRACT) - if 0 == inputState.guessing: - op = sub; uOperator = UnaryOperatorType.UnaryNegation; - elif ((_givenValue == INCREMENT)): // 1831 - inc = LT(1) - match(INCREMENT) - if 0 == inputState.guessing: - op = inc; uOperator = UnaryOperatorType.Increment; - elif ((_givenValue == DECREMENT)): // 1831 - dec = LT(1) - match(DECREMENT) - if 0 == inputState.guessing: - op = dec; uOperator = UnaryOperatorType.Decrement; - elif ((_givenValue == NOT)): // 1831 - nt = LT(1) - match(NOT) - if 0 == inputState.guessing: - op = nt; uOperator = UnaryOperatorType.LogicalNot; - elif ((_givenValue == BITWISE_NOT)): // 1831 - oc = LT(1) - match(BITWISE_NOT) - if 0 == inputState.guessing: - op = oc; uOperator = UnaryOperatorType.OnesComplement; - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - e=unary_expression() - if 0 == inputState.guessing: - e = UnaryExpression(ToLexicalInfo(op), uOperator, e) if op is not null + e=prefix_unary_expression() elif ((_givenValue == FALSE) or (_givenValue ==FUNCTION) or (_givenValue ==NEW) @@ -3694,11 +3661,17 @@ class UnityScriptParser(antlr.LLkParser): else: // line 1969 raise NoViableAltException(LT(1), getFilename()) if ((LA(1)==AS) and (LA(2)==FUNCTION or LA(2)==ID)): - t = LT(1) + tc = LT(1) match(AS) tr=type_reference() if 0 == inputState.guessing: - e = TryCastExpression(ToLexicalInfo(t), Target: e, Type: tr) + e = TryCastExpression(ToLexicalInfo(tc), Target: e, Type: tr) + elif ((LA(1)==CAST) and (LA(2)==FUNCTION or LA(2)==ID)): // line 2102 + c = LT(1) + match(CAST) + tr=type_reference() + if 0 == inputState.guessing: + e = CastExpression(ToLexicalInfo(c), Target: e, Type: tr) elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: @@ -3711,6 +3684,56 @@ class UnityScriptParser(antlr.LLkParser): raise return e + public def prefix_unary_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + sub as IToken = null + inc as IToken = null + dec as IToken = null + nt as IToken = null + oc as IToken = null + uOperator = UnaryOperatorType.None + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == SUBTRACT)): // 1831 + sub = LT(1) + match(SUBTRACT) + if 0 == inputState.guessing: + op = sub; uOperator = UnaryOperatorType.UnaryNegation; + elif ((_givenValue == INCREMENT)): // 1831 + inc = LT(1) + match(INCREMENT) + if 0 == inputState.guessing: + op = inc; uOperator = UnaryOperatorType.Increment; + elif ((_givenValue == DECREMENT)): // 1831 + dec = LT(1) + match(DECREMENT) + if 0 == inputState.guessing: + op = dec; uOperator = UnaryOperatorType.Decrement; + elif ((_givenValue == NOT)): // 1831 + nt = LT(1) + match(NOT) + if 0 == inputState.guessing: + op = nt; uOperator = UnaryOperatorType.LogicalNot; + elif ((_givenValue == BITWISE_NOT)): // 1831 + oc = LT(1) + match(BITWISE_NOT) + if 0 == inputState.guessing: + op = oc; uOperator = UnaryOperatorType.OnesComplement; + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + e=unary_expression() + if 0 == inputState.guessing: + e = UnaryExpression(ToLexicalInfo(op), uOperator, e) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_12_) + else: + raise + return e + public def term() as Expression : //throws RecognitionException, TokenStreamException e as Expression @@ -4225,6 +4248,7 @@ class UnityScriptParser(antlr.LLkParser): 'NULL_TREE_LOOKAHEAD', 'as', 'break', + 'cast', 'catch', 'class', 'continue', @@ -4338,19 +4362,19 @@ class UnityScriptParser(antlr.LLkParser): ) private static def mk_tokenSet_0_() as (long): - data = (13240180483200L, 1073741824L, 0L, 0L, ) + data = (26480360966400L, 2147483648L, 0L, 0L, ) return data public static final tokenSet_0_ = BitSet(mk_tokenSet_0_()) private static def mk_tokenSet_1_() as (long): - data = (9020437283545216L, 0L, ) + data = (18040874567090432L, 0L, ) return data public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) private static def mk_tokenSet_2_() as (long): - data = (4818983474080092448L, 523986277888L, 0L, 0L, ) + data = (-8808777125549366752L, 1047972555776L, 0L, 0L, ) return data public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) private static def mk_tokenSet_3_() as (long): - data = (-3747417124987619918L, 547608330239L, 0L, 0L, ) + data = (-7494834249975239822L, 1095216660479L, 0L, 0L, ) return data public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) private static def mk_tokenSet_4_() as (long): @@ -4358,227 +4382,227 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) private static def mk_tokenSet_5_() as (long): - data = (4818992316214523298L, 527744374272L, 0L, 0L, ) + data = (-8808759441280505054L, 1055488748544L, 0L, 0L, ) return data public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) private static def mk_tokenSet_6_() as (long): - data = (13241271002240L, 1073741824L, 0L, 0L, ) + data = (26482542004480L, 2147483648L, 0L, 0L, ) return data public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) private static def mk_tokenSet_7_() as (long): - data = (4818992316213999010L, 525596890624L, 0L, 0L, ) + data = (-8808759441281553630L, 1051193781248L, 0L, 0L, ) return data public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) private static def mk_tokenSet_8_() as (long): - data = (3170534137668829184L, 1L, 0L, 0L, ) + data = (6341068275337658368L, 2L, 0L, 0L, ) return data public static final tokenSet_8_ = BitSet(mk_tokenSet_8_()) private static def mk_tokenSet_9_() as (long): - data = (153124586353917952L, 0L, ) + data = (306249172707835904L, 0L, ) return data public static final tokenSet_9_ = BitSet(mk_tokenSet_9_()) private static def mk_tokenSet_10_() as (long): - data = (7989388693943160832L, 523986277888L, 0L, 0L, ) + data = (-2467966685823229952L, 1047972555776L, 0L, 0L, ) return data public static final tokenSet_10_ = BitSet(mk_tokenSet_10_()) private static def mk_tokenSet_11_() as (long): - data = (2594073385365405696L, 0L, ) + data = (5188146770730811392L, 0L, ) return data public static final tokenSet_11_ = BitSet(mk_tokenSet_11_()) private static def mk_tokenSet_12_() as (long): - data = (-21476542478L, 547608330239L, 0L, 0L, ) + data = (-42953084942L, 1095216660479L, 0L, 0L, ) return data public static final tokenSet_12_ = BitSet(mk_tokenSet_12_()) private static def mk_tokenSet_13_() as (long): - data = (4818854556274331648L, 523986277888L, 0L, 0L, ) + data = (-8809034961160888320L, 1047972555776L, 0L, 0L, ) return data public static final tokenSet_13_ = BitSet(mk_tokenSet_13_()) private static def mk_tokenSet_14_() as (long): - data = (2594073385365405696L, 1L, 0L, 0L, ) + data = (5188146770730811392L, 2L, 0L, 0L, ) return data public static final tokenSet_14_ = BitSet(mk_tokenSet_14_()) private static def mk_tokenSet_15_() as (long): - data = (2738188573441261568L, 257L, 0L, 0L, ) + data = (5476377146882523136L, 514L, 0L, 0L, ) return data public static final tokenSet_15_ = BitSet(mk_tokenSet_15_()) private static def mk_tokenSet_16_() as (long): - data = (171139534652772352L, 481036337152L, 0L, 0L, ) + data = (342279069305544704L, 962072674304L, 0L, 0L, ) return data public static final tokenSet_16_ = BitSet(mk_tokenSet_16_()) private static def mk_tokenSet_17_() as (long): - data = (7989388693943160832L, 523986277889L, 0L, 0L, ) + data = (-2467966685823229952L, 1047972555778L, 0L, 0L, ) return data public static final tokenSet_17_ = BitSet(mk_tokenSet_17_()) private static def mk_tokenSet_18_() as (long): - data = (13241271002240L, 1610612736L, 0L, 0L, ) + data = (26482542004480L, 3221225472L, 0L, 0L, ) return data public static final tokenSet_18_ = BitSet(mk_tokenSet_18_()) private static def mk_tokenSet_19_() as (long): - data = (459369910804484096L, 481036337152L, 0L, 0L, ) + data = (918739821608968192L, 962072674304L, 0L, 0L, ) return data public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) private static def mk_tokenSet_20_() as (long): - data = (4818992317287740834L, 525596890624L, 0L, 0L, ) + data = (-8808759439134069982L, 1051193781248L, 0L, 0L, ) return data public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) private static def mk_tokenSet_21_() as (long): - data = (-3747417106733877838L, 547608330239L, 0L, 0L, ) + data = (-7494834213467755662L, 1095216660479L, 0L, 0L, ) return data public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) private static def mk_tokenSet_22_() as (long): - data = (-21474969614L, 549755813887L, 0L, 0L, ) + data = (-42949939214L, 1099511627775L, 0L, 0L, ) return data public static final tokenSet_22_ = BitSet(mk_tokenSet_22_()) private static def mk_tokenSet_23_() as (long): - data = (13239119323136L, 536870912L, 0L, 0L, ) + data = (26478238646272L, 1073741824L, 0L, 0L, ) return data public static final tokenSet_23_ = BitSet(mk_tokenSet_23_()) private static def mk_tokenSet_24_() as (long): - data = (13239119323136L, 0L, ) + data = (26478238646272L, 0L, ) return data public static final tokenSet_24_ = BitSet(mk_tokenSet_24_()) private static def mk_tokenSet_25_() as (long): - data = (9020455554064384L, 0L, ) + data = (18040911108128768L, 0L, ) return data public static final tokenSet_25_ = BitSet(mk_tokenSet_25_()) private static def mk_tokenSet_26_() as (long): - data = (9007216434749440L, 0L, ) + data = (18014432869498880L, 0L, ) return data public static final tokenSet_26_ = BitSet(mk_tokenSet_26_()) private static def mk_tokenSet_27_() as (long): - data = (13238028738560L, 0L, ) + data = (26476057477120L, 0L, ) return data public static final tokenSet_27_ = BitSet(mk_tokenSet_27_()) private static def mk_tokenSet_28_() as (long): - data = (9020437283479552L, 0L, ) + data = (18040874566959104L, 0L, ) return data public static final tokenSet_28_ = BitSet(mk_tokenSet_28_()) private static def mk_tokenSet_29_() as (long): - data = (8839982292992L, 0L, ) + data = (17679964585984L, 0L, ) return data public static final tokenSet_29_ = BitSet(mk_tokenSet_29_()) private static def mk_tokenSet_30_() as (long): - data = (9016039237033984L, 0L, ) + data = (18032078474067968L, 0L, ) return data public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) private static def mk_tokenSet_31_() as (long): - data = (4398046576640L, 0L, ) + data = (8796093153280L, 0L, ) return data public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) private static def mk_tokenSet_32_() as (long): - data = (4891472122717009890L, 525596890752L, 0L, 0L, ) + data = (-8663799828275531870L, 1051193781504L, 0L, 0L, ) return data public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) private static def mk_tokenSet_33_() as (long): - data = (4891472123791276002L, 527744374400L, 0L, 0L, ) + data = (-8663799826126999646L, 1055488748800L, 0L, 0L, ) return data public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) private static def mk_tokenSet_34_() as (long): - data = (-1574926L, 547608330239L, 0L, 0L, ) + data = (-3149838L, 1095216660479L, 0L, 0L, ) return data public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) private static def mk_tokenSet_35_() as (long): - data = (4891049911325668770L, 525596890624L, 0L, 0L, ) + data = (-8664644251058214110L, 1051193781248L, 0L, 0L, ) return data public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) private static def mk_tokenSet_36_() as (long): - data = (4818858954320842752L, 523986278016L, 0L, 0L, ) + data = (-8809026165067866112L, 1047972556032L, 0L, 0L, ) return data public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) private static def mk_tokenSet_37_() as (long): - data = (-3747554884927287280L, 545997717503L, 0L, 0L, ) + data = (-7495109769854574512L, 1091995435007L, 0L, 0L, ) return data public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) private static def mk_tokenSet_38_() as (long): - data = (4818983474080092448L, 523986278016L, 0L, 0L, ) + data = (-8808777125549366752L, 1047972556032L, 0L, 0L, ) return data public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) private static def mk_tokenSet_39_() as (long): - data = (-3755439161823856654L, 543028149997L, 0L, 0L, ) + data = (-7510878323647713294L, 1086056299995L, 0L, 0L, ) return data public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) private static def mk_tokenSet_40_() as (long): - data = (-21475493902L, 547608330239L, 0L, 0L, ) + data = (-42950987790L, 1095216660479L, 0L, 0L, ) return data public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) private static def mk_tokenSet_41_() as (long): - data = (-4295493646L, 547608330239L, 0L, 0L, ) + data = (-8590987278L, 1095216660479L, 0L, 0L, ) return data public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) private static def mk_tokenSet_42_() as (long): - data = (36028797018963968L, 33554432L, 0L, 0L, ) + data = (72057594037927936L, 67108864L, 0L, 0L, ) return data public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) private static def mk_tokenSet_43_() as (long): - data = (72070833157251072L, 536870912L, 0L, 0L, ) + data = (144141666314502144L, 1073741824L, 0L, 0L, ) return data public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) private static def mk_tokenSet_44_() as (long): - data = (72057594037993472L, 536870912L, 0L, 0L, ) + data = (144115188075986944L, 1073741824L, 0L, 0L, ) return data public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) private static def mk_tokenSet_45_() as (long): - data = (288230376151711744L, 0L, ) + data = (576460752303423488L, 0L, ) return data public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) private static def mk_tokenSet_46_() as (long): - data = (2377900603251621888L, 0L, ) + data = (4755801206503243776L, 0L, ) return data public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) private static def mk_tokenSet_47_() as (long): - data = (6043971415932515746L, 525596891008L, 0L, 0L, ) + data = (-6358801241844520158L, 1051193782016L, 0L, 0L, ) return data public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) private static def mk_tokenSet_48_() as (long): - data = (4891472123790751714L, 525596890752L, 0L, 0L, ) + data = (-8663799826128048222L, 1051193781504L, 0L, 0L, ) return data public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) private static def mk_tokenSet_49_() as (long): - data = (4891041068118020384L, 523986278016L, 0L, 0L, ) + data = (-8664661937473510880L, 1047972556032L, 0L, 0L, ) return data public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) private static def mk_tokenSet_50_() as (long): - data = (-3746994912522536974L, 547608330239L, 0L, 0L, ) + data = (-7493989825045073934L, 1095216660479L, 0L, 0L, ) return data public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) private static def mk_tokenSet_51_() as (long): - data = (4891472122719107042L, 525596891008L, 0L, 0L, ) + data = (-8663799828271337566L, 1051193782016L, 0L, 0L, ) return data public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) private static def mk_tokenSet_52_() as (long): - data = (5179702498868721634L, 525596890752L, 0L, 0L, ) + data = (-8087339075972108382L, 1051193781504L, 0L, 0L, ) return data public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) private static def mk_tokenSet_53_() as (long): - data = (-4296542222L, 547608330239L, 0L, 0L, ) + data = (-8593084430L, 1095216660479L, 0L, 0L, ) return data public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) private static def mk_tokenSet_54_() as (long): - data = (-8935141660703064064L, 0L, ) + data = (576460752303423488L, 1L, 0L, 0L, ) return data public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) private static def mk_tokenSet_55_() as (long): - data = (-6917529027641081856L, 0L, ) + data = (4611686018427387904L, 1L, 0L, 0L, ) return data public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) private static def mk_tokenSet_56_() as (long): - data = (5971776060881178624L, 523986277888L, 0L, 0L, ) + data = (-6503191951947194368L, 1047972555776L, 0L, 0L, ) return data public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) private static def mk_tokenSet_57_() as (long): - data = (9007216434741248L, 2097152L, 0L, 0L, ) + data = (18014432869482496L, 4194304L, 0L, 0L, ) return data public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) private static def mk_tokenSet_58_() as (long): - data = (5107084932426043392L, 523986277888L, 0L, 0L, ) + data = (-8232574208857464832L, 1047972555776L, 0L, 0L, ) return data public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) private static def mk_tokenSet_59_() as (long): - data = (10485760L, 106954752L, 0L, 0L, ) + data = (20971520L, 213909504L, 0L, 0L, ) return data public static final tokenSet_59_ = BitSet(mk_tokenSet_59_()) private static def mk_tokenSet_60_() as (long): - data = (0L, 1671168L, 0L, 0L, ) + data = (0L, 3342336L, 0L, 0L, ) return data public static final tokenSet_60_ = BitSet(mk_tokenSet_60_()) diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.boo b/src/UnityScript/Parser/UnityScriptTokenTypes.boo index c893c8a..778e28b 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.boo +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.boo @@ -6,114 +6,115 @@ class UnityScriptTokenTypes: public static final NULL_TREE_LOOKAHEAD = 3 public static final AS = 4 public static final BREAK = 5 - public static final CATCH = 6 - public static final CLASS = 7 - public static final CONTINUE = 8 - public static final ELSE = 9 - public static final ENUM = 10 - public static final EXTENDS = 11 - public static final FALSE = 12 - public static final FINAL = 13 - public static final FINALLY = 14 - public static final FOR = 15 - public static final FUNCTION = 16 - public static final GET = 17 - public static final IF = 18 - public static final IMPORT = 19 - public static final IMPLEMENTS = 20 - public static final IN = 21 - public static final INTERFACE = 22 - public static final INSTANCEOF = 23 - public static final NEW = 24 - public static final NULL = 25 - public static final RETURN = 26 - public static final PUBLIC = 27 - public static final PROTECTED = 28 - public static final INTERNAL = 29 - public static final OVERRIDE = 30 - public static final PARTIAL = 31 - public static final PRAGMA = 32 - public static final PRIVATE = 33 - public static final SET = 34 - public static final STATIC = 35 - public static final SUPER = 36 - public static final THIS = 37 - public static final THROW = 38 - public static final TRUE = 39 - public static final TRY = 40 - public static final TYPEOF = 41 - public static final VAR = 42 - public static final VIRTUAL = 43 - public static final WHILE = 44 - public static final YIELD = 45 - public static final SWITCH = 46 - public static final CASE = 47 - public static final DEFAULT = 48 - public static final INPLACE_DIVISION = 49 - public static final INPLACE_ADD = 50 - public static final INPLACE_SUBTRACT = 51 - public static final INPLACE_MULTIPLY = 52 - public static final ID = 53 - public static final DOUBLE_QUOTED_STRING = 54 - public static final LBRACE = 55 - public static final RBRACE = 56 - public static final LPAREN = 57 - public static final RPAREN = 58 - public static final DOT = 59 - public static final COLON = 60 - public static final COMMA = 61 - public static final LBRACK = 62 - public static final RBRACK = 63 - public static final BITWISE_OR = 64 - public static final INPLACE_BITWISE_OR = 65 - public static final BITWISE_AND = 66 - public static final BITWISE_XOR = 67 - public static final INPLACE_BITWISE_AND = 68 - public static final LOGICAL_OR = 69 - public static final LOGICAL_AND = 70 - public static final EOS = 71 - public static final ASSIGN = 72 - public static final INCREMENT = 73 - public static final DECREMENT = 74 - public static final ADD = 75 - public static final SUBTRACT = 76 - public static final MODULUS = 77 - public static final MULTIPLY = 78 - public static final EQUALITY = 79 - public static final INEQUALITY = 80 - public static final QUESTION_MARK = 81 - public static final BITWISE_NOT = 82 - public static final REFERENCE_EQUALITY = 83 - public static final REFERENCE_INEQUALITY = 84 - public static final LESS_THAN = 85 - public static final LESS_THAN_OR_EQUAL = 86 - public static final SHIFT_LEFT = 87 - public static final INPLACE_SHIFT_LEFT = 88 - public static final GREATER_THAN = 89 - public static final GREATER_THAN_OR_EQUAL = 90 - public static final SHIFT_RIGHT = 91 - public static final INPLACE_SHIFT_RIGHT = 92 - public static final AT = 93 - public static final SCRIPT_ATTRIBUTE_MARKER = 94 - public static final HASH = 95 - public static final INPLACE_BITWISE_XOR = 96 - public static final NOT = 97 - public static final DIVISION = 98 - public static final RE_LITERAL = 99 - public static final DOUBLE = 100 - public static final INT = 101 - public static final LONG = 102 - public static final DOUBLE_SUFFIX = 103 - public static final EXPONENT = 104 - public static final WHITE_SPACE = 105 - public static final DQS_ESC = 106 - public static final SQS_ESC = 107 - public static final SESC = 108 - public static final ML_COMMENT = 109 - public static final RE_CHAR = 110 - public static final RE_ESC = 111 - public static final NEWLINE = 112 - public static final ID_LETTER = 113 - public static final DIGIT = 114 - public static final HEXDIGIT = 115 + public static final CAST = 6 + public static final CATCH = 7 + public static final CLASS = 8 + public static final CONTINUE = 9 + public static final ELSE = 10 + public static final ENUM = 11 + public static final EXTENDS = 12 + public static final FALSE = 13 + public static final FINAL = 14 + public static final FINALLY = 15 + public static final FOR = 16 + public static final FUNCTION = 17 + public static final GET = 18 + public static final IF = 19 + public static final IMPORT = 20 + public static final IMPLEMENTS = 21 + public static final IN = 22 + public static final INTERFACE = 23 + public static final INSTANCEOF = 24 + public static final NEW = 25 + public static final NULL = 26 + public static final RETURN = 27 + public static final PUBLIC = 28 + public static final PROTECTED = 29 + public static final INTERNAL = 30 + public static final OVERRIDE = 31 + public static final PARTIAL = 32 + public static final PRAGMA = 33 + public static final PRIVATE = 34 + public static final SET = 35 + public static final STATIC = 36 + public static final SUPER = 37 + public static final THIS = 38 + public static final THROW = 39 + public static final TRUE = 40 + public static final TRY = 41 + public static final TYPEOF = 42 + public static final VAR = 43 + public static final VIRTUAL = 44 + public static final WHILE = 45 + public static final YIELD = 46 + public static final SWITCH = 47 + public static final CASE = 48 + public static final DEFAULT = 49 + public static final INPLACE_DIVISION = 50 + public static final INPLACE_ADD = 51 + public static final INPLACE_SUBTRACT = 52 + public static final INPLACE_MULTIPLY = 53 + public static final ID = 54 + public static final DOUBLE_QUOTED_STRING = 55 + public static final LBRACE = 56 + public static final RBRACE = 57 + public static final LPAREN = 58 + public static final RPAREN = 59 + public static final DOT = 60 + public static final COLON = 61 + public static final COMMA = 62 + public static final LBRACK = 63 + public static final RBRACK = 64 + public static final BITWISE_OR = 65 + public static final INPLACE_BITWISE_OR = 66 + public static final BITWISE_AND = 67 + public static final BITWISE_XOR = 68 + public static final INPLACE_BITWISE_AND = 69 + public static final LOGICAL_OR = 70 + public static final LOGICAL_AND = 71 + public static final EOS = 72 + public static final ASSIGN = 73 + public static final INCREMENT = 74 + public static final DECREMENT = 75 + public static final ADD = 76 + public static final SUBTRACT = 77 + public static final MODULUS = 78 + public static final MULTIPLY = 79 + public static final EQUALITY = 80 + public static final INEQUALITY = 81 + public static final QUESTION_MARK = 82 + public static final BITWISE_NOT = 83 + public static final REFERENCE_EQUALITY = 84 + public static final REFERENCE_INEQUALITY = 85 + public static final LESS_THAN = 86 + public static final LESS_THAN_OR_EQUAL = 87 + public static final SHIFT_LEFT = 88 + public static final INPLACE_SHIFT_LEFT = 89 + public static final GREATER_THAN = 90 + public static final GREATER_THAN_OR_EQUAL = 91 + public static final SHIFT_RIGHT = 92 + public static final INPLACE_SHIFT_RIGHT = 93 + public static final AT = 94 + public static final SCRIPT_ATTRIBUTE_MARKER = 95 + public static final HASH = 96 + public static final INPLACE_BITWISE_XOR = 97 + public static final NOT = 98 + public static final DIVISION = 99 + public static final RE_LITERAL = 100 + public static final DOUBLE = 101 + public static final INT = 102 + public static final LONG = 103 + public static final DOUBLE_SUFFIX = 104 + public static final EXPONENT = 105 + public static final WHITE_SPACE = 106 + public static final DQS_ESC = 107 + public static final SQS_ESC = 108 + public static final SESC = 109 + public static final ML_COMMENT = 110 + public static final RE_CHAR = 111 + public static final RE_ESC = 112 + public static final NEWLINE = 113 + public static final ID_LETTER = 114 + public static final DIGIT = 115 + public static final HEXDIGIT = 116 diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.txt b/src/UnityScript/Parser/UnityScriptTokenTypes.txt index 500005a..49e52fd 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.txt +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.txt @@ -2,113 +2,114 @@ UnityScript // output token vocab name AS="as"=4 BREAK="break"=5 -CATCH="catch"=6 -CLASS="class"=7 -CONTINUE="continue"=8 -ELSE="else"=9 -ENUM="enum"=10 -EXTENDS="extends"=11 -FALSE="false"=12 -FINAL="final"=13 -FINALLY="finally"=14 -FOR="for"=15 -FUNCTION="function"=16 -GET="get"=17 -IF="if"=18 -IMPORT="import"=19 -IMPLEMENTS="implements"=20 -IN="in"=21 -INTERFACE="interface"=22 -INSTANCEOF="instanceof"=23 -NEW="new"=24 -NULL="null"=25 -RETURN="return"=26 -PUBLIC="public"=27 -PROTECTED="protected"=28 -INTERNAL="internal"=29 -OVERRIDE="override"=30 -PARTIAL="partial"=31 -PRAGMA="pragma"=32 -PRIVATE="private"=33 -SET="set"=34 -STATIC="static"=35 -SUPER="super"=36 -THIS="this"=37 -THROW="throw"=38 -TRUE="true"=39 -TRY="try"=40 -TYPEOF="typeof"=41 -VAR="var"=42 -VIRTUAL="virtual"=43 -WHILE="while"=44 -YIELD="yield"=45 -SWITCH="switch"=46 -CASE="case"=47 -DEFAULT="default"=48 -INPLACE_DIVISION="/="=49 -INPLACE_ADD="+="=50 -INPLACE_SUBTRACT="-="=51 -INPLACE_MULTIPLY="*="=52 -ID="an identifier"=53 -DOUBLE_QUOTED_STRING="a string"=54 -LBRACE="{"=55 -RBRACE="}"=56 -LPAREN="("=57 -RPAREN=")"=58 -DOT="."=59 -COLON=":"=60 -COMMA=","=61 -LBRACK="["=62 -RBRACK="]"=63 -BITWISE_OR="|"=64 -INPLACE_BITWISE_OR="|="=65 -BITWISE_AND="&"=66 -BITWISE_XOR="^"=67 -INPLACE_BITWISE_AND="&="=68 -LOGICAL_OR="||"=69 -LOGICAL_AND="&&"=70 -EOS=";"=71 -ASSIGN="="=72 -INCREMENT="++"=73 -DECREMENT="--"=74 -ADD="+"=75 -SUBTRACT="-"=76 -MODULUS="%"=77 -MULTIPLY="*"=78 -EQUALITY="=="=79 -INEQUALITY="!="=80 -QUESTION_MARK="?"=81 -BITWISE_NOT="~"=82 -REFERENCE_EQUALITY="==="=83 -REFERENCE_INEQUALITY="!=="=84 -LESS_THAN="<"=85 -LESS_THAN_OR_EQUAL="<="=86 -SHIFT_LEFT="<<"=87 -INPLACE_SHIFT_LEFT="<<="=88 -GREATER_THAN=">"=89 -GREATER_THAN_OR_EQUAL=">="=90 -SHIFT_RIGHT=">>"=91 -INPLACE_SHIFT_RIGHT=">>="=92 -AT="@"=93 -SCRIPT_ATTRIBUTE_MARKER="@script"=94 -HASH=95 -INPLACE_BITWISE_XOR=96 -NOT=97 -DIVISION=98 -RE_LITERAL=99 -DOUBLE=100 -INT=101 -LONG=102 -DOUBLE_SUFFIX=103 -EXPONENT=104 -WHITE_SPACE=105 -DQS_ESC=106 -SQS_ESC=107 -SESC=108 -ML_COMMENT=109 -RE_CHAR=110 -RE_ESC=111 -NEWLINE=112 -ID_LETTER=113 -DIGIT=114 -HEXDIGIT=115 +CAST="cast"=6 +CATCH="catch"=7 +CLASS="class"=8 +CONTINUE="continue"=9 +ELSE="else"=10 +ENUM="enum"=11 +EXTENDS="extends"=12 +FALSE="false"=13 +FINAL="final"=14 +FINALLY="finally"=15 +FOR="for"=16 +FUNCTION="function"=17 +GET="get"=18 +IF="if"=19 +IMPORT="import"=20 +IMPLEMENTS="implements"=21 +IN="in"=22 +INTERFACE="interface"=23 +INSTANCEOF="instanceof"=24 +NEW="new"=25 +NULL="null"=26 +RETURN="return"=27 +PUBLIC="public"=28 +PROTECTED="protected"=29 +INTERNAL="internal"=30 +OVERRIDE="override"=31 +PARTIAL="partial"=32 +PRAGMA="pragma"=33 +PRIVATE="private"=34 +SET="set"=35 +STATIC="static"=36 +SUPER="super"=37 +THIS="this"=38 +THROW="throw"=39 +TRUE="true"=40 +TRY="try"=41 +TYPEOF="typeof"=42 +VAR="var"=43 +VIRTUAL="virtual"=44 +WHILE="while"=45 +YIELD="yield"=46 +SWITCH="switch"=47 +CASE="case"=48 +DEFAULT="default"=49 +INPLACE_DIVISION="/="=50 +INPLACE_ADD="+="=51 +INPLACE_SUBTRACT="-="=52 +INPLACE_MULTIPLY="*="=53 +ID="an identifier"=54 +DOUBLE_QUOTED_STRING="a string"=55 +LBRACE="{"=56 +RBRACE="}"=57 +LPAREN="("=58 +RPAREN=")"=59 +DOT="."=60 +COLON=":"=61 +COMMA=","=62 +LBRACK="["=63 +RBRACK="]"=64 +BITWISE_OR="|"=65 +INPLACE_BITWISE_OR="|="=66 +BITWISE_AND="&"=67 +BITWISE_XOR="^"=68 +INPLACE_BITWISE_AND="&="=69 +LOGICAL_OR="||"=70 +LOGICAL_AND="&&"=71 +EOS=";"=72 +ASSIGN="="=73 +INCREMENT="++"=74 +DECREMENT="--"=75 +ADD="+"=76 +SUBTRACT="-"=77 +MODULUS="%"=78 +MULTIPLY="*"=79 +EQUALITY="=="=80 +INEQUALITY="!="=81 +QUESTION_MARK="?"=82 +BITWISE_NOT="~"=83 +REFERENCE_EQUALITY="==="=84 +REFERENCE_INEQUALITY="!=="=85 +LESS_THAN="<"=86 +LESS_THAN_OR_EQUAL="<="=87 +SHIFT_LEFT="<<"=88 +INPLACE_SHIFT_LEFT="<<="=89 +GREATER_THAN=">"=90 +GREATER_THAN_OR_EQUAL=">="=91 +SHIFT_RIGHT=">>"=92 +INPLACE_SHIFT_RIGHT=">>="=93 +AT="@"=94 +SCRIPT_ATTRIBUTE_MARKER="@script"=95 +HASH=96 +INPLACE_BITWISE_XOR=97 +NOT=98 +DIVISION=99 +RE_LITERAL=100 +DOUBLE=101 +INT=102 +LONG=103 +DOUBLE_SUFFIX=104 +EXPONENT=105 +WHITE_SPACE=106 +DQS_ESC=107 +SQS_ESC=108 +SESC=109 +ML_COMMENT=110 +RE_CHAR=111 +RE_ESC=112 +NEWLINE=113 +ID_LETTER=114 +DIGIT=115 +HEXDIGIT=116 diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index cce0667..ef4f095 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -25,6 +25,7 @@ tokens { AS="as"; BREAK="break"; + CAST="cast"; CATCH="catch"; CLASS="class"; CONTINUE="continue"; @@ -1384,28 +1385,30 @@ unary_expression returns [Expression e] uOperator = UnaryOperatorType.None }: ( - ( - ( - sub:SUBTRACT { op = sub; uOperator = UnaryOperatorType.UnaryNegation; } | - inc:INCREMENT { op = inc; uOperator = UnaryOperatorType.Increment; } | - dec:DECREMENT { op = dec; uOperator = UnaryOperatorType.Decrement; } | - nt:NOT { op = nt; uOperator = UnaryOperatorType.LogicalNot; } | - oc:BITWISE_NOT { op = oc; uOperator = UnaryOperatorType.OnesComplement; } - ) - e=unary_expression - { e = UnaryExpression(ToLexicalInfo(op), uOperator, e) if op is not null } - ) + e=prefix_unary_expression | e=postfix_unary_expression ) ( - t:AS - tr=type_reference - { - e = TryCastExpression(ToLexicalInfo(t), Target: e, Type: tr) - } + tc:AS tr=type_reference { e = TryCastExpression(ToLexicalInfo(tc), Target: e, Type: tr) } + | c:CAST tr=type_reference { e = CastExpression(ToLexicalInfo(c), Target: e, Type: tr) } )? ; +prefix_unary_expression returns [Expression e] +{ + uOperator = UnaryOperatorType.None +}: + ( + sub:SUBTRACT { op = sub; uOperator = UnaryOperatorType.UnaryNegation; } | + inc:INCREMENT { op = inc; uOperator = UnaryOperatorType.Increment; } | + dec:DECREMENT { op = dec; uOperator = UnaryOperatorType.Decrement; } | + nt:NOT { op = nt; uOperator = UnaryOperatorType.LogicalNot; } | + oc:BITWISE_NOT { op = oc; uOperator = UnaryOperatorType.OnesComplement; } + ) + e=unary_expression { e = UnaryExpression(ToLexicalInfo(op), uOperator, e) } +; + + term returns [Expression e] { op = BinaryOperatorType.None diff --git a/tests/integration/cast-operator-1.js b/tests/integration/cast-operator-1.js new file mode 100644 index 0000000..3fb4b4a --- /dev/null +++ b/tests/integration/cast-operator-1.js @@ -0,0 +1,8 @@ +/* +42 +*/ +#pragma strict + +var o:Object = 41; +var i = o cast int; +print(i + 1); diff --git a/tests/integration/cast-operator-precedence.js b/tests/integration/cast-operator-precedence.js new file mode 100644 index 0000000..ebe5b95 --- /dev/null +++ b/tests/integration/cast-operator-precedence.js @@ -0,0 +1,5 @@ +/* +42 +*/ +var foo:Array = [41]; +print( foo[0] cast int + 1 ); From b746527290f2cdca2bb662d61d040003329a04ff Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 13 Aug 2010 18:04:52 -0300 Subject: [PATCH 072/276] test case for overloaded method resolution between static and instance member --- .../ErrorMessagesTestFixture.Generated.boo | 4 ++++ src/UnityScript.Tests/IntegrationTestFixture.boo | 4 ++++ .../static-instance-overload-resolution.js | 9 +++++++++ .../static-instance-overload-resolution.js | 16 ++++++++++++++++ 4 files changed, 33 insertions(+) create mode 100644 tests/error-messages/static-instance-overload-resolution.js create mode 100644 tests/integration/static-instance-overload-resolution.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index 1ac3a95..82c106f 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -126,6 +126,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/semicolon.js") + [Test] def static_instance_overload_resolution(): + RunTestCase("tests/error-messages/static-instance-overload-resolution.js") + + [Test] def unused_variable(): RunTestCase("tests/error-messages/unused-variable.js") diff --git a/src/UnityScript.Tests/IntegrationTestFixture.boo b/src/UnityScript.Tests/IntegrationTestFixture.boo index 0694630..06e2d1a 100644 --- a/src/UnityScript.Tests/IntegrationTestFixture.boo +++ b/src/UnityScript.Tests/IntegrationTestFixture.boo @@ -627,6 +627,10 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/shift-left-bitwise-or.js") + [Test] def static_instance_overload_resolution(): + RunTestCase("tests/integration/static-instance-overload-resolution.js") + + [Test] def string_append(): RunTestCase("tests/integration/string-append.js") diff --git a/tests/error-messages/static-instance-overload-resolution.js b/tests/error-messages/static-instance-overload-resolution.js new file mode 100644 index 0000000..6c0b1de --- /dev/null +++ b/tests/error-messages/static-instance-overload-resolution.js @@ -0,0 +1,9 @@ +/* +*/ +var startInfo = new System.Diagnostics.ProcessStartInfo(); + +function Start() { + var process = System.Diagnostics.Process.Start(startInfo); + process.WaitForExit(); // just to use the variable +} + diff --git a/tests/integration/static-instance-overload-resolution.js b/tests/integration/static-instance-overload-resolution.js new file mode 100644 index 0000000..e594aed --- /dev/null +++ b/tests/integration/static-instance-overload-resolution.js @@ -0,0 +1,16 @@ +/* +static +instance +*/ +class Foo { + static function Bar(value) { + print("static"); + } + + function Bar() { + print("instance"); + } +} + +Foo.Bar(42); +new Foo().Bar(); From e221e8804229051d4b0587e6365d69f5aad8630a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 18 Aug 2010 01:41:40 -0300 Subject: [PATCH 073/276] execute the tests with nunit-console -noshadow when building on mono --- default.build | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/default.build b/default.build index c2a60f4..99f3910 100755 --- a/default.build +++ b/default.build @@ -22,7 +22,14 @@ - + + + + + + + + From 132b43449c8c48aa16532adf5edf9d9601bfe2f8 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 18 Aug 2010 01:46:01 -0300 Subject: [PATCH 074/276] execute integration tests in both strict and ducky modes --- refresh-tests.boo | 90 +-- .../AbstractCompilerTest.boo | 16 +- .../AbstractIntegrationTestFixture.boo | 11 - ...re.boo => DuckyIntegrationTestFixture.boo} | 346 +++++------ .../ErrorMessagesTestFixture.Generated.boo | 44 +- src/UnityScript.Tests/EvalCompilationTest.boo | 8 +- src/UnityScript.Tests/ExpandoTestFixture.boo | 7 +- src/UnityScript.Tests/PragmaTestFixture.boo | 8 + .../StrictIntegrationTestFixture.boo | 550 ++++++++++++++++++ .../UnityScript.Tests.booproj | 3 +- .../Array-cast-to-native-array-of-struct.js} | 0 .../Array-length.js} | 0 ...struct-with-struct-loop-update-as-duck.js} | 0 ...rray-of-struct-with-struct-loop-update.js} | 0 .../{integration => ducky}/accessor-2-duck.js | 0 tests/{integration => ducky}/accessor-duck.js | 0 tests/{integration => ducky}/ambigous-call.js | 0 tests/{integration => ducky}/array-access.js | 0 tests/{integration => ducky}/array-iterate.js | 0 tests/{integration => ducky}/array-nest-1.js | 0 tests/{integration => ducky}/array-nest-2.js | 0 .../array-push-typesjs.js | 0 .../auto-coroutine-2-duck.js | 0 .../auto-coroutine-duck.js | 0 .../{integration => ducky}/auto-coroutine.js | 0 tests/{integration => ducky}/boolcast.js | 0 .../coroutine-return.js | 1 - tests/{integration => ducky}/duck-1.js | 0 .../duck-equality-operator-1.js | 0 .../duck-implicit-bool-1.js | 0 .../duck-implicit-bool-and-with-simple-ref.js | 0 .../duck-implicit-bool-and.js | 0 .../duck-implicit-bool-full.js | 0 .../duck-implicit-bool-simple.js | 0 .../duck-return-property.js | 0 tests/{integration => ducky}/duck.js | 0 tests/{integration => ducky}/ducktyped-1.js | 0 tests/{integration => ducky}/ducktyping-2.js | 0 tests/{integration => ducky}/ducktyping-3.js | 0 tests/{integration => ducky}/ducktyping.js | 0 tests/{integration => ducky}/ducky-1.js | 0 tests/{integration => ducky}/ducky_2.js | 0 tests/{integration => ducky}/ducky_3.js | 0 tests/{integration => ducky}/ducky_4.js | 0 tests/{integration => ducky}/ducky_5.js | 0 tests/{integration => ducky}/ducky_6.js | 0 .../implicit-conversion.js} | 0 ...struct-with-struct-loop-update-as-duck.js} | 0 .../native-array-to-Array-as-duck.js} | 0 tests/{integration => ducky}/null-assign.js | 0 .../var-with-no-initializer.js | 0 ...le-array-in-float-array-var-initializer.js | 2 +- tests/error-messages/pragma-strict-2.js | 7 - tests/error-messages/pragma-strict-3js.js | 11 - tests/error-messages/pragma-strict.js | 8 - ...t.js => strict-conditional-compilation.js} | 2 +- ...wncast.js => strict-disallows-downcast.js} | 2 +- .../strict-disallows-duck-downcast.js | 10 + .../strict-disallows-dynamic-dispatching.js | 8 + ...disallows-implicit-variable-declaration.js | 11 + .../strict-nongeneric-GetComponent.js | 7 + ...int-for-double-argument-strict-downcast.js | 10 + tests/integration/null-initializer.js | 4 +- .../pragma-expando-1.js | 0 .../pragma-expando-2.js | 0 65 files changed, 883 insertions(+), 283 deletions(-) rename src/UnityScript.Tests/{IntegrationTestFixture.boo => DuckyIntegrationTestFixture.boo} (83%) create mode 100644 src/UnityScript.Tests/StrictIntegrationTestFixture.boo rename tests/{integration/array-cast-6.js => ducky/Array-cast-to-native-array-of-struct.js} (100%) rename tests/{integration/array-length-2.js => ducky/Array-length.js} (100%) rename tests/{integration/arrays-9.js => ducky/Array-of-struct-with-struct-loop-update-as-duck.js} (100%) rename tests/{integration/arrays-10.js => ducky/Array-of-struct-with-struct-loop-update.js} (100%) rename tests/{integration => ducky}/accessor-2-duck.js (100%) rename tests/{integration => ducky}/accessor-duck.js (100%) rename tests/{integration => ducky}/ambigous-call.js (100%) rename tests/{integration => ducky}/array-access.js (100%) rename tests/{integration => ducky}/array-iterate.js (100%) rename tests/{integration => ducky}/array-nest-1.js (100%) rename tests/{integration => ducky}/array-nest-2.js (100%) rename tests/{integration => ducky}/array-push-typesjs.js (100%) rename tests/{integration => ducky}/auto-coroutine-2-duck.js (100%) rename tests/{integration => ducky}/auto-coroutine-duck.js (100%) rename tests/{integration => ducky}/auto-coroutine.js (100%) rename tests/{integration => ducky}/boolcast.js (100%) rename tests/{integration => ducky}/coroutine-return.js (77%) rename tests/{integration => ducky}/duck-1.js (100%) rename tests/{integration => ducky}/duck-equality-operator-1.js (100%) rename tests/{integration => ducky}/duck-implicit-bool-1.js (100%) rename tests/{integration => ducky}/duck-implicit-bool-and-with-simple-ref.js (100%) rename tests/{integration => ducky}/duck-implicit-bool-and.js (100%) rename tests/{integration => ducky}/duck-implicit-bool-full.js (100%) rename tests/{integration => ducky}/duck-implicit-bool-simple.js (100%) rename tests/{integration => ducky}/duck-return-property.js (100%) rename tests/{integration => ducky}/duck.js (100%) rename tests/{integration => ducky}/ducktyped-1.js (100%) rename tests/{integration => ducky}/ducktyping-2.js (100%) rename tests/{integration => ducky}/ducktyping-3.js (100%) rename tests/{integration => ducky}/ducktyping.js (100%) rename tests/{integration => ducky}/ducky-1.js (100%) rename tests/{integration => ducky}/ducky_2.js (100%) rename tests/{integration => ducky}/ducky_3.js (100%) rename tests/{integration => ducky}/ducky_4.js (100%) rename tests/{integration => ducky}/ducky_5.js (100%) rename tests/{integration => ducky}/ducky_6.js (100%) rename tests/{integration/implicit_conversion.js => ducky/implicit-conversion.js} (100%) rename tests/{integration/arrays-7.js => ducky/native-array-of-struct-with-struct-loop-update-as-duck.js} (100%) rename tests/{integration/arrays-5.js => ducky/native-array-to-Array-as-duck.js} (100%) rename tests/{integration => ducky}/null-assign.js (100%) rename tests/{integration => ducky}/var-with-no-initializer.js (100%) delete mode 100755 tests/error-messages/pragma-strict-2.js delete mode 100755 tests/error-messages/pragma-strict-3js.js delete mode 100755 tests/error-messages/pragma-strict.js rename tests/error-messages/{conditional-compilation-with-pragma-strict.js => strict-conditional-compilation.js} (52%) rename tests/error-messages/{pragma-strict-disallows-downcast.js => strict-disallows-downcast.js} (56%) create mode 100644 tests/error-messages/strict-disallows-duck-downcast.js create mode 100755 tests/error-messages/strict-disallows-dynamic-dispatching.js create mode 100755 tests/error-messages/strict-disallows-implicit-variable-declaration.js create mode 100755 tests/error-messages/strict-nongeneric-GetComponent.js create mode 100644 tests/integration/float-overload-is-preferred-over-int-for-double-argument-strict-downcast.js rename tests/{integration => pragma}/pragma-expando-1.js (100%) rename tests/{integration => pragma}/pragma-expando-2.js (100%) diff --git a/refresh-tests.boo b/refresh-tests.boo index 777c475..968cd10 100755 --- a/refresh-tests.boo +++ b/refresh-tests.boo @@ -16,18 +16,19 @@ import Boo.Lang.PatternMatching def GetTestCaseName(fname as string): return Path.GetFileNameWithoutExtension(fname).Replace("-", "_") -def WriteTestCases(writer as TextWriter, baseDir as string): - count = 0 - for fname in Directory.GetFiles(baseDir): - continue unless fname.EndsWith(".js") - ++count - categoryAttribute = CategoryAttributeFor(fname) - writer.Write(""" +def WriteTestCases(writer as TextWriter, baseDirs as string*): + for baseDir in baseDirs: + count = 0 + for fname in Directory.GetFiles(baseDir): + continue unless fname.EndsWith(".js") + ++count + categoryAttribute = CategoryAttributeFor(fname) + writer.Write(""" ${categoryAttribute} [Test] def ${GetTestCaseName(fname)}(): RunTestCase("${fname.Replace('\\', '/')}") """) - print("${count} test cases found in ${baseDir}.") + print("${count} test cases found in ${baseDir}.") def CategoryAttributeFor(testFile as string): """ @@ -46,8 +47,8 @@ def FirstLineOf(fname as string): using reader=File.OpenText(fname): return reader.ReadLine() -def GenerateTestFixture(srcDir as string, targetFile as string, header as string): - contents = GenerateTestFixtureSource(srcDir, header) +def GenerateTestFixture(targetFile as string, header as string, *srcDirs as (string)): + contents = GenerateTestFixtureSource(header, srcDirs) if ShouldReplaceContent(targetFile, contents): WriteAllText(targetFile, contents) @@ -69,66 +70,85 @@ Normalize string. """ return s.Trim().Replace("\r\n", Environment.NewLine) -def GenerateTestFixtureSource(srcDir as string, header as string): +def GenerateTestFixtureSource(header as string, srcDirs as (string)): writer=StringWriter() writer.Write(header) - WriteTestCases(writer, srcDir) + WriteTestCases(writer, srcDirs) return writer.ToString() -GenerateTestFixture("tests/parser", "src/UnityScript.Tests/ParserTestFixture.Generated.boo", """ +GenerateTestFixture("src/UnityScript.Tests/ParserTestFixture.Generated.boo", """ namespace UnityScript.Tests import NUnit.Framework partial class ParserTestFixture: -""") +""", "tests/parser") -GenerateTestFixture("tests/semantics", "src/UnityScript.Tests/SemanticsTestFixture.boo", """ +GenerateTestFixture("src/UnityScript.Tests/SemanticsTestFixture.boo", """ namespace UnityScript.Tests import NUnit.Framework [TestFixture] class SemanticsTestFixture(AbstractSemanticsTestFixture): -""") +""", "tests/semantics") -GenerateTestFixture("tests/integration", "src/UnityScript.Tests/IntegrationTestFixture.boo", """ +GenerateTestFixture("src/UnityScript.Tests/StrictIntegrationTestFixture.boo", """ namespace UnityScript.Tests import NUnit.Framework [TestFixture] -class IntegrationTestFixture(AbstractIntegrationTestFixture): -""") +class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): + + override def SetCompilationOptions(): + super() + Parameters.Ducky = false + Parameters.Strict = true -GenerateTestFixture("tests/pragma", "src/UnityScript.Tests/PragmaTestFixture.boo", """ +""", "tests/integration") + +GenerateTestFixture("src/UnityScript.Tests/DuckyIntegrationTestFixture.boo", """ +namespace UnityScript.Tests + +import NUnit.Framework + +[TestFixture] +class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): + override def SetCompilationOptions(): + super() + Parameters.Ducky = true + Parameters.Strict = false +""", "tests/integration", "tests/ducky") + +GenerateTestFixture("src/UnityScript.Tests/PragmaTestFixture.boo", """ namespace UnityScript.Tests import NUnit.Framework [TestFixture] class PragmaTestFixture(AbstractIntegrationTestFixture): -""") +""", "tests/pragma") -GenerateTestFixture("tests/generics", "src/UnityScript.Tests/GenericsTestFixture.Generated.boo", """ +GenerateTestFixture("src/UnityScript.Tests/GenericsTestFixture.Generated.boo", """ namespace UnityScript.Tests import NUnit.Framework [TestFixture] class GenericsTestFixture(AbstractIntegrationTestFixture): -""") +""", "tests/generics") -GenerateTestFixture("tests/eval", "src/UnityScript.Tests/EvalTestFixture.boo", """ +GenerateTestFixture("src/UnityScript.Tests/EvalTestFixture.boo", """ namespace UnityScript.Tests import NUnit.Framework [TestFixture] class EvalTestFixture(AbstractIntegrationTestFixture): -""") +""", "tests/eval") -GenerateTestFixture("tests/expando", "src/UnityScript.Tests/ExpandoTestFixture.boo", """ +GenerateTestFixture("src/UnityScript.Tests/ExpandoTestFixture.boo", """ namespace UnityScript.Tests import NUnit.Framework @@ -136,26 +156,24 @@ import NUnit.Framework [TestFixture] class ExpandoTestFixture(AbstractIntegrationTestFixture): - override def CreateCompiler(): - compiler = super() - compiler.Parameters.Expando = true - return compiler -""") - + override def SetCompilationOptions(): + super() + Parameters.Expando = true +""", "tests/expando") -GenerateTestFixture("tests/error-messages", "src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo", """ +GenerateTestFixture("src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo", """ namespace UnityScript.Tests import NUnit.Framework partial class ErrorMessagesTestFixture: -""") +""", "tests/error-messages") -GenerateTestFixture("tests/stacktrace", "src/UnityScript.Tests/StackTraceTestFixture.Generated.boo", """ +GenerateTestFixture("src/UnityScript.Tests/StackTraceTestFixture.Generated.boo", """ namespace UnityScript.Tests import NUnit.Framework partial class StackTraceTestFixture: -""") +""", "tests/stacktrace") diff --git a/src/UnityScript.Tests/AbstractCompilerTest.boo b/src/UnityScript.Tests/AbstractCompilerTest.boo index 06cc44a..c0d3b97 100644 --- a/src/UnityScript.Tests/AbstractCompilerTest.boo +++ b/src/UnityScript.Tests/AbstractCompilerTest.boo @@ -1,5 +1,6 @@ namespace UnityScript.Tests +import System.IO import NUnit.Framework import UnityScript import Boo.Lang.Compiler @@ -10,14 +11,18 @@ abstract class AbstractCompilerTest: Parameters: get: return _compiler.Parameters + + OutputAssemblyPath: + get: return Path.Combine(Path.Combine(Path.GetTempPath(), "UnityScript"), GetType().Name) [TestFixtureSetUp] virtual def SetUpFixture(): + if Directory.Exists(OutputAssemblyPath): Directory.Delete(OutputAssemblyPath, true) + Directory.CreateDirectory(OutputAssemblyPath) _compiler = CreateCompiler() virtual def CreateCompiler(): compiler = UnityScriptCompiler() - compiler.Parameters.Ducky = true compiler.Parameters.ScriptBaseType = MonoBehaviour compiler.Parameters.ScriptMainMethod = "Awake" compiler.Parameters.Pipeline = CreateCompilerPipeline() @@ -27,10 +32,17 @@ abstract class AbstractCompilerTest: return compiler virtual def CompileTestCase([required] input as ICompilerInput): - Parameters.Input.Clear() + SetCompilationOptions() + Parameters.OutputAssembly = Path.Combine(OutputAssemblyPath, GetType().Name + "-" + Path.GetFileNameWithoutExtension(input.Name) + ".exe") Parameters.Input.Add(input) return _compiler.Run() + virtual def SetCompilationOptions(): + Parameters.Input.Clear() + Parameters.Ducky = true + Parameters.Strict = false + Parameters.Expando = false + protected abstract def CreateCompilerPipeline() as CompilerPipeline: pass diff --git a/src/UnityScript.Tests/AbstractIntegrationTestFixture.boo b/src/UnityScript.Tests/AbstractIntegrationTestFixture.boo index d365a1e..edc8d40 100755 --- a/src/UnityScript.Tests/AbstractIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/AbstractIntegrationTestFixture.boo @@ -13,22 +13,11 @@ class AbstractIntegrationTestFixture(AbstractCompilerTestFixture): override DisplayErrorStackTrace: get: return true - OutputAssemblyPath: - get: return Path.Combine( - Path.Combine(Path.GetTempPath(), "UnityScript"), - GetType().Name) - [TestFixtureSetUp] override def SetUpFixture(): super() - if Directory.Exists(OutputAssemblyPath): Directory.Delete(OutputAssemblyPath, true) - Directory.CreateDirectory(OutputAssemblyPath) CopyReferencedAssemblies() - override def CompileTestCase(fname as string): - _compiler.Parameters.OutputAssembly = Path.Combine(OutputAssemblyPath, GetType().Name.Replace("TestFixture", "") + "-" + Path.GetFileNameWithoutExtension(fname) + ".exe") - return super(fname) - def CopyReferencedAssemblies(): CopyParentAssembly(UnityScriptCompiler) CopyParentAssembly(UnityScript.Lang.Array) diff --git a/src/UnityScript.Tests/IntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo similarity index 83% rename from src/UnityScript.Tests/IntegrationTestFixture.boo rename to src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 06e2d1a..d53d1f1 100644 --- a/src/UnityScript.Tests/IntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -4,7 +4,11 @@ namespace UnityScript.Tests import NUnit.Framework [TestFixture] -class IntegrationTestFixture(AbstractIntegrationTestFixture): +class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): + override def SetCompilationOptions(): + super() + Parameters.Ducky = true + Parameters.Strict = false [Test] def JSCheckFloatToIntOverflow(): @@ -15,10 +19,6 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/JSChooseOverload.js") - [Test] def accessor_2_duck(): - RunTestCase("tests/integration/accessor-2-duck.js") - - [Test] def accessor_2(): RunTestCase("tests/integration/accessor-2.js") @@ -27,18 +27,10 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/accessor-3-duck.js") - [Test] def accessor_duck(): - RunTestCase("tests/integration/accessor-duck.js") - - [Test] def accessor(): RunTestCase("tests/integration/accessor.js") - [Test] def ambigous_call(): - RunTestCase("tests/integration/ambigous-call.js") - - [Test] def anonymous_function_type_1(): RunTestCase("tests/integration/anonymous-function-type-1.js") @@ -59,10 +51,6 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-Remove.js") - [Test] def array_access(): - RunTestCase("tests/integration/array-access.js") - - [Test] def array_cast_2(): RunTestCase("tests/integration/array-cast-2.js") @@ -79,10 +67,6 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-cast-5.js") - [Test] def array_cast_6(): - RunTestCase("tests/integration/array-cast-6.js") - - [Test] def array_cast(): RunTestCase("tests/integration/array-cast.js") @@ -119,10 +103,6 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-instantiation-with-object-argument.js") - [Test] def array_iterate(): - RunTestCase("tests/integration/array-iterate.js") - - [Test] def array_iteration_with_nulls(): RunTestCase("tests/integration/array-iteration-with-nulls.js") @@ -131,10 +111,6 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-join.js") - [Test] def array_length_2(): - RunTestCase("tests/integration/array-length-2.js") - - [Test] def array_length_duck_typed(): RunTestCase("tests/integration/array-length-duck-typed.js") @@ -143,14 +119,6 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-length.js") - [Test] def array_nest_1(): - RunTestCase("tests/integration/array-nest-1.js") - - - [Test] def array_nest_2(): - RunTestCase("tests/integration/array-nest-2.js") - - [Test] def array_polymorphic_foreach(): RunTestCase("tests/integration/array-polymorphic-foreach.js") @@ -163,10 +131,6 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-push-2.js") - [Test] def array_push_typesjs(): - RunTestCase("tests/integration/array-push-typesjs.js") - - [Test] def array_push(): RunTestCase("tests/integration/array-push.js") @@ -203,10 +167,6 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-unshift.js") - [Test] def arrays_10(): - RunTestCase("tests/integration/arrays-10.js") - - [Test] def arrays_2(): RunTestCase("tests/integration/arrays-2.js") @@ -219,22 +179,10 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/arrays-4.js") - [Test] def arrays_5(): - RunTestCase("tests/integration/arrays-5.js") - - [Test] def arrays_6(): RunTestCase("tests/integration/arrays-6.js") - [Test] def arrays_7(): - RunTestCase("tests/integration/arrays-7.js") - - - [Test] def arrays_9(): - RunTestCase("tests/integration/arrays-9.js") - - [Test] def arrays(): RunTestCase("tests/integration/arrays.js") @@ -251,30 +199,14 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/attributes.js") - [Test] def auto_coroutine_2_duck(): - RunTestCase("tests/integration/auto-coroutine-2-duck.js") - - [Test] def auto_coroutine_2(): RunTestCase("tests/integration/auto-coroutine-2.js") - [Test] def auto_coroutine_duck(): - RunTestCase("tests/integration/auto-coroutine-duck.js") - - [Test] def auto_coroutine_return_2(): RunTestCase("tests/integration/auto-coroutine-return-2.js") - [Test] def auto_coroutine(): - RunTestCase("tests/integration/auto-coroutine.js") - - - [Test] def boolcast(): - RunTestCase("tests/integration/boolcast.js") - - [Test] def cast_operator_1(): RunTestCase("tests/integration/cast-operator-1.js") @@ -323,10 +255,6 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/coroutine-return-type-1.js") - [Test] def coroutine_return(): - RunTestCase("tests/integration/coroutine-return.js") - - [Test] def coroutine_try_catch(): RunTestCase("tests/integration/coroutine-try-catch.js") @@ -343,82 +271,6 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/double-precision-can-be-used-for-literals.js") - [Test] def duck_1(): - RunTestCase("tests/integration/duck-1.js") - - - [Test] def duck_equality_operator_1(): - RunTestCase("tests/integration/duck-equality-operator-1.js") - - - [Test] def duck_implicit_bool_1(): - RunTestCase("tests/integration/duck-implicit-bool-1.js") - - - [Test] def duck_implicit_bool_and_with_simple_ref(): - RunTestCase("tests/integration/duck-implicit-bool-and-with-simple-ref.js") - - - [Test] def duck_implicit_bool_and(): - RunTestCase("tests/integration/duck-implicit-bool-and.js") - - - [Test] def duck_implicit_bool_full(): - RunTestCase("tests/integration/duck-implicit-bool-full.js") - - - [Test] def duck_implicit_bool_simple(): - RunTestCase("tests/integration/duck-implicit-bool-simple.js") - - - [Test] def duck_return_property(): - RunTestCase("tests/integration/duck-return-property.js") - - - [Test] def duck(): - RunTestCase("tests/integration/duck.js") - - - [Test] def ducktyped_1(): - RunTestCase("tests/integration/ducktyped-1.js") - - - [Test] def ducktyping_2(): - RunTestCase("tests/integration/ducktyping-2.js") - - - [Test] def ducktyping_3(): - RunTestCase("tests/integration/ducktyping-3.js") - - - [Test] def ducktyping(): - RunTestCase("tests/integration/ducktyping.js") - - - [Test] def ducky_1(): - RunTestCase("tests/integration/ducky-1.js") - - - [Test] def ducky_2(): - RunTestCase("tests/integration/ducky_2.js") - - - [Test] def ducky_3(): - RunTestCase("tests/integration/ducky_3.js") - - - [Test] def ducky_4(): - RunTestCase("tests/integration/ducky_4.js") - - - [Test] def ducky_5(): - RunTestCase("tests/integration/ducky_5.js") - - - [Test] def ducky_6(): - RunTestCase("tests/integration/ducky_6.js") - - [Test] def empty_array_literal_as_return_value(): RunTestCase("tests/integration/empty-array-literal-as-return-value.js") @@ -479,6 +331,10 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument-2.js") + [Test] def float_overload_is_preferred_over_int_for_double_argument_strict_downcast(): + RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument-strict-downcast.js") + + [Test] def float_overload_is_preferred_over_int_for_double_argument_strict(): RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument-strict.js") @@ -519,10 +375,6 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/generator-inheritance.js") - [Test] def implicit_conversion(): - RunTestCase("tests/integration/implicit_conversion.js") - - [Test] def implict_bool_hierarchy(): RunTestCase("tests/integration/implict-bool-hierarchy.js") @@ -563,10 +415,6 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/new-1.js") - [Test] def null_assign(): - RunTestCase("tests/integration/null-assign.js") - - [Test] def null_initializer(): RunTestCase("tests/integration/null-initializer.js") @@ -591,14 +439,6 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/parse_int.js") - [Test] def pragma_expando_1(): - RunTestCase("tests/integration/pragma-expando-1.js") - - - [Test] def pragma_expando_2(): - RunTestCase("tests/integration/pragma-expando-2.js") - - [Test] def private_duck(): RunTestCase("tests/integration/private-duck.js") @@ -687,10 +527,6 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/valuetypes-1.js") - [Test] def var_with_no_initializer(): - RunTestCase("tests/integration/var-with-no-initializer.js") - - [Test] def variable_declaration_2(): RunTestCase("tests/integration/variable-declaration-2.js") @@ -709,4 +545,168 @@ class IntegrationTestFixture(AbstractIntegrationTestFixture): [Test] def virtual_test(): RunTestCase("tests/integration/virtual-test.js") + + + [Test] def Array_cast_to_native_array_of_struct(): + RunTestCase("tests/ducky/Array-cast-to-native-array-of-struct.js") + + + [Test] def Array_length(): + RunTestCase("tests/ducky/Array-length.js") + + + [Test] def Array_of_struct_with_struct_loop_update_as_duck(): + RunTestCase("tests/ducky/Array-of-struct-with-struct-loop-update-as-duck.js") + + + [Test] def Array_of_struct_with_struct_loop_update(): + RunTestCase("tests/ducky/Array-of-struct-with-struct-loop-update.js") + + + [Test] def accessor_2_duck(): + RunTestCase("tests/ducky/accessor-2-duck.js") + + + [Test] def accessor_duck(): + RunTestCase("tests/ducky/accessor-duck.js") + + + [Test] def ambigous_call(): + RunTestCase("tests/ducky/ambigous-call.js") + + + [Test] def array_access(): + RunTestCase("tests/ducky/array-access.js") + + + [Test] def array_iterate(): + RunTestCase("tests/ducky/array-iterate.js") + + + [Test] def array_nest_1(): + RunTestCase("tests/ducky/array-nest-1.js") + + + [Test] def array_nest_2(): + RunTestCase("tests/ducky/array-nest-2.js") + + + [Test] def array_push_typesjs(): + RunTestCase("tests/ducky/array-push-typesjs.js") + + + [Test] def auto_coroutine_2_duck(): + RunTestCase("tests/ducky/auto-coroutine-2-duck.js") + + + [Test] def auto_coroutine_duck(): + RunTestCase("tests/ducky/auto-coroutine-duck.js") + + + [Test] def auto_coroutine(): + RunTestCase("tests/ducky/auto-coroutine.js") + + + [Test] def boolcast(): + RunTestCase("tests/ducky/boolcast.js") + + + [Test] def coroutine_return(): + RunTestCase("tests/ducky/coroutine-return.js") + + + [Test] def duck_1(): + RunTestCase("tests/ducky/duck-1.js") + + + [Test] def duck_equality_operator_1(): + RunTestCase("tests/ducky/duck-equality-operator-1.js") + + + [Test] def duck_implicit_bool_1(): + RunTestCase("tests/ducky/duck-implicit-bool-1.js") + + + [Test] def duck_implicit_bool_and_with_simple_ref(): + RunTestCase("tests/ducky/duck-implicit-bool-and-with-simple-ref.js") + + + [Test] def duck_implicit_bool_and(): + RunTestCase("tests/ducky/duck-implicit-bool-and.js") + + + [Test] def duck_implicit_bool_full(): + RunTestCase("tests/ducky/duck-implicit-bool-full.js") + + + [Test] def duck_implicit_bool_simple(): + RunTestCase("tests/ducky/duck-implicit-bool-simple.js") + + + [Test] def duck_return_property(): + RunTestCase("tests/ducky/duck-return-property.js") + + + [Test] def duck(): + RunTestCase("tests/ducky/duck.js") + + + [Test] def ducktyped_1(): + RunTestCase("tests/ducky/ducktyped-1.js") + + + [Test] def ducktyping_2(): + RunTestCase("tests/ducky/ducktyping-2.js") + + + [Test] def ducktyping_3(): + RunTestCase("tests/ducky/ducktyping-3.js") + + + [Test] def ducktyping(): + RunTestCase("tests/ducky/ducktyping.js") + + + [Test] def ducky_1(): + RunTestCase("tests/ducky/ducky-1.js") + + + [Test] def ducky_2(): + RunTestCase("tests/ducky/ducky_2.js") + + + [Test] def ducky_3(): + RunTestCase("tests/ducky/ducky_3.js") + + + [Test] def ducky_4(): + RunTestCase("tests/ducky/ducky_4.js") + + + [Test] def ducky_5(): + RunTestCase("tests/ducky/ducky_5.js") + + + [Test] def ducky_6(): + RunTestCase("tests/ducky/ducky_6.js") + + + [Test] def implicit_conversion(): + RunTestCase("tests/ducky/implicit-conversion.js") + + + [Test] def native_array_of_struct_with_struct_loop_update_as_duck(): + RunTestCase("tests/ducky/native-array-of-struct-with-struct-loop-update-as-duck.js") + + + [Test] def native_array_to_Array_as_duck(): + RunTestCase("tests/ducky/native-array-to-Array-as-duck.js") + + + [Test] def null_assign(): + RunTestCase("tests/ducky/null-assign.js") + + + [Test] def var_with_no_initializer(): + RunTestCase("tests/ducky/var-with-no-initializer.js") \ No newline at end of file diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index 82c106f..d137939 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -26,10 +26,6 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/cannot-convert-error.js") - [Test] def conditional_compilation_with_pragma_strict(): - RunTestCase("tests/error-messages/conditional-compilation-with-pragma-strict.js") - - [Test] def double_array_in_float_array_var_initializer(): RunTestCase("tests/error-messages/double-array-in-float-array-var-initializer.js") @@ -98,22 +94,6 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/overeager-semicolon2.js") - [Test] def pragma_strict_2(): - RunTestCase("tests/error-messages/pragma-strict-2.js") - - - [Test] def pragma_strict_3js(): - RunTestCase("tests/error-messages/pragma-strict-3js.js") - - - [Test] def pragma_strict_disallows_downcast(): - RunTestCase("tests/error-messages/pragma-strict-disallows-downcast.js") - - - [Test] def pragma_strict(): - RunTestCase("tests/error-messages/pragma-strict.js") - - [Test] def rethrow_outside_catch(): RunTestCase("tests/error-messages/rethrow-outside-catch.js") @@ -130,6 +110,30 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/static-instance-overload-resolution.js") + [Test] def strict_conditional_compilation(): + RunTestCase("tests/error-messages/strict-conditional-compilation.js") + + + [Test] def strict_disallows_downcast(): + RunTestCase("tests/error-messages/strict-disallows-downcast.js") + + + [Test] def strict_disallows_duck_downcast(): + RunTestCase("tests/error-messages/strict-disallows-duck-downcast.js") + + + [Test] def strict_disallows_dynamic_dispatching(): + RunTestCase("tests/error-messages/strict-disallows-dynamic-dispatching.js") + + + [Test] def strict_disallows_implicit_variable_declaration(): + RunTestCase("tests/error-messages/strict-disallows-implicit-variable-declaration.js") + + + [Test] def strict_nongeneric_GetComponent(): + RunTestCase("tests/error-messages/strict-nongeneric-GetComponent.js") + + [Test] def unused_variable(): RunTestCase("tests/error-messages/unused-variable.js") diff --git a/src/UnityScript.Tests/EvalCompilationTest.boo b/src/UnityScript.Tests/EvalCompilationTest.boo index b135ac5..ab0538c 100644 --- a/src/UnityScript.Tests/EvalCompilationTest.boo +++ b/src/UnityScript.Tests/EvalCompilationTest.boo @@ -1,7 +1,6 @@ namespace UnityScript.Tests import System -import System.IO import System.Reflection import NUnit.Framework @@ -28,18 +27,19 @@ class EvalCompilationTest(AbstractCompilerTest): expected = ("Boo.Lang", "mscorlib", "UnityScript", "UnityScript.Tests") code = """ - var l: Boo.Lang.List.; + var foo = new Boo.Lang.List.(); eval("print(\"hello\")"); """ AssertAssemblyReferencesForEval expected, code def AssertAssemblyReferencesForEval(expected as (string), code as string): - Parameters.OutputAssembly = Path.GetTempFileName() + ".dll" - result = CompileTestCase(StringInput("code.js", code)) + result = CompileTestCase(StringInput("t$(++_testId).js", code)) assert len(result.Errors) == 0, result.Errors.ToString() actual = array(assemblyName.Name for assemblyName in Assembly.LoadFrom(Parameters.OutputAssembly).GetReferencedAssemblies()) Array.Sort(actual) Assert.AreEqual(expected, actual) + _testId = 0 + diff --git a/src/UnityScript.Tests/ExpandoTestFixture.boo b/src/UnityScript.Tests/ExpandoTestFixture.boo index 30a7f72..5ac1eb1 100755 --- a/src/UnityScript.Tests/ExpandoTestFixture.boo +++ b/src/UnityScript.Tests/ExpandoTestFixture.boo @@ -6,10 +6,9 @@ import NUnit.Framework [TestFixture] class ExpandoTestFixture(AbstractIntegrationTestFixture): - override def CreateCompiler(): - compiler = super() - compiler.Parameters.Expando = true - return compiler + override def SetCompilationOptions(): + super() + Parameters.Expando = true [Test] def expando_1(): diff --git a/src/UnityScript.Tests/PragmaTestFixture.boo b/src/UnityScript.Tests/PragmaTestFixture.boo index 08a03ef..3189bfc 100644 --- a/src/UnityScript.Tests/PragmaTestFixture.boo +++ b/src/UnityScript.Tests/PragmaTestFixture.boo @@ -21,4 +21,12 @@ class PragmaTestFixture(AbstractIntegrationTestFixture): [Test] def implicit_plus_strict(): RunTestCase("tests/pragma/implicit-plus-strict.js") + + + [Test] def pragma_expando_1(): + RunTestCase("tests/pragma/pragma-expando-1.js") + + + [Test] def pragma_expando_2(): + RunTestCase("tests/pragma/pragma-expando-2.js") \ No newline at end of file diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo new file mode 100644 index 0000000..3bfebbe --- /dev/null +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -0,0 +1,550 @@ + +namespace UnityScript.Tests + +import NUnit.Framework + +[TestFixture] +class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): + + override def SetCompilationOptions(): + super() + Parameters.Ducky = false + Parameters.Strict = true + + + + [Test] def JSCheckFloatToIntOverflow(): + RunTestCase("tests/integration/JSCheckFloatToIntOverflow.js") + + + [Test] def JSChooseOverload(): + RunTestCase("tests/integration/JSChooseOverload.js") + + + [Test] def accessor_2(): + RunTestCase("tests/integration/accessor-2.js") + + + [Test] def accessor_3_duck(): + RunTestCase("tests/integration/accessor-3-duck.js") + + + [Test] def accessor(): + RunTestCase("tests/integration/accessor.js") + + + [Test] def anonymous_function_type_1(): + RunTestCase("tests/integration/anonymous-function-type-1.js") + + + [Test] def anonymous_function_type_2(): + RunTestCase("tests/integration/anonymous-function-type-2.js") + + + [Test] def anonymous_function_type_3(): + RunTestCase("tests/integration/anonymous-function-type-3.js") + + + [Test] def array_Add(): + RunTestCase("tests/integration/array-Add.js") + + + [Test] def array_Remove(): + RunTestCase("tests/integration/array-Remove.js") + + + [Test] def array_cast_2(): + RunTestCase("tests/integration/array-cast-2.js") + + + [Test] def array_cast_3(): + RunTestCase("tests/integration/array-cast-3.js") + + + [Test] def array_cast_4(): + RunTestCase("tests/integration/array-cast-4.js") + + + [Test] def array_cast_5(): + RunTestCase("tests/integration/array-cast-5.js") + + + [Test] def array_cast(): + RunTestCase("tests/integration/array-cast.js") + + + [Test] def array_concat_1(): + RunTestCase("tests/integration/array-concat-1.js") + + + [Test] def array_concat_2(): + RunTestCase("tests/integration/array-concat-2.js") + + + [Test] def array_create(): + RunTestCase("tests/integration/array-create.js") + + + [Test] def array_ctor_with_single_null_element(): + RunTestCase("tests/integration/array-ctor-with-single-null-element.js") + + + [Test] def array_implicit_from_null_enumerable(): + RunTestCase("tests/integration/array-implicit-from-null-enumerable.js") + + + [Test] def array_implicit_from_null(): + RunTestCase("tests/integration/array-implicit-from-null.js") + + + [Test] def array_instantiation_with_object_argument_in_strict_mode(): + RunTestCase("tests/integration/array-instantiation-with-object-argument-in-strict-mode.js") + + + [Test] def array_instantiation_with_object_argument(): + RunTestCase("tests/integration/array-instantiation-with-object-argument.js") + + + [Test] def array_iteration_with_nulls(): + RunTestCase("tests/integration/array-iteration-with-nulls.js") + + + [Test] def array_join(): + RunTestCase("tests/integration/array-join.js") + + + [Test] def array_length_duck_typed(): + RunTestCase("tests/integration/array-length-duck-typed.js") + + + [Test] def array_length(): + RunTestCase("tests/integration/array-length.js") + + + [Test] def array_polymorphic_foreach(): + RunTestCase("tests/integration/array-polymorphic-foreach.js") + + + [Test] def array_pop(): + RunTestCase("tests/integration/array-pop.js") + + + [Test] def array_push_2(): + RunTestCase("tests/integration/array-push-2.js") + + + [Test] def array_push(): + RunTestCase("tests/integration/array-push.js") + + + [Test] def array_shift(): + RunTestCase("tests/integration/array-shift.js") + + + [Test] def array_slice(): + RunTestCase("tests/integration/array-slice.js") + + + [Test] def array_sort(): + RunTestCase("tests/integration/array-sort.js") + + + [Test] def array_splice_2(): + RunTestCase("tests/integration/array-splice-2.js") + + + [Test] def array_splice(): + RunTestCase("tests/integration/array-splice.js") + + + [Test] def array_str(): + RunTestCase("tests/integration/array-str.js") + + + [Test] def array_toString(): + RunTestCase("tests/integration/array-toString.js") + + + [Test] def array_unshift(): + RunTestCase("tests/integration/array-unshift.js") + + + [Test] def arrays_2(): + RunTestCase("tests/integration/arrays-2.js") + + + [Test] def arrays_3(): + RunTestCase("tests/integration/arrays-3.js") + + + [Test] def arrays_4(): + RunTestCase("tests/integration/arrays-4.js") + + + [Test] def arrays_6(): + RunTestCase("tests/integration/arrays-6.js") + + + [Test] def arrays(): + RunTestCase("tests/integration/arrays.js") + + + [Test] def assign_iterator(): + RunTestCase("tests/integration/assign_iterator.js") + + + [Test] def attributes_2(): + RunTestCase("tests/integration/attributes-2.js") + + + [Test] def attributes(): + RunTestCase("tests/integration/attributes.js") + + + [Test] def auto_coroutine_2(): + RunTestCase("tests/integration/auto-coroutine-2.js") + + + [Test] def auto_coroutine_return_2(): + RunTestCase("tests/integration/auto-coroutine-return-2.js") + + + [Test] def cast_operator_1(): + RunTestCase("tests/integration/cast-operator-1.js") + + + [Test] def cast_operator_precedence(): + RunTestCase("tests/integration/cast-operator-precedence.js") + + + [Test] def chars(): + RunTestCase("tests/integration/chars.js") + + + [Test] def comma_parsing(): + RunTestCase("tests/integration/comma-parsing.js") + + + [Test] def constructor_1(): + RunTestCase("tests/integration/constructor-1.js") + + + [Test] def constructor_2(): + RunTestCase("tests/integration/constructor_2.js") + + + [Test] def continue_issue(): + RunTestCase("tests/integration/continue-issue.js") + + + [Test] def coroutine_2(): + RunTestCase("tests/integration/coroutine-2.js") + + + [Test] def coroutine_3(): + RunTestCase("tests/integration/coroutine-3.js") + + + [Test] def coroutine_4(): + RunTestCase("tests/integration/coroutine-4.js") + + + [Test] def coroutine_5(): + RunTestCase("tests/integration/coroutine-5.js") + + + [Test] def coroutine_return_type_1(): + RunTestCase("tests/integration/coroutine-return-type-1.js") + + + [Test] def coroutine_try_catch(): + RunTestCase("tests/integration/coroutine-try-catch.js") + + + [Test] def coroutine(): + RunTestCase("tests/integration/coroutine.js") + + + [Test] def crash(): + RunTestCase("tests/integration/crash.js") + + + [Test] def double_precision_can_be_used_for_literals(): + RunTestCase("tests/integration/double-precision-can-be-used-for-literals.js") + + + [Test] def empty_array_literal_as_return_value(): + RunTestCase("tests/integration/empty-array-literal-as-return-value.js") + + + [Test] def empty_array_literal_as_yield_value(): + RunTestCase("tests/integration/empty-array-literal-as-yield-value.js") + + + [Test] def empty_string_array(): + RunTestCase("tests/integration/empty-string-array.js") + + + [Test] def enum_1(): + RunTestCase("tests/integration/enum-1.js") + + + [Test] def enum_2(): + RunTestCase("tests/integration/enum-2.js") + + + [Test] def enum_3(): + RunTestCase("tests/integration/enum-3.js") + + + [Test] def enum_4(): + RunTestCase("tests/integration/enum-4.js") + + + [Test] def enum_5(): + RunTestCase("tests/integration/enum-5.js") + + + [Test] def enum_conversion(): + RunTestCase("tests/integration/enum-conversion.js") + + + [Test] def enumerator_array(): + RunTestCase("tests/integration/enumerator-array.js") + + + [Test] def explicit_awake_function(): + RunTestCase("tests/integration/explicit-awake-function.js") + + + [Test] def float_1(): + RunTestCase("tests/integration/float-1.js") + + + [Test] def float_2(): + RunTestCase("tests/integration/float-2.js") + + + [Test] def float_array_literal(): + RunTestCase("tests/integration/float-array-literal.js") + + + [Test] def float_overload_is_preferred_over_int_for_double_argument_2(): + RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument-2.js") + + + [Test] def float_overload_is_preferred_over_int_for_double_argument_strict_downcast(): + RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument-strict-downcast.js") + + + [Test] def float_overload_is_preferred_over_int_for_double_argument_strict(): + RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument-strict.js") + + + [Test] def float_overload_is_preferred_over_int_for_double_argument(): + RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument.js") + + + [Test] def for_break_1(): + RunTestCase("tests/integration/for-break-1.js") + + + [Test] def for_continue_1(): + RunTestCase("tests/integration/for-continue-1.js") + + + [Test] def for_continue_2(): + RunTestCase("tests/integration/for-continue-2.js") + + + [Test] def for_over_null(): + RunTestCase("tests/integration/for-over-null.js") + + + [Test] def functions_1(): + RunTestCase("tests/integration/functions-1.js") + + + [Test] def generator_inheritance_calling_super(): + RunTestCase("tests/integration/generator-inheritance-calling-super.js") + + + [Test] def generator_inheritance_yielding_super(): + RunTestCase("tests/integration/generator-inheritance-yielding-super.js") + + + [Test] def generator_inheritance(): + RunTestCase("tests/integration/generator-inheritance.js") + + + [Test] def implict_bool_hierarchy(): + RunTestCase("tests/integration/implict-bool-hierarchy.js") + + + [Test] def initializeorder(): + RunTestCase("tests/integration/initializeorder.js") + + + [Test] def interfaces_1(): + RunTestCase("tests/integration/interfaces-1.js") + + + [Test] def invalidil(): + RunTestCase("tests/integration/invalidil.js") + + + [Test] def length_string(): + RunTestCase("tests/integration/length-string.js") + + + [Test] def magicclass(): + RunTestCase("tests/integration/magicclass.js") + + + [Test] def magicconstructor(): + RunTestCase("tests/integration/magicconstructor.js") + + + [Test] def magicconstructor_2(): + RunTestCase("tests/integration/magicconstructor_2.js") + + + [Test] def nested_class_1(): + RunTestCase("tests/integration/nested-class-1.js") + + + [Test] def new_1(): + RunTestCase("tests/integration/new-1.js") + + + [Test] def null_initializer(): + RunTestCase("tests/integration/null-initializer.js") + + + [Test] def operators_4(): + RunTestCase("tests/integration/operators-4.js") + + + [Test] def operators_5(): + RunTestCase("tests/integration/operators-5.js") + + + [Test] def override_1(): + RunTestCase("tests/integration/override-1.js") + + + [Test] def param_test(): + RunTestCase("tests/integration/param_test.js") + + + [Test] def parse_int(): + RunTestCase("tests/integration/parse_int.js") + + + [Test] def private_duck(): + RunTestCase("tests/integration/private-duck.js") + + + [Test] def properties(): + RunTestCase("tests/integration/properties.js") + + + [Test] def question_mark(): + RunTestCase("tests/integration/question_mark.js") + + + [Test] def raw_array_indexing(): + RunTestCase("tests/integration/raw-array-indexing.js") + + + [Test] def rethrow(): + RunTestCase("tests/integration/rethrow.js") + + + [Test] def script_attributes(): + RunTestCase("tests/integration/script-attributes.js") + + + [Test] def shift_left_bitwise_or(): + RunTestCase("tests/integration/shift-left-bitwise-or.js") + + + [Test] def static_instance_overload_resolution(): + RunTestCase("tests/integration/static-instance-overload-resolution.js") + + + [Test] def string_append(): + RunTestCase("tests/integration/string-append.js") + + + [Test] def string_concat(): + RunTestCase("tests/integration/string-concat.js") + + + [Test] def switch_3(): + RunTestCase("tests/integration/switch-3.js") + + + [Test] def switch_fallthrough(): + RunTestCase("tests/integration/switch-fallthrough.js") + + + [Test] def switch_simple_2(): + RunTestCase("tests/integration/switch-simple-2.js") + + + [Test] def switch_simple(): + RunTestCase("tests/integration/switch-simple.js") + + + [Test] def switch_with_loop(): + RunTestCase("tests/integration/switch-with-loop.js") + + + [Test] def switch(): + RunTestCase("tests/integration/switch.js") + + + [Test] def transform_collider_bounds(): + RunTestCase("tests/integration/transform-collider-bounds.js") + + + [Test] def typecast_1(): + RunTestCase("tests/integration/typecast-1.js") + + + [Test] def typeof_1(): + RunTestCase("tests/integration/typeof-1.js") + + + [Test] def types_1(): + RunTestCase("tests/integration/types-1.js") + + + [Test] def uint_1(): + RunTestCase("tests/integration/uint-1.js") + + + [Test] def valuetypes_1(): + RunTestCase("tests/integration/valuetypes-1.js") + + + [Test] def variable_declaration_2(): + RunTestCase("tests/integration/variable-declaration-2.js") + + + [Test] def variable_declaration(): + RunTestCase("tests/integration/variable-declaration.js") + + + [Test] def variables(): + RunTestCase("tests/integration/variables.js") + + + [Test] def vars_1(): + RunTestCase("tests/integration/vars-1.js") + + + [Test] def virtual_test(): + RunTestCase("tests/integration/virtual-test.js") + \ No newline at end of file diff --git a/src/UnityScript.Tests/UnityScript.Tests.booproj b/src/UnityScript.Tests/UnityScript.Tests.booproj index 28e7191..983e142 100755 --- a/src/UnityScript.Tests/UnityScript.Tests.booproj +++ b/src/UnityScript.Tests/UnityScript.Tests.booproj @@ -52,7 +52,6 @@ - @@ -69,6 +68,8 @@ + + diff --git a/tests/integration/array-cast-6.js b/tests/ducky/Array-cast-to-native-array-of-struct.js similarity index 100% rename from tests/integration/array-cast-6.js rename to tests/ducky/Array-cast-to-native-array-of-struct.js diff --git a/tests/integration/array-length-2.js b/tests/ducky/Array-length.js similarity index 100% rename from tests/integration/array-length-2.js rename to tests/ducky/Array-length.js diff --git a/tests/integration/arrays-9.js b/tests/ducky/Array-of-struct-with-struct-loop-update-as-duck.js similarity index 100% rename from tests/integration/arrays-9.js rename to tests/ducky/Array-of-struct-with-struct-loop-update-as-duck.js diff --git a/tests/integration/arrays-10.js b/tests/ducky/Array-of-struct-with-struct-loop-update.js similarity index 100% rename from tests/integration/arrays-10.js rename to tests/ducky/Array-of-struct-with-struct-loop-update.js diff --git a/tests/integration/accessor-2-duck.js b/tests/ducky/accessor-2-duck.js similarity index 100% rename from tests/integration/accessor-2-duck.js rename to tests/ducky/accessor-2-duck.js diff --git a/tests/integration/accessor-duck.js b/tests/ducky/accessor-duck.js similarity index 100% rename from tests/integration/accessor-duck.js rename to tests/ducky/accessor-duck.js diff --git a/tests/integration/ambigous-call.js b/tests/ducky/ambigous-call.js similarity index 100% rename from tests/integration/ambigous-call.js rename to tests/ducky/ambigous-call.js diff --git a/tests/integration/array-access.js b/tests/ducky/array-access.js similarity index 100% rename from tests/integration/array-access.js rename to tests/ducky/array-access.js diff --git a/tests/integration/array-iterate.js b/tests/ducky/array-iterate.js similarity index 100% rename from tests/integration/array-iterate.js rename to tests/ducky/array-iterate.js diff --git a/tests/integration/array-nest-1.js b/tests/ducky/array-nest-1.js similarity index 100% rename from tests/integration/array-nest-1.js rename to tests/ducky/array-nest-1.js diff --git a/tests/integration/array-nest-2.js b/tests/ducky/array-nest-2.js similarity index 100% rename from tests/integration/array-nest-2.js rename to tests/ducky/array-nest-2.js diff --git a/tests/integration/array-push-typesjs.js b/tests/ducky/array-push-typesjs.js similarity index 100% rename from tests/integration/array-push-typesjs.js rename to tests/ducky/array-push-typesjs.js diff --git a/tests/integration/auto-coroutine-2-duck.js b/tests/ducky/auto-coroutine-2-duck.js similarity index 100% rename from tests/integration/auto-coroutine-2-duck.js rename to tests/ducky/auto-coroutine-2-duck.js diff --git a/tests/integration/auto-coroutine-duck.js b/tests/ducky/auto-coroutine-duck.js similarity index 100% rename from tests/integration/auto-coroutine-duck.js rename to tests/ducky/auto-coroutine-duck.js diff --git a/tests/integration/auto-coroutine.js b/tests/ducky/auto-coroutine.js similarity index 100% rename from tests/integration/auto-coroutine.js rename to tests/ducky/auto-coroutine.js diff --git a/tests/integration/boolcast.js b/tests/ducky/boolcast.js similarity index 100% rename from tests/integration/boolcast.js rename to tests/ducky/boolcast.js diff --git a/tests/integration/coroutine-return.js b/tests/ducky/coroutine-return.js similarity index 77% rename from tests/integration/coroutine-return.js rename to tests/ducky/coroutine-return.js index 53bf072..ebf751b 100755 --- a/tests/integration/coroutine-return.js +++ b/tests/ducky/coroutine-return.js @@ -1,7 +1,6 @@ /* test */ -// Duck typed objects return Coroutine instead of string var shipType = "test"; Test(); diff --git a/tests/integration/duck-1.js b/tests/ducky/duck-1.js similarity index 100% rename from tests/integration/duck-1.js rename to tests/ducky/duck-1.js diff --git a/tests/integration/duck-equality-operator-1.js b/tests/ducky/duck-equality-operator-1.js similarity index 100% rename from tests/integration/duck-equality-operator-1.js rename to tests/ducky/duck-equality-operator-1.js diff --git a/tests/integration/duck-implicit-bool-1.js b/tests/ducky/duck-implicit-bool-1.js similarity index 100% rename from tests/integration/duck-implicit-bool-1.js rename to tests/ducky/duck-implicit-bool-1.js diff --git a/tests/integration/duck-implicit-bool-and-with-simple-ref.js b/tests/ducky/duck-implicit-bool-and-with-simple-ref.js similarity index 100% rename from tests/integration/duck-implicit-bool-and-with-simple-ref.js rename to tests/ducky/duck-implicit-bool-and-with-simple-ref.js diff --git a/tests/integration/duck-implicit-bool-and.js b/tests/ducky/duck-implicit-bool-and.js similarity index 100% rename from tests/integration/duck-implicit-bool-and.js rename to tests/ducky/duck-implicit-bool-and.js diff --git a/tests/integration/duck-implicit-bool-full.js b/tests/ducky/duck-implicit-bool-full.js similarity index 100% rename from tests/integration/duck-implicit-bool-full.js rename to tests/ducky/duck-implicit-bool-full.js diff --git a/tests/integration/duck-implicit-bool-simple.js b/tests/ducky/duck-implicit-bool-simple.js similarity index 100% rename from tests/integration/duck-implicit-bool-simple.js rename to tests/ducky/duck-implicit-bool-simple.js diff --git a/tests/integration/duck-return-property.js b/tests/ducky/duck-return-property.js similarity index 100% rename from tests/integration/duck-return-property.js rename to tests/ducky/duck-return-property.js diff --git a/tests/integration/duck.js b/tests/ducky/duck.js similarity index 100% rename from tests/integration/duck.js rename to tests/ducky/duck.js diff --git a/tests/integration/ducktyped-1.js b/tests/ducky/ducktyped-1.js similarity index 100% rename from tests/integration/ducktyped-1.js rename to tests/ducky/ducktyped-1.js diff --git a/tests/integration/ducktyping-2.js b/tests/ducky/ducktyping-2.js similarity index 100% rename from tests/integration/ducktyping-2.js rename to tests/ducky/ducktyping-2.js diff --git a/tests/integration/ducktyping-3.js b/tests/ducky/ducktyping-3.js similarity index 100% rename from tests/integration/ducktyping-3.js rename to tests/ducky/ducktyping-3.js diff --git a/tests/integration/ducktyping.js b/tests/ducky/ducktyping.js similarity index 100% rename from tests/integration/ducktyping.js rename to tests/ducky/ducktyping.js diff --git a/tests/integration/ducky-1.js b/tests/ducky/ducky-1.js similarity index 100% rename from tests/integration/ducky-1.js rename to tests/ducky/ducky-1.js diff --git a/tests/integration/ducky_2.js b/tests/ducky/ducky_2.js similarity index 100% rename from tests/integration/ducky_2.js rename to tests/ducky/ducky_2.js diff --git a/tests/integration/ducky_3.js b/tests/ducky/ducky_3.js similarity index 100% rename from tests/integration/ducky_3.js rename to tests/ducky/ducky_3.js diff --git a/tests/integration/ducky_4.js b/tests/ducky/ducky_4.js similarity index 100% rename from tests/integration/ducky_4.js rename to tests/ducky/ducky_4.js diff --git a/tests/integration/ducky_5.js b/tests/ducky/ducky_5.js similarity index 100% rename from tests/integration/ducky_5.js rename to tests/ducky/ducky_5.js diff --git a/tests/integration/ducky_6.js b/tests/ducky/ducky_6.js similarity index 100% rename from tests/integration/ducky_6.js rename to tests/ducky/ducky_6.js diff --git a/tests/integration/implicit_conversion.js b/tests/ducky/implicit-conversion.js similarity index 100% rename from tests/integration/implicit_conversion.js rename to tests/ducky/implicit-conversion.js diff --git a/tests/integration/arrays-7.js b/tests/ducky/native-array-of-struct-with-struct-loop-update-as-duck.js similarity index 100% rename from tests/integration/arrays-7.js rename to tests/ducky/native-array-of-struct-with-struct-loop-update-as-duck.js diff --git a/tests/integration/arrays-5.js b/tests/ducky/native-array-to-Array-as-duck.js similarity index 100% rename from tests/integration/arrays-5.js rename to tests/ducky/native-array-to-Array-as-duck.js diff --git a/tests/integration/null-assign.js b/tests/ducky/null-assign.js similarity index 100% rename from tests/integration/null-assign.js rename to tests/ducky/null-assign.js diff --git a/tests/integration/var-with-no-initializer.js b/tests/ducky/var-with-no-initializer.js similarity index 100% rename from tests/integration/var-with-no-initializer.js rename to tests/ducky/var-with-no-initializer.js diff --git a/tests/error-messages/double-array-in-float-array-var-initializer.js b/tests/error-messages/double-array-in-float-array-var-initializer.js index 9100f30..97bba78 100644 --- a/tests/error-messages/double-array-in-float-array-var-initializer.js +++ b/tests/error-messages/double-array-in-float-array-var-initializer.js @@ -1,5 +1,5 @@ /* double-array-in-float-array-var-initializer.js(4,22): BCE0022: Cannot convert 'double[]' to 'float[]'. */ -var floats:float[] = [1.0, 0.7 /* 0.7 inferred as double for precision */]; +var floats:float[] = [1.0, 0.7d]; diff --git a/tests/error-messages/pragma-strict-2.js b/tests/error-messages/pragma-strict-2.js deleted file mode 100755 index 116b259..0000000 --- a/tests/error-messages/pragma-strict-2.js +++ /dev/null @@ -1,7 +0,0 @@ -/* -pragma-strict-2.js(7,5): BCE0019: 'Foo' is not a member of 'UnityScript.Tests.Component'. -*/ -#pragma strict - -var com = GetComponent(UnityScript.Tests.ComponentFoo); -com.Foo(); \ No newline at end of file diff --git a/tests/error-messages/pragma-strict-3js.js b/tests/error-messages/pragma-strict-3js.js deleted file mode 100755 index 1005cea..0000000 --- a/tests/error-messages/pragma-strict-3js.js +++ /dev/null @@ -1,11 +0,0 @@ -/* -pragma-strict-3js.js(9,5): BCE0005: Unknown identifier: 'test1'. -pragma-strict-3js.js(10,11): BCE0005: Unknown identifier: 'test1'. -*/ -#pragma strict - -function Start() -{ - test1 = true; - print(test1); -} \ No newline at end of file diff --git a/tests/error-messages/pragma-strict.js b/tests/error-messages/pragma-strict.js deleted file mode 100755 index fc78da2..0000000 --- a/tests/error-messages/pragma-strict.js +++ /dev/null @@ -1,8 +0,0 @@ -/* -pragma-strict.js(7,9): BCE0019: 'ToUpper' is not a member of 'Object'. -*/ -#pragma strict - -var o : Object; -print(o.ToUpper()); - diff --git a/tests/error-messages/conditional-compilation-with-pragma-strict.js b/tests/error-messages/strict-conditional-compilation.js similarity index 52% rename from tests/error-messages/conditional-compilation-with-pragma-strict.js rename to tests/error-messages/strict-conditional-compilation.js index 21a305b..48fd25a 100755 --- a/tests/error-messages/conditional-compilation-with-pragma-strict.js +++ b/tests/error-messages/strict-conditional-compilation.js @@ -1,5 +1,5 @@ /* -conditional-compilation-with-pragma-strict.js(11,5): BCE0019: 'Foo' is not a member of 'UnityScript.Tests.Component'. +strict-conditional-compilation.js(11,5): BCE0019: 'Foo' is not a member of 'UnityScript.Tests.Component'. */ #pragma strict diff --git a/tests/error-messages/pragma-strict-disallows-downcast.js b/tests/error-messages/strict-disallows-downcast.js similarity index 56% rename from tests/error-messages/pragma-strict-disallows-downcast.js rename to tests/error-messages/strict-disallows-downcast.js index 68501f3..00bfb19 100644 --- a/tests/error-messages/pragma-strict-disallows-downcast.js +++ b/tests/error-messages/strict-disallows-downcast.js @@ -1,5 +1,5 @@ /* -pragma-strict-disallows-downcast.js(13,15): BCE0022: Cannot convert 'Foo' to 'Bar'. +strict-disallows-downcast.js(13,15): BCE0022: Cannot convert 'Foo' to 'Bar'. */ #pragma strict diff --git a/tests/error-messages/strict-disallows-duck-downcast.js b/tests/error-messages/strict-disallows-duck-downcast.js new file mode 100644 index 0000000..c141613 --- /dev/null +++ b/tests/error-messages/strict-disallows-duck-downcast.js @@ -0,0 +1,10 @@ +/* +strict-disallows-duck-downcast.js(9,5): BCE0022: Cannot convert 'Object' to 'String'. +*/ + +#pragma strict + +var duck; +var s : String; +s = duck; +print(s); diff --git a/tests/error-messages/strict-disallows-dynamic-dispatching.js b/tests/error-messages/strict-disallows-dynamic-dispatching.js new file mode 100755 index 0000000..7d5b4ce --- /dev/null +++ b/tests/error-messages/strict-disallows-dynamic-dispatching.js @@ -0,0 +1,8 @@ +/* +strict-disallows-dynamic-dispatching.js(7,9): BCE0019: 'ToUpper' is not a member of 'Object'. +*/ +#pragma strict + +var o : Object; +print(o.ToUpper()); + diff --git a/tests/error-messages/strict-disallows-implicit-variable-declaration.js b/tests/error-messages/strict-disallows-implicit-variable-declaration.js new file mode 100755 index 0000000..82560bb --- /dev/null +++ b/tests/error-messages/strict-disallows-implicit-variable-declaration.js @@ -0,0 +1,11 @@ +/* +strict-disallows-implicit-variable-declaration.js(9,5): BCE0005: Unknown identifier: 'test1'. +strict-disallows-implicit-variable-declaration.js(10,11): BCE0005: Unknown identifier: 'test1'. +*/ +#pragma strict + +function Start() +{ + test1 = true; + print(test1); +} \ No newline at end of file diff --git a/tests/error-messages/strict-nongeneric-GetComponent.js b/tests/error-messages/strict-nongeneric-GetComponent.js new file mode 100755 index 0000000..4f5358a --- /dev/null +++ b/tests/error-messages/strict-nongeneric-GetComponent.js @@ -0,0 +1,7 @@ +/* +strict-nongeneric-GetComponent.js(7,5): BCE0019: 'Foo' is not a member of 'UnityScript.Tests.Component'. +*/ +#pragma strict + +var com = GetComponent(UnityScript.Tests.ComponentFoo); +com.Foo(); \ No newline at end of file diff --git a/tests/integration/float-overload-is-preferred-over-int-for-double-argument-strict-downcast.js b/tests/integration/float-overload-is-preferred-over-int-for-double-argument-strict-downcast.js new file mode 100644 index 0000000..fa88e6e --- /dev/null +++ b/tests/integration/float-overload-is-preferred-over-int-for-double-argument-strict-downcast.js @@ -0,0 +1,10 @@ +/* +F(float, float) +*/ + +#pragma strict +#pragma downcast + +function F(a:float, b:float) { print("F(float, float)"); } +function F(a:int, b:int) {} +F(0.16, 0.19); diff --git a/tests/integration/null-initializer.js b/tests/integration/null-initializer.js index 0f30bfc..49944ac 100644 --- a/tests/integration/null-initializer.js +++ b/tests/integration/null-initializer.js @@ -1,10 +1,10 @@ /* -0 +System.Object[] */ function run() { var obj = null; obj = new Object[0]; - print(obj.length); + print(obj.GetType()); } run(); diff --git a/tests/integration/pragma-expando-1.js b/tests/pragma/pragma-expando-1.js similarity index 100% rename from tests/integration/pragma-expando-1.js rename to tests/pragma/pragma-expando-1.js diff --git a/tests/integration/pragma-expando-2.js b/tests/pragma/pragma-expando-2.js similarity index 100% rename from tests/integration/pragma-expando-2.js rename to tests/pragma/pragma-expando-2.js From 0a01a3c67afe6b4dd0d91b0edabd123b175f8fa8 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 18 Aug 2010 01:48:36 -0300 Subject: [PATCH 075/276] revert to old behavior of always considering unspecified floating point literals as of float precision; introduce 'd' suffix for double precision literals; --- src/UnityScript/Parser/CodeFactory.boo | 8 ++++---- src/UnityScript/Parser/UnityScriptLexer.boo | 12 +++++++++++- src/UnityScript/UnityScript.g | 4 ++-- .../double-precision-can-be-used-for-literals.js | 4 +++- tests/integration/float-1.js | 8 ++++++-- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/UnityScript/Parser/CodeFactory.boo b/src/UnityScript/Parser/CodeFactory.boo index a706647..e46540b 100755 --- a/src/UnityScript/Parser/CodeFactory.boo +++ b/src/UnityScript/Parser/CodeFactory.boo @@ -9,12 +9,12 @@ static class CodeFactory: return [| Boo.Lang.Builtins.array[of $elementType](cast(int, $count)) |].WithLocation(location) def NewDoubleLiteralExpression(location as LexicalInfo, literal as string): - if literal.EndsWith('f') or literal.EndsWith('F'): - return DoubleLiteralExpression(location, ParseDouble(literal[:-1]), IsSingle: true) + if literal.EndsWith('d') or literal.EndsWith('D'): + return DoubleLiteralExpression(location, ParseDouble(literal[:-1])) + literal = literal[:-1] if literal.EndsWith('f') or literal.EndsWith('F') value = ParseDouble(literal) - s as single = value - return DoubleLiteralExpression(location, value, IsSingle: (value - s) < single.Epsilon) + return DoubleLiteralExpression(location, value, IsSingle: true) private def ParseDouble(text as string): return double.Parse(text, CultureInfo.InvariantCulture) diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index e73a378..df2e416 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -722,7 +722,9 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) if 0 == inputState.guessing: _ttype = LONG; - elif ((_givenValue == char('F')) + elif ((_givenValue == char('D')) + or (_givenValue ==char('F')) + or (_givenValue ==char('d')) or (_givenValue ==char('f')) ): // 1827 _givenValue = cached_LA1 @@ -730,6 +732,10 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): match('f') elif ((_givenValue == char('F'))): // 1831 match('F') + elif ((_givenValue == char('d'))): // 1831 + match('d') + elif ((_givenValue == char('D'))): // 1831 + match('D') else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) if 0 == inputState.guessing: @@ -818,6 +824,10 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): match('f') elif ((_givenValue == char('F'))): // 1831 match('F') + elif ((_givenValue == char('d'))): // 1831 + match('d') + elif ((_givenValue == char('D'))): // 1831 + match('D') else: // line 1969 pass // 947 if (_createToken and (_token is null) and (_ttype != Token.SKIP)): diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index ef4f095..d400c75 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -1779,7 +1779,7 @@ INT: (DIGIT)+ ( ('l' | 'L') { $setType(LONG); } | - ('f' | 'F') { $setType(DOUBLE); } | + ('f' | 'F' | 'd' | 'D') { $setType(DOUBLE); } | ('.' DOUBLE_SUFFIX) { $setType(DOUBLE); } | EXPONENT { $setType(DOUBLE); } | ) @@ -1788,7 +1788,7 @@ INT: DOT: '.' (DOUBLE_SUFFIX {$setType(DOUBLE);})?; protected -DOUBLE_SUFFIX: (DIGIT)+ (EXPONENT)? ('f' | 'F')?; +DOUBLE_SUFFIX: (DIGIT)+ (EXPONENT)? ('f' | 'F' | 'd' | 'D')?; protected EXPONENT: ('e' | 'E') ('+' | '-')? (DIGIT)+; diff --git a/tests/integration/double-precision-can-be-used-for-literals.js b/tests/integration/double-precision-can-be-used-for-literals.js index 2b0ce9f..c24b8ef 100644 --- a/tests/integration/double-precision-can-be-used-for-literals.js +++ b/tests/integration/double-precision-can-be-used-for-literals.js @@ -1,7 +1,9 @@ /* +System.Double -4.42330604244772 */ -var e:double = -4.42330604244772; +var e = -4.42330604244772d; +print(e.GetType()); var g = System.Convert.ToString(e); print(g); diff --git a/tests/integration/float-1.js b/tests/integration/float-1.js index a929a36..6684005 100644 --- a/tests/integration/float-1.js +++ b/tests/integration/float-1.js @@ -5,6 +5,7 @@ System.Single System.Single System.Single System.Single +System.Single System.Double System.Single */ @@ -26,8 +27,11 @@ print(v5.GetType()); v6 = .555f; print(v6.GetType()); -v7 = .5555; // infered as double +v7 = .5555; print(v7.GetType()); -v8 = .5555f; // forces single precision +v8 = .5555d; print(v8.GetType()); + +v9 = .5555f; // forces single precision +print(v9.GetType()); From d7631a33ff38cb04fee4d2d34922e8777a4f7bec Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 18 Aug 2010 01:49:24 -0300 Subject: [PATCH 076/276] minor cleanup --- src/UnityScript/Scripting/Evaluator.boo | 2 -- src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/UnityScript/Scripting/Evaluator.boo b/src/UnityScript/Scripting/Evaluator.boo index fbee4ce..e0a9295 100755 --- a/src/UnityScript/Scripting/Evaluator.boo +++ b/src/UnityScript/Scripting/Evaluator.boo @@ -89,8 +89,6 @@ class Evaluator: _compilationResult = compiler.Run() if len(_compilationResult.Errors): raise CompilationErrorsException(_compilationResult.Errors) - - #print _compilationResult.CompileUnit.ToCodeString() return _compilationResult.GeneratedAssembly.GetType("script") private def AddEvaluationContextReferencesTo(compiler as UnityScriptCompiler): diff --git a/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo b/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo index b309f87..755a0a3 100755 --- a/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo +++ b/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo @@ -16,9 +16,8 @@ class UnityScriptTypeSystem(TypeSystemServices): self._ScriptBaseType = Map(UnityScriptParameters.ScriptBaseType) self._AbstractGenerator = Map(Boo.Lang.AbstractGenerator) - UnityScriptParameters: - get: - return cast(UnityScript.UnityScriptCompilerParameters, self.Context.Parameters) + UnityScriptParameters as UnityScript.UnityScriptCompilerParameters: + get: return self.Context.Parameters def IsScriptType(type as IType): return type.IsSubclassOf(_ScriptBaseType) From 1104766f07d324089918e2d634b63afb78f3bec7 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 18 Aug 2010 01:50:26 -0300 Subject: [PATCH 077/276] don't dynamic dispatch on Object by default (for a more stricter strict) --- src/UnityScript/Steps/ProcessUnityScriptMethods.boo | 1 + 1 file changed, 1 insertion(+) diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index e067b1e..9eac235 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -82,6 +82,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): override def OnModule(module as Module): Parameters.Strict = _strict = module.ContainsAnnotation("strict") + Parameters.Ducky = not _strict _implicit = module.ContainsAnnotation("implicit") my(UnityDowncastPermissions).Enabled = module.ContainsAnnotation("downcast") super(module) From 3ddb14932a76cbea5183e49331a4add49ae5d899 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 18 Aug 2010 02:45:57 -0300 Subject: [PATCH 078/276] fix windows build by renaming test case to avoid assembly name casing conflicts --- .../integration/{array-length.js => array-with-initial-length.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/integration/{array-length.js => array-with-initial-length.js} (100%) diff --git a/tests/integration/array-length.js b/tests/integration/array-with-initial-length.js similarity index 100% rename from tests/integration/array-length.js rename to tests/integration/array-with-initial-length.js From 899571319db42d13f2743f6a269e5b81abc395ec Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 18 Aug 2010 02:46:47 -0300 Subject: [PATCH 079/276] don't try to run nunit-console2 on windows --- default.build | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/default.build b/default.build index 99f3910..4f3b1df 100755 --- a/default.build +++ b/default.build @@ -6,7 +6,6 @@ - @@ -21,11 +20,9 @@ - - - + - + @@ -35,9 +32,6 @@ - - - From 9939a5d3e3e9f653bd9e6fc3a28f1d55cc4522b6 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 18 Aug 2010 02:49:25 -0300 Subject: [PATCH 080/276] fix ParserTestFixture on windows (<> are invalid char paths) --- src/UnityScript.Tests/ParserTestFixture.boo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 src/UnityScript.Tests/ParserTestFixture.boo diff --git a/src/UnityScript.Tests/ParserTestFixture.boo b/src/UnityScript.Tests/ParserTestFixture.boo old mode 100644 new mode 100755 index f989593..1e38e84 --- a/src/UnityScript.Tests/ParserTestFixture.boo +++ b/src/UnityScript.Tests/ParserTestFixture.boo @@ -15,7 +15,7 @@ partial class ParserTestFixture(AbstractCompilerTestFixture): [Test] def EmptyFile(): - result = CompileTestCase(StringInput("", "")) + result = CompileTestCase(StringInput("empty", "")) Assert.AreEqual(0, len(result.Errors), result.Errors.ToString(true)) Assert.AreEqual(0, len(result.CompileUnit.Modules)) From d917b4187352e96171e004e8109e1342bb87c1e6 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 18 Aug 2010 08:58:05 -0300 Subject: [PATCH 081/276] test case was renamed --- src/UnityScript.Tests/DuckyIntegrationTestFixture.boo | 8 ++++---- src/UnityScript.Tests/StrictIntegrationTestFixture.boo | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index d53d1f1..f28f5a5 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -115,10 +115,6 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-length-duck-typed.js") - [Test] def array_length(): - RunTestCase("tests/integration/array-length.js") - - [Test] def array_polymorphic_foreach(): RunTestCase("tests/integration/array-polymorphic-foreach.js") @@ -167,6 +163,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-unshift.js") + [Test] def array_with_initial_length(): + RunTestCase("tests/integration/array-with-initial-length.js") + + [Test] def arrays_2(): RunTestCase("tests/integration/arrays-2.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index 3bfebbe..c842f9e 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -117,10 +117,6 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-length-duck-typed.js") - [Test] def array_length(): - RunTestCase("tests/integration/array-length.js") - - [Test] def array_polymorphic_foreach(): RunTestCase("tests/integration/array-polymorphic-foreach.js") @@ -169,6 +165,10 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-unshift.js") + [Test] def array_with_initial_length(): + RunTestCase("tests/integration/array-with-initial-length.js") + + [Test] def arrays_2(): RunTestCase("tests/integration/arrays-2.js") From 3a9c479b5c7ced3c23e5b4a5308c058edd661118 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 18 Aug 2010 17:32:32 -0300 Subject: [PATCH 082/276] initial test case proving simple linq extension work --- src/UnityScript.Tests/DuckyIntegrationTestFixture.boo | 4 ++++ src/UnityScript.Tests/StrictIntegrationTestFixture.boo | 4 ++++ tests/integration/linq-array-ToList.js | 8 ++++++++ 3 files changed, 16 insertions(+) create mode 100644 tests/integration/linq-array-ToList.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index f28f5a5..e02ecba 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -395,6 +395,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/length-string.js") + [Test] def linq_array_ToList(): + RunTestCase("tests/integration/linq-array-ToList.js") + + [Test] def magicclass(): RunTestCase("tests/integration/magicclass.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index c842f9e..23d220d 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -397,6 +397,10 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/length-string.js") + [Test] def linq_array_ToList(): + RunTestCase("tests/integration/linq-array-ToList.js") + + [Test] def magicclass(): RunTestCase("tests/integration/magicclass.js") diff --git a/tests/integration/linq-array-ToList.js b/tests/integration/linq-array-ToList.js new file mode 100644 index 0000000..3a93592 --- /dev/null +++ b/tests/integration/linq-array-ToList.js @@ -0,0 +1,8 @@ +/* +System.Collections.Generic.List`1[System.Int32] +*/ +import System.Linq.Enumerable; + +var a = [1, 2, 3]; +var l = a.ToList(); // Enumerable.ToList(a) +print(l.GetType()); From a9e2a4a7fa37cf682c1d96f9f2e57ed663156f28 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 8 Sep 2010 16:23:40 -0300 Subject: [PATCH 083/276] ${} interpolation is deprecated --- src/UnityScript/Core/UnityScriptCompilerErrors.boo | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/UnityScript/Core/UnityScriptCompilerErrors.boo b/src/UnityScript/Core/UnityScriptCompilerErrors.boo index 5cc51ba..35b3d6b 100755 --- a/src/UnityScript/Core/UnityScriptCompilerErrors.boo +++ b/src/UnityScript/Core/UnityScriptCompilerErrors.boo @@ -17,13 +17,13 @@ static class UnityScriptCompilerErrors: return CreateError("UCE0004", location, "Property getter cannot declare any arguments.") def InterfaceExpected(location as LexicalInfo, typeName as string): - return CreateError("UCE0005", location, "'${typeName}' is not an interface. 'implements' can only be used with interfaces. Did you mean 'extends'?") + return CreateError("UCE0005", location, "'$typeName' is not an interface. 'implements' can only be used with interfaces. Did you mean 'extends'?") def ClassExpected(location as LexicalInfo, typeName as string): - return CreateError("UCE0006", location, "'${typeName}' is not a class. 'extends' can only be used with classes. Did you mean 'implements'?") + return CreateError("UCE0006", location, "'$typeName' is not a class. 'extends' can only be used with classes. Did you mean 'implements'?") def KeywordCannotBeUsedAsAnIdentifier(location as LexicalInfo, keyword as string): - return CreateError("UCE0007", location, "Reserved keyword '${keyword}' cannot be used as an identifier.") + return CreateError("UCE0007", location, "Reserved keyword '$keyword' cannot be used as an identifier.") private def CreateError(code as string, location as LexicalInfo, message as string): return Boo.Lang.Compiler.CompilerError(code, location, message, null) From 2af0a710cca82be67eb35ffe4c8d7784acdb68f5 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 8 Sep 2010 16:24:09 -0300 Subject: [PATCH 084/276] proper support for linq enumerables --- src/UnityScript.Lang/UnityRuntimeServices.boo | 9 ++++++--- src/UnityScript.Tests/DuckyIntegrationTestFixture.boo | 4 ++++ src/UnityScript.Tests/StrictIntegrationTestFixture.boo | 4 ++++ tests/integration/linq-function-inference.js | 10 ++++++++++ 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 tests/integration/linq-function-inference.js diff --git a/src/UnityScript.Lang/UnityRuntimeServices.boo b/src/UnityScript.Lang/UnityRuntimeServices.boo index 66ac733..fc6636d 100755 --- a/src/UnityScript.Lang/UnityRuntimeServices.boo +++ b/src/UnityScript.Lang/UnityRuntimeServices.boo @@ -55,9 +55,12 @@ class UnityRuntimeServices: return true static def GetEnumerator(obj) as System.Collections.IEnumerator: - if obj is null: return (,).GetEnumerator() - if IsValueTypeArray(obj) or obj isa UnityScript.Lang.Array: - return ListUpdateableEnumerator(obj) + if obj is null: return EmptyEnumerator + if IsValueTypeArray(obj) or obj isa UnityScript.Lang.Array: return ListUpdateableEnumerator(obj) + #require for proper linq support as linq enumerables also implement IEnumerator + #but fail to enumerate if accessed as IEnumerator + enumerable = obj as System.Collections.IEnumerable + if enumerable is not null: return enumerable.GetEnumerator() enumerator = obj as System.Collections.IEnumerator if enumerator is not null: return enumerator return Boo.Lang.Runtime.RuntimeServices.GetEnumerable(obj).GetEnumerator() diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index e02ecba..22ecb19 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -399,6 +399,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/linq-array-ToList.js") + [Test] def linq_function_inference(): + RunTestCase("tests/integration/linq-function-inference.js") + + [Test] def magicclass(): RunTestCase("tests/integration/magicclass.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index 23d220d..2c8194f 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -401,6 +401,10 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/linq-array-ToList.js") + [Test] def linq_function_inference(): + RunTestCase("tests/integration/linq-function-inference.js") + + [Test] def magicclass(): RunTestCase("tests/integration/magicclass.js") diff --git a/tests/integration/linq-function-inference.js b/tests/integration/linq-function-inference.js new file mode 100644 index 0000000..c82fa9d --- /dev/null +++ b/tests/integration/linq-function-inference.js @@ -0,0 +1,10 @@ +/* +1 +3 +*/ +import System.Linq.Enumerable; + +var a = [1, 2, 3]; +var oddNumbers = a.Where(function(i) { return i % 2 != 0; }); +for (var i in oddNumbers) print(i); + From 3f5a63659ab2c4ad1bb12b510c3ba758a5b6d5d7 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 8 Sep 2010 17:41:34 -0300 Subject: [PATCH 085/276] test case for value type definitions --- .../DuckyIntegrationTestFixture.boo | 4 +++ .../StrictIntegrationTestFixture.boo | 4 +++ tests/integration/value-types-1.js | 27 +++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 tests/integration/value-types-1.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 22ecb19..129d9ef 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -531,6 +531,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/uint-1.js") + [Test] def value_types_1(): + RunTestCase("tests/integration/value-types-1.js") + + [Test] def valuetypes_1(): RunTestCase("tests/integration/valuetypes-1.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index 2c8194f..493a0fe 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -533,6 +533,10 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/uint-1.js") + [Test] def value_types_1(): + RunTestCase("tests/integration/value-types-1.js") + + [Test] def valuetypes_1(): RunTestCase("tests/integration/valuetypes-1.js") diff --git a/tests/integration/value-types-1.js b/tests/integration/value-types-1.js new file mode 100644 index 0000000..f0b8629 --- /dev/null +++ b/tests/integration/value-types-1.js @@ -0,0 +1,27 @@ +/* +True +True +True +True +Pair(foo, bar) +*/ +class Pair extends System.ValueType { + var First: Object; + var Second: Object; + + function Pair(fst, snd) { + First = fst; + Second = snd; + } + + override function ToString() { + return "Pair(" + First + ", " + Second + ")"; + } +} + +var type = Pair; +print(type.IsValueType); +print(type.IsSealed); +for (var field in ["First", "Second"]) + print(type.GetField(field).IsPublic); +print(new Pair("foo", "bar")); From c2f0c5970dee6dcc69fed85e36e5fc3512f4e189 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 9 Sep 2010 17:44:48 -0300 Subject: [PATCH 086/276] ability to disable eval on specific platforms --- src/UnityScript.Tests/UsTestFixture.boo | 24 +++++++++++++++---- .../Core/UnityScriptCompilerErrors.boo | 3 +++ .../Steps/ProcessEvalInvocations.boo | 8 +++++++ .../UnityScriptCompilerParameters.boo | 3 +++ src/us/CommandLineOptions.boo | 3 +++ src/us/UnityScriptCompilerFactory.boo | 1 + tests/us/eval-can-be-disabled.js | 2 ++ 7 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 tests/us/eval-can-be-disabled.js diff --git a/src/UnityScript.Tests/UsTestFixture.boo b/src/UnityScript.Tests/UsTestFixture.boo index 1b694e6..fe54357 100755 --- a/src/UnityScript.Tests/UsTestFixture.boo +++ b/src/UnityScript.Tests/UsTestFixture.boo @@ -44,7 +44,7 @@ class UsTestFixture: "-b:UnityScript.Tests.MonoBehaviour", "-m:Awake", ResolvePath("errors-1.js"), ) - AssertErrorMessageAndExitCode(argv) + AssertUnknownIdentifierErrorMessageAndExitCode(argv) [Test] def AcceptsMultipleReferences(): @@ -54,16 +54,32 @@ class UsTestFixture: "-b:UnityScript.Tests.MonoBehaviour", "-m:Awake", ResolvePath("errors-1.js"), ) - AssertErrorMessageAndExitCode(argv) + AssertUnknownIdentifierErrorMessageAndExitCode(argv) + + [Test] + def EvalCanBeDisabled(): + message = "eval is not available on this platform" + argv = ( + "-r:${GetAssemblyLocation()}", + "-b:UnityScript.Tests.MonoBehaviour", + "-m:Awake", + '"-disable-eval:' + message + '"', + path = ResolvePath("eval-can-be-disabled.js")) + + expected = "$path(2,2): UCE0008: $message" + AssertErrorMessageAndExitCode(expected, argv) def ResolvePath(fname as string): return "${AbstractCompilerTestFixture.BasePath}/tests/us/${fname}" - def AssertErrorMessageAndExitCode(argv as (string)): - exitCode, output as string = ExecuteUs(argv) + def AssertUnknownIdentifierErrorMessageAndExitCode(argv as (string)): expected = """ ${ResolvePath('errors-1.js')}(2,4): BCE0005: Unknown identifier: 'undefinedNoPathNameError'. """ + AssertErrorMessageAndExitCode(expected, argv) + + def AssertErrorMessageAndExitCode(expected as string, argv as (string)): + exitCode, output as string = ExecuteUs(argv) Assert.AreEqual(255, exitCode) Assert.AreEqual(expected.Trim(), output.Trim()) diff --git a/src/UnityScript/Core/UnityScriptCompilerErrors.boo b/src/UnityScript/Core/UnityScriptCompilerErrors.boo index 35b3d6b..ad34872 100755 --- a/src/UnityScript/Core/UnityScriptCompilerErrors.boo +++ b/src/UnityScript/Core/UnityScriptCompilerErrors.boo @@ -25,6 +25,9 @@ static class UnityScriptCompilerErrors: def KeywordCannotBeUsedAsAnIdentifier(location as LexicalInfo, keyword as string): return CreateError("UCE0007", location, "Reserved keyword '$keyword' cannot be used as an identifier.") + def EvalHasBeenDisabled(location as LexicalInfo, reason as string): + return CreateError("UCE0008", location, reason) + private def CreateError(code as string, location as LexicalInfo, message as string): return Boo.Lang.Compiler.CompilerError(code, location, message, null) diff --git a/src/UnityScript/Steps/ProcessEvalInvocations.boo b/src/UnityScript/Steps/ProcessEvalInvocations.boo index 4d6cba9..d6a1a91 100755 --- a/src/UnityScript/Steps/ProcessEvalInvocations.boo +++ b/src/UnityScript/Steps/ProcessEvalInvocations.boo @@ -7,6 +7,7 @@ import Boo.Lang.Compiler.Steps import Boo.Lang.Compiler.TypeSystem import Boo.Lang.Compiler.TypeSystem.Internal import Boo.Lang.Compiler.TypeSystem.Builders +import UnityScript.Core import UnityScript.Scripting import UnityScript.TypeSystem @@ -134,8 +135,15 @@ class ProcessEvalInvocations(AbstractVisitorCompilerStep): override def LeaveMethodInvocationExpression(node as MethodInvocationExpression): if not IsEvalInvocation(node): return + if not string.IsNullOrEmpty(UnityScriptParameters.DisableEval): + Error(node, UnityScriptCompilerErrors.EvalHasBeenDisabled(node.Target.LexicalInfo, UnityScriptParameters.DisableEval)) + return + ReplaceEvalByEvaluatorEval(node) + UnityScriptParameters as UnityScript.UnityScriptCompilerParameters: + get: return _context.Parameters + def IsEvalInvocation(node as MethodInvocationExpression): return node.Target.Entity is UnityScriptTypeSystem.UnityScriptEval diff --git a/src/UnityScript/UnityScriptCompilerParameters.boo b/src/UnityScript/UnityScriptCompilerParameters.boo index 3d846c7..25a39ed 100755 --- a/src/UnityScript/UnityScriptCompilerParameters.boo +++ b/src/UnityScript/UnityScriptCompilerParameters.boo @@ -23,6 +23,9 @@ class UnityScriptCompilerParameters(CompilerParameters): [property(GlobalVariablesBecomeFields)] _globalVariablesBecomeFields = true + + [property(DisableEval)] + _disableEval as string def constructor(): self.Ducky = true diff --git a/src/us/CommandLineOptions.boo b/src/us/CommandLineOptions.boo index 8664848..b698685 100755 --- a/src/us/CommandLineOptions.boo +++ b/src/us/CommandLineOptions.boo @@ -82,6 +82,9 @@ class CommandLineOptions(AbstractCommandLine): [Option("Enable verbose mode.", LongForm: "verbose")] public Verbose = false + [Option("Disables eval builtin.", LongForm: "disable-eval")] + public DisableEval as string + [Option("Enables a comma separated {set} of #pragma directives on every module", LongForm: "pragmas", MaxOccurs: int.MaxValue)] def AddPragmas(pragmas as string): _pragmas.ExtendUnique(pragma.Trim() for pragma in pragmas.Split(char(','))) diff --git a/src/us/UnityScriptCompilerFactory.boo b/src/us/UnityScriptCompilerFactory.boo index a19da39..50ebf33 100644 --- a/src/us/UnityScriptCompilerFactory.boo +++ b/src/us/UnityScriptCompilerFactory.boo @@ -61,6 +61,7 @@ class UnityScriptCompilerFactory: compiler.Parameters.Ducky = options.Ducky compiler.Parameters.Debug = options.Debug compiler.Parameters.Expando = options.Expando + compiler.Parameters.DisableEval = options.DisableEval compiler.Parameters.Imports.Extend(options.Imports) if options.DebugCompiler: diff --git a/tests/us/eval-can-be-disabled.js b/tests/us/eval-can-be-disabled.js new file mode 100644 index 0000000..8bdc8b2 --- /dev/null +++ b/tests/us/eval-can-be-disabled.js @@ -0,0 +1,2 @@ + + eval("42"); From 5b4c8e50d99078ed1428797390276835fbe6fbe2 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 11 Sep 2010 09:06:04 -0300 Subject: [PATCH 087/276] support for EcmaScript 4 simplified function expressions (lambdas) --- .../DuckyIntegrationTestFixture.boo | 4 + .../ParserTestFixture.Generated.boo | 4 + .../StrictIntegrationTestFixture.boo | 4 + src/UnityScript/Parser/UnityScriptLexer.boo | 98 +++++++++---------- src/UnityScript/Parser/UnityScriptParser.boo | 94 ++++++++++++------ src/UnityScript/UnityScript.g | 3 +- tests/integration/linq-lambda-inference.js | 17 ++++ tests/parser/lambdas.js | 11 +++ 8 files changed, 153 insertions(+), 82 deletions(-) create mode 100644 tests/integration/linq-lambda-inference.js create mode 100755 tests/parser/lambdas.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 129d9ef..0431728 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -403,6 +403,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/linq-function-inference.js") + [Test] def linq_lambda_inference(): + RunTestCase("tests/integration/linq-lambda-inference.js") + + [Test] def magicclass(): RunTestCase("tests/integration/magicclass.js") diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index 92f000f..3576b30 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -134,6 +134,10 @@ partial class ParserTestFixture: RunTestCase("tests/parser/interfaces-1.js") + [Test] def lambdas(): + RunTestCase("tests/parser/lambdas.js") + + [Test] def new_1(): RunTestCase("tests/parser/new-1.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index 493a0fe..49b72e4 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -405,6 +405,10 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/linq-function-inference.js") + [Test] def linq_lambda_inference(): + RunTestCase("tests/integration/linq-lambda-inference.js") + + [Test] def magicclass(): RunTestCase("tests/integration/magicclass.js") diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index df2e416..fb97c0f 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -580,8 +580,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mDIGIT(false) else: // line 1969 - goto _loop303_breakloop - :_loop303_breakloop + goto _loop304_breakloop + :_loop304_breakloop _ttype = testLiteralsTable(_ttype) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -674,17 +674,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): match("0x") - _cnt307 as int = 0 + _cnt308 as int = 0 while true: if ((tokenSet_0_.member(cast(int, cached_LA1)))): mHEXDIGIT(false) else: - if (_cnt307 >= 1): - goto _loop307_breakloop + if (_cnt308 >= 1): + goto _loop308_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt307 - :_loop307_breakloop + ++_cnt308 + :_loop308_breakloop if ((cached_LA1==char('L') or cached_LA1==char('l'))): _givenValue = cached_LA1 if ((_givenValue == char('l'))): // 1831 @@ -698,17 +698,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): else: // line 2053 pass // 947 elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt311 as int = 0 + _cnt312 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt311 >= 1): - goto _loop311_breakloop + if (_cnt312 >= 1): + goto _loop312_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt311 - :_loop311_breakloop + ++_cnt312 + :_loop312_breakloop _givenValue = cached_LA1 if ((_givenValue == char('L')) or (_givenValue ==char('l')) @@ -804,17 +804,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_SUFFIX - _cnt320 as int = 0 + _cnt321 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt320 >= 1): - goto _loop320_breakloop + if (_cnt321 >= 1): + goto _loop321_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt320 - :_loop320_breakloop + ++_cnt321 + :_loop321_breakloop if ((cached_LA1==char('E') or cached_LA1==char('e'))): mEXPONENT(false) else: // line 2053 @@ -865,17 +865,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt327 as int = 0 + _cnt328 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt327 >= 1): - goto _loop327_breakloop + if (_cnt328 >= 1): + goto _loop328_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt327 - :_loop327_breakloop + ++_cnt328 + :_loop328_breakloop if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1347,18 +1347,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched375 as bool = false + synPredMatched376 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m375 as int = mark() - synPredMatched375 = true + _m376 as int = mark() + synPredMatched376 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched375 = false - rewind(_m375) + synPredMatched376 = false + rewind(_m376) --inputState.guessing - if synPredMatched375: + if synPredMatched376: mML_COMMENT(false) if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1371,8 +1371,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop380_breakloop - :_loop380_breakloop + goto _loop381_breakloop + :_loop381_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; elif ((_givenValue == char('='))): // 1831 @@ -1401,8 +1401,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop405_breakloop - :_loop405_breakloop + goto _loop406_breakloop + :_loop406_breakloop match("*/") if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1415,7 +1415,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt384 as int = 0 + _cnt385 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1429,12 +1429,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt384 >= 1): - goto _loop384_breakloop + if (_cnt385 >= 1): + goto _loop385_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt384 - :_loop384_breakloop + ++_cnt385 + :_loop385_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1477,8 +1477,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop388_breakloop - :_loop388_breakloop + goto _loop389_breakloop + :_loop389_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1608,17 +1608,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt408 as int = 0 + _cnt409 as int = 0 while true: if ((tokenSet_4_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt408 >= 1): - goto _loop408_breakloop + if (_cnt409 >= 1): + goto _loop409_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt408 - :_loop408_breakloop + ++_cnt409 + :_loop409_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1676,17 +1676,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt414 as int = 0 + _cnt415 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_6_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt414 >= 1): - goto _loop414_breakloop + if (_cnt415 >= 1): + goto _loop415_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt414 - :_loop414_breakloop + ++_cnt415 + :_loop415_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index df07c7d..71bd3d4 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -768,8 +768,8 @@ class UnityScriptParser(antlr.LLkParser): match(DOT) e=member_reference_expression(e) else: - goto _loop191_breakloop - :_loop191_breakloop + goto _loop192_breakloop + :_loop192_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3111,8 +3111,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop243_breakloop - :_loop243_breakloop + goto _loop244_breakloop + :_loop244_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3213,8 +3213,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ec.Add(e); else: - goto _loop209_breakloop - :_loop209_breakloop + goto _loop210_breakloop + :_loop210_breakloop elif ((_givenValue == RPAREN) or (_givenValue ==RBRACK) ): // 1827 @@ -3319,6 +3319,7 @@ class UnityScriptParser(antlr.LLkParser): match(FUNCTION) if 0 == inputState.guessing: e = BlockExpression(ToLexicalInfo(fn)) + e.Annotate("inline"); body = e.Body match(LPAREN) _givenValue = LA(1) @@ -3335,11 +3336,40 @@ class UnityScriptParser(antlr.LLkParser): tr=type_reference() if 0 == inputState.guessing: e.ReturnType = tr; - elif ((_givenValue == LBRACE)): // 1831 + elif ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + ): // 1827 pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - block(body) + if ((LA(1)==LBRACE) and (tokenSet_49_.member(cast(int, LA(2))))): + block(body) + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + returnValue=expression() + if 0 == inputState.guessing: + body.Add(returnValue) + else: + raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3564,8 +3594,8 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) slice(se) else: - goto _loop225_breakloop - :_loop225_breakloop + goto _loop226_breakloop + :_loop226_breakloop match(RBRACK) elif ((LA(1)==DOT) and (tokenSet_57_.member(cast(int, LA(2))))): // line 2102 match(DOT) @@ -3581,8 +3611,8 @@ class UnityScriptParser(antlr.LLkParser): expression_list(args) match(RPAREN) else: - goto _loop228_breakloop - :_loop228_breakloop + goto _loop229_breakloop + :_loop229_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3772,8 +3802,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop239_breakloop - :_loop239_breakloop + goto _loop240_breakloop + :_loop240_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3809,8 +3839,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop247_breakloop - :_loop247_breakloop + goto _loop248_breakloop + :_loop248_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3889,8 +3919,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop259_breakloop - :_loop259_breakloop + goto _loop260_breakloop + :_loop260_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3938,8 +3968,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), op, e, r) else: - goto _loop267_breakloop - :_loop267_breakloop + goto _loop268_breakloop + :_loop268_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3965,8 +3995,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop270_breakloop - :_loop270_breakloop + goto _loop271_breakloop + :_loop271_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3992,8 +4022,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop273_breakloop - :_loop273_breakloop + goto _loop274_breakloop + :_loop274_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4019,8 +4049,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop276_breakloop - :_loop276_breakloop + goto _loop277_breakloop + :_loop277_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4047,8 +4077,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop279_breakloop - :_loop279_breakloop + goto _loop280_breakloop + :_loop280_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4075,8 +4105,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop282_breakloop - :_loop282_breakloop + goto _loop283_breakloop + :_loop283_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4151,8 +4181,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dle.Items.Add(pair); else: - goto _loop291_breakloop - :_loop291_breakloop + goto _loop292_breakloop + :_loop292_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index d400c75..fb3c852 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -1165,13 +1165,14 @@ function_expression returns [BlockExpression e] fn:FUNCTION { e = BlockExpression(ToLexicalInfo(fn)) + e.Annotate("inline"); body = e.Body } LPAREN (parameter_declaration_list[e])? RPAREN ( COLON tr=type_reference { e.ReturnType = tr; } )? - block[body] + (block[body] | returnValue=expression { body.Add(returnValue) }) ; simple_reference_expression returns [Expression e] diff --git a/tests/integration/linq-lambda-inference.js b/tests/integration/linq-lambda-inference.js new file mode 100644 index 0000000..5d373b2 --- /dev/null +++ b/tests/integration/linq-lambda-inference.js @@ -0,0 +1,17 @@ +/* +1 +3 +1 +3 +*/ +import System.Linq.Enumerable; + +function foreach(items, action: function(Object)) { + for (var item in items) action(item); +} + +var odd = [1, 2, 3].Where(function(i) i % 2 != 0); +var p = function(o) print(o); +foreach(odd, p); +foreach(odd, function(o) print(o)); + diff --git a/tests/parser/lambdas.js b/tests/parser/lambdas.js new file mode 100755 index 0000000..63052e2 --- /dev/null +++ b/tests/parser/lambdas.js @@ -0,0 +1,11 @@ +/* +fn = { i | i * 2 } + +doubledEven = (1, 2, 3).Where({ i | (i % 2) == 0 }).Select({ i | i * 2 }) + +foo({ i, j | i * j }, { i, j | i < j }) +*/ +var fn = function(i) i*2; +var doubledEven = [1, 2, 3].Where(function(i) i%2 == 0).Select(function(i) i*2); +foo(function(i, j) i*j, function(i, j) i < j); + From 27bd74ffa90d04300065520dc222c8200033c067 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 11 Sep 2010 09:58:56 -0300 Subject: [PATCH 088/276] initial support for array comprehensions --- .../DuckyIntegrationTestFixture.boo | 4 + .../StrictIntegrationTestFixture.boo | 4 + src/UnityScript/Parser/CodeFactory.boo | 7 ++ src/UnityScript/Parser/UnityScriptLexer.boo | 98 +++++++++---------- src/UnityScript/Parser/UnityScriptParser.boo | 65 ++++++++++-- src/UnityScript/UnityScript.g | 23 +++-- tests/integration/array-comprehension-1.js | 19 ++++ 7 files changed, 154 insertions(+), 66 deletions(-) create mode 100644 tests/integration/array-comprehension-1.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 0431728..201611b 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -71,6 +71,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-cast.js") + [Test] def array_comprehension_1(): + RunTestCase("tests/integration/array-comprehension-1.js") + + [Test] def array_concat_1(): RunTestCase("tests/integration/array-concat-1.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index 49b72e4..c39cfb8 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -73,6 +73,10 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-cast.js") + [Test] def array_comprehension_1(): + RunTestCase("tests/integration/array-comprehension-1.js") + + [Test] def array_concat_1(): RunTestCase("tests/integration/array-concat-1.js") diff --git a/src/UnityScript/Parser/CodeFactory.boo b/src/UnityScript/Parser/CodeFactory.boo index e46540b..29e86f1 100755 --- a/src/UnityScript/Parser/CodeFactory.boo +++ b/src/UnityScript/Parser/CodeFactory.boo @@ -4,6 +4,13 @@ import System.Globalization import Boo.Lang.Compiler.Ast static class CodeFactory: + + def NewArrayComprehension(location as LexicalInfo, projection as Expression, variable as Declaration, expression as Expression, filter as Expression): + ge = GeneratorExpression(location, Expression: projection, Iterator: expression) + ge.Declarations.Add(variable) + if filter is not null: + ge.Filter = StatementModifier(filter.LexicalInfo, Type: StatementModifierType.If, Condition: filter) + return [| Boo.Lang.Builtins.array($ge) |].WithLocation(location) def NewArrayInitializer(location as LexicalInfo, elementType as TypeReference, count as Expression): return [| Boo.Lang.Builtins.array[of $elementType](cast(int, $count)) |].WithLocation(location) diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index fb97c0f..5f62af2 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -580,8 +580,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mDIGIT(false) else: // line 1969 - goto _loop304_breakloop - :_loop304_breakloop + goto _loop311_breakloop + :_loop311_breakloop _ttype = testLiteralsTable(_ttype) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -674,17 +674,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): match("0x") - _cnt308 as int = 0 + _cnt315 as int = 0 while true: if ((tokenSet_0_.member(cast(int, cached_LA1)))): mHEXDIGIT(false) else: - if (_cnt308 >= 1): - goto _loop308_breakloop + if (_cnt315 >= 1): + goto _loop315_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt308 - :_loop308_breakloop + ++_cnt315 + :_loop315_breakloop if ((cached_LA1==char('L') or cached_LA1==char('l'))): _givenValue = cached_LA1 if ((_givenValue == char('l'))): // 1831 @@ -698,17 +698,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): else: // line 2053 pass // 947 elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt312 as int = 0 + _cnt319 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt312 >= 1): - goto _loop312_breakloop + if (_cnt319 >= 1): + goto _loop319_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt312 - :_loop312_breakloop + ++_cnt319 + :_loop319_breakloop _givenValue = cached_LA1 if ((_givenValue == char('L')) or (_givenValue ==char('l')) @@ -804,17 +804,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_SUFFIX - _cnt321 as int = 0 + _cnt328 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt321 >= 1): - goto _loop321_breakloop + if (_cnt328 >= 1): + goto _loop328_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt321 - :_loop321_breakloop + ++_cnt328 + :_loop328_breakloop if ((cached_LA1==char('E') or cached_LA1==char('e'))): mEXPONENT(false) else: // line 2053 @@ -865,17 +865,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt328 as int = 0 + _cnt335 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt328 >= 1): - goto _loop328_breakloop + if (_cnt335 >= 1): + goto _loop335_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt328 - :_loop328_breakloop + ++_cnt335 + :_loop335_breakloop if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1347,18 +1347,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched376 as bool = false + synPredMatched383 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m376 as int = mark() - synPredMatched376 = true + _m383 as int = mark() + synPredMatched383 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched376 = false - rewind(_m376) + synPredMatched383 = false + rewind(_m383) --inputState.guessing - if synPredMatched376: + if synPredMatched383: mML_COMMENT(false) if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1371,8 +1371,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop381_breakloop - :_loop381_breakloop + goto _loop388_breakloop + :_loop388_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; elif ((_givenValue == char('='))): // 1831 @@ -1401,8 +1401,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop406_breakloop - :_loop406_breakloop + goto _loop413_breakloop + :_loop413_breakloop match("*/") if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1415,7 +1415,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt385 as int = 0 + _cnt392 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1429,12 +1429,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt385 >= 1): - goto _loop385_breakloop + if (_cnt392 >= 1): + goto _loop392_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt385 - :_loop385_breakloop + ++_cnt392 + :_loop392_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1477,8 +1477,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop389_breakloop - :_loop389_breakloop + goto _loop396_breakloop + :_loop396_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1608,17 +1608,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt409 as int = 0 + _cnt416 as int = 0 while true: if ((tokenSet_4_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt409 >= 1): - goto _loop409_breakloop + if (_cnt416 >= 1): + goto _loop416_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt409 - :_loop409_breakloop + ++_cnt416 + :_loop416_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1676,17 +1676,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt415 as int = 0 + _cnt422 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_6_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt415 >= 1): - goto _loop415_breakloop + if (_cnt422 >= 1): + goto _loop422_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt415 - :_loop415_breakloop + ++_cnt422 + :_loop422_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 71bd3d4..6141200 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -2537,9 +2537,7 @@ class UnityScriptParser(antlr.LLkParser): else: // line 1969 raise NoViableAltException(LT(1), getFilename()) if 0 == inputState.guessing: - d = Declaration(ToLexicalInfo(id)) - d.Name = id.getText() - d.Type = tr + d = Declaration(ToLexicalInfo(id), Name: id.getText(), Type: tr) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4119,14 +4117,55 @@ class UnityScriptParser(antlr.LLkParser): e as Expression lbrack as IToken = null - lle as ListLiteralExpression + id as IToken = null try: // for error handling lbrack = LT(1) match(LBRACK) - if 0 == inputState.guessing: - e = lle = ArrayLiteralExpression(ToLexicalInfo(lbrack)) - expression_list(lle.Items) + synPredMatched291 as bool = false + if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_61_.member(cast(int, LA(2))))): + _m291 as int = mark() + synPredMatched291 = true + ++inputState.guessing + try: + expression() + match(FOR) + except x as RecognitionException: + synPredMatched291 = false + rewind(_m291) + --inputState.guessing + if synPredMatched291: + projection=expression() + match(FOR) + match(LPAREN) + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + id = LT(1) + match(ID) + elif ((_givenValue == VAR)): // 1831 + variable=declaration() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(IN) + iterator=expression() + match(RPAREN) + _givenValue = LA(1) + if ((_givenValue == IF)): // 1831 + match(IF) + filter=expression() + elif ((_givenValue == RBRACK)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) + e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) + elif ((tokenSet_62_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + if 0 == inputState.guessing: + e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)) + expression_list(ale.Items) + else: + raise NoViableAltException(LT(1), getFilename()) match(RBRACK) except ex as RecognitionException: if (0 == inputState.guessing): @@ -4181,8 +4220,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dle.Items.Add(pair); else: - goto _loop292_breakloop - :_loop292_breakloop + goto _loop299_breakloop + :_loop299_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 @@ -4635,4 +4674,12 @@ class UnityScriptParser(antlr.LLkParser): data = (0L, 3342336L, 0L, 0L, ) return data public static final tokenSet_60_ = BitSet(mk_tokenSet_60_()) + private static def mk_tokenSet_61_() as (long): + data = (-7511998268457148336L, 1082835074267L, 0L, 0L, ) + return data + public static final tokenSet_61_ = BitSet(mk_tokenSet_61_()) + private static def mk_tokenSet_62_() as (long): + data = (-8809034961160888320L, 1047972555777L, 0L, 0L, ) + return data + public static final tokenSet_62_ = BitSet(mk_tokenSet_62_()) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index fb3c852..02ad5c2 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -906,9 +906,7 @@ declaration returns [Declaration d] }: VAR id:ID (COLON tr=type_reference)? { - d = Declaration(ToLexicalInfo(id)) - d.Name = id.getText() - d.Type = tr + d = Declaration(ToLexicalInfo(id), Name: id.getText(), Type: tr) } ; @@ -1639,13 +1637,22 @@ literal returns [Expression e] array_literal returns [Expression e] { - lle as ListLiteralExpression }: lbrack:LBRACK - { - e = lle = ArrayLiteralExpression(ToLexicalInfo(lbrack)) - } - expression_list[lle.Items] + + ( + (expression FOR)=>( + projection=expression + FOR LPAREN ((id:ID | variable=declaration) IN iterator=expression) RPAREN + (IF filter=expression)? + { + if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) + e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) + } + ) + | { e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)) } expression_list[ale.Items] + ) + RBRACK ; diff --git a/tests/integration/array-comprehension-1.js b/tests/integration/array-comprehension-1.js new file mode 100644 index 0000000..2c36647 --- /dev/null +++ b/tests/integration/array-comprehension-1.js @@ -0,0 +1,19 @@ +/* +System.Int32[] +[0, 2, 4] +System.Int32[] +[1, 3, 5] +*/ + +function printArray(a: int[]) { + print("[" + String.Join(", ", [i.ToString() for (i in a)]) + "]"); +} + +var doubles = [i*2 for (i in range(0, 3))]; +var odds = [i for (i in range(0, 6)) if (i % 2 != 0)]; + +print(doubles.GetType()); +printArray(doubles); + +print(odds.GetType()); +printArray(odds); From 80dd02a6a7888f8bfc302a41dd2c674108cfb9da Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 14 Sep 2010 11:15:23 -0300 Subject: [PATCH 089/276] better support for response files --- .../CommandLineOptionsTestFixture.boo | 18 +++++++++++++++++- src/us/CommandLineOptions.boo | 13 +++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo b/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo index 8333129..ba98e28 100755 --- a/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo +++ b/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo @@ -10,7 +10,23 @@ class CommandLineOptionsTestFixture: def Defines(): options = us.CommandLineOptions("-d:FOO", "--define:BAR") Assert.AreEqual(("FOO", "BAR"), options.Defines.ToArray()) - + + [Test] + def ResponseFilesWithQuotedArgumentsContainingSpacesAreCorrectlyParsed(): + + sourceFile = "/foo/with space/src.boo" + reference = "/foo/with space/bar.dll" + + rsp = Path.GetTempFileName() + File.WriteAllText(rsp, """ +#this is only a comment +-r:"$reference" +"$sourceFile" + """) + + options = us.CommandLineOptions("@$rsp") + Assert.AreEqual((reference,), options.References.ToArray()) + Assert.AreEqual((sourceFile,), options.SourceFiles.ToArray()) [Test] def SourceDirectoriesAreRecursivelyScanned(): diff --git a/src/us/CommandLineOptions.boo b/src/us/CommandLineOptions.boo index b698685..314f8a1 100755 --- a/src/us/CommandLineOptions.boo +++ b/src/us/CommandLineOptions.boo @@ -91,15 +91,15 @@ class CommandLineOptions(AbstractCommandLine): [Option("References the specified {assembly}", ShortForm: 'r', LongForm: "reference", MaxOccurs: int.MaxValue)] def AddReference(reference as string): - _references.AddUnique(reference) + _references.AddUnique(Unquote(reference)) [Option("Includes all *.js files from {srcdir}", LongForm: "srcdir", MaxOccurs: int.MaxValue)] def AddSourceDir(srcDir as string): - _srcDirs.AddUnique(Path.GetFullPath(srcDir)) + _srcDirs.AddUnique(Path.GetFullPath(Unquote(srcDir))) [Option("Embed a managed resource {file}", LongForm: "resource", MaxOccurs: int.MaxValue)] def AddResource(resource as string): - _resources.AddUnique(resource) + _resources.AddUnique(Unquote(resource)) [Option("Suppress the warning {code}", LongForm: "nowarn", MaxOccurs: int.MaxValue)] def SuppressWarning(code as string): @@ -129,7 +129,12 @@ class CommandLineOptions(AbstractCommandLine): [Argument] def AddSourceFile([required] sourceFile as string): - self.SourceFiles.Add(sourceFile) + self.SourceFiles.Add(Unquote(sourceFile)) private def InvalidOption(msg as string): raise msg + +def Unquote(path as string): + if path.StartsWith('"') or path.StartsWith("'"): + return path[1:-1] + return path From d323b1537738e15e8609cf7a345f9cecdba4eae0 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 15 Sep 2010 13:55:49 -0300 Subject: [PATCH 090/276] introduce skip.verification flag --- default.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.build b/default.build index 4f3b1df..5fab632 100755 --- a/default.build +++ b/default.build @@ -39,7 +39,7 @@ - + From 131f055df603f3188c80c2c57600f5bfd80f0e87 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 15 Sep 2010 13:56:22 -0300 Subject: [PATCH 091/276] response files are already supported by CommandLineOptions --- .../CommandLineOptionsTestFixture.boo | 7 +++++-- src/us/us.boo | 17 ----------------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo b/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo index ba98e28..4ac3883 100755 --- a/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo +++ b/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo @@ -14,14 +14,17 @@ class CommandLineOptionsTestFixture: [Test] def ResponseFilesWithQuotedArgumentsContainingSpacesAreCorrectlyParsed(): - sourceFile = "/foo/with space/src.boo" - reference = "/foo/with space/bar.dll" + sourceFile = "foo/with space/src.boo" + reference = "foo/with space/bar.dll" rsp = Path.GetTempFileName() File.WriteAllText(rsp, """ #this is only a comment + -r:"$reference" + "$sourceFile" + """) options = us.CommandLineOptions("@$rsp") diff --git a/src/us/us.boo b/src/us/us.boo index cb21c04..01da066 100755 --- a/src/us/us.boo +++ b/src/us/us.boo @@ -63,25 +63,8 @@ def run(argv as (string)): return 255 def parseCommandLineOptions(argv as (string)): - if len(argv) == 1 and argv[0].StartsWith("@"): - return CommandLineOptions(*parseResponseFile(argv[0][1:])) return CommandLineOptions(*argv) -def parseResponseFile(responseFile as string): - args = List of string() - - using reader = File.OpenText(responseFile): - for line in reader: - for arg in /\s+/.Split(line): - continue if len(arg) == 0 - args.Add(unquote(arg)) - - return args.ToArray() - -def unquote(s as string): - if s.StartsWith('"'): return s[1:-1] - return s - def usage(options as CommandLineOptions): banner() options.PrintOptions() From c1cb0857e0cbeb38ed6891675d86df0fae33c949 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 16 Sep 2010 11:17:56 -0300 Subject: [PATCH 092/276] forgot to define a default value for skip.verification --- default.build | 1 + 1 file changed, 1 insertion(+) diff --git a/default.build b/default.build index 5fab632..34d4a8a 100755 --- a/default.build +++ b/default.build @@ -8,6 +8,7 @@ + From cff0c9b984cffa173e41cea0652d73b2684d50a0 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 16 Sep 2010 11:19:59 -0300 Subject: [PATCH 093/276] fix for nested array definitions (#374310) --- .../DuckyIntegrationTestFixture.boo | 4 ++++ .../StrictIntegrationTestFixture.boo | 4 ++++ src/UnityScript/Parser/UnityScriptParser.boo | 4 ++-- src/UnityScript/UnityScript.g | 2 +- tests/integration/array-nesting.js | 20 +++++++++++++++++++ 5 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 tests/integration/array-nesting.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 201611b..6f15886 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -119,6 +119,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-length-duck-typed.js") + [Test] def array_nesting(): + RunTestCase("tests/integration/array-nesting.js") + + [Test] def array_polymorphic_foreach(): RunTestCase("tests/integration/array-polymorphic-foreach.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index c39cfb8..bdf9144 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -121,6 +121,10 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-length-duck-typed.js") + [Test] def array_nesting(): + RunTestCase("tests/integration/array-nesting.js") + + [Test] def array_polymorphic_foreach(): RunTestCase("tests/integration/array-polymorphic-foreach.js") diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 6141200..8219790 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -4162,8 +4162,8 @@ class UnityScriptParser(antlr.LLkParser): e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) elif ((tokenSet_62_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: - e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)) - expression_list(ale.Items) + e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)); items = ale.Items; + expression_list(items) else: raise NoViableAltException(LT(1), getFilename()) match(RBRACK) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 02ad5c2..02ce421 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -1650,7 +1650,7 @@ array_literal returns [Expression e] e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) } ) - | { e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)) } expression_list[ale.Items] + | { e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)); items = ale.Items; } expression_list[items] ) RBRACK diff --git a/tests/integration/array-nesting.js b/tests/integration/array-nesting.js new file mode 100644 index 0000000..2219dd8 --- /dev/null +++ b/tests/integration/array-nesting.js @@ -0,0 +1,20 @@ +/* +System.Int32[][] +1 +2 +3 +4 +System.String[][] +foo +bar +baz +*/ +function dump(a) { + print(a.GetType()); + for (var nested in a) + for (var i in nested) print(i); +} + +var nestedInts = [[1, 2], [3, 4]]; +dump(nestedInts); +dump([["foo", "bar"], ["baz"]]); From 0c6a778bdd0682ba0df0fb9a9d345dbb72910d1d Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 23 Sep 2010 14:10:47 -0300 Subject: [PATCH 094/276] support for strings delimited by single quotes --- .../ParserTestFixture.Generated.boo | 4 + src/UnityScript/Parser/UnityScriptLexer.boo | 240 ++++++++++-------- src/UnityScript/Parser/UnityScriptParser.boo | 143 +++++++---- .../Parser/UnityScriptTokenTypes.boo | 27 +- .../Parser/UnityScriptTokenTypes.txt | 27 +- src/UnityScript/UnityScript.g | 20 +- tests/parser/strings.js | 6 + 7 files changed, 282 insertions(+), 185 deletions(-) create mode 100644 tests/parser/strings.js diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index 3576b30..01b5e4d 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -194,6 +194,10 @@ partial class ParserTestFixture: RunTestCase("tests/parser/shift-left-bitwise-or.js") + [Test] def strings(): + RunTestCase("tests/parser/strings.js") + + [Test] def try_1(): RunTestCase("tests/parser/try-1.js") diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index 5f62af2..fce5a4a 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -132,19 +132,20 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): public static final DOUBLE = 101 public static final INT = 102 public static final LONG = 103 - public static final DOUBLE_SUFFIX = 104 - public static final EXPONENT = 105 - public static final WHITE_SPACE = 106 - public static final DQS_ESC = 107 - public static final SQS_ESC = 108 - public static final SESC = 109 - public static final ML_COMMENT = 110 - public static final RE_CHAR = 111 - public static final RE_ESC = 112 - public static final NEWLINE = 113 - public static final ID_LETTER = 114 - public static final DIGIT = 115 - public static final HEXDIGIT = 116 + public static final SINGLE_QUOTED_STRING = 104 + public static final DOUBLE_SUFFIX = 105 + public static final EXPONENT = 106 + public static final WHITE_SPACE = 107 + public static final DQS_ESC = 108 + public static final SQS_ESC = 109 + public static final SESC = 110 + public static final ML_COMMENT = 111 + public static final RE_CHAR = 112 + public static final RE_ESC = 113 + public static final NEWLINE = 114 + public static final ID_LETTER = 115 + public static final DIGIT = 116 + public static final HEXDIGIT = 117 static def IsDigit(ch as char): @@ -397,6 +398,9 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((_givenValue == char('"'))): // 1831 mDOUBLE_QUOTED_STRING(true) theRetToken = returnToken_ + elif ((_givenValue == char('\''))): // 1831 + mSINGLE_QUOTED_STRING(true) + theRetToken = returnToken_ else: // line 1969 if ((cached_LA1==char('=')) and (cached_LA2==char('=')) and (LA(3)==char('='))): mREFERENCE_EQUALITY(true) @@ -580,8 +584,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mDIGIT(false) else: // line 1969 - goto _loop311_breakloop - :_loop311_breakloop + goto _loop312_breakloop + :_loop312_breakloop _ttype = testLiteralsTable(_ttype) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -674,17 +678,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): match("0x") - _cnt315 as int = 0 + _cnt316 as int = 0 while true: if ((tokenSet_0_.member(cast(int, cached_LA1)))): mHEXDIGIT(false) else: - if (_cnt315 >= 1): - goto _loop315_breakloop + if (_cnt316 >= 1): + goto _loop316_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt315 - :_loop315_breakloop + ++_cnt316 + :_loop316_breakloop if ((cached_LA1==char('L') or cached_LA1==char('l'))): _givenValue = cached_LA1 if ((_givenValue == char('l'))): // 1831 @@ -698,17 +702,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): else: // line 2053 pass // 947 elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt319 as int = 0 + _cnt320 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt319 >= 1): - goto _loop319_breakloop + if (_cnt320 >= 1): + goto _loop320_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt319 - :_loop319_breakloop + ++_cnt320 + :_loop320_breakloop _givenValue = cached_LA1 if ((_givenValue == char('L')) or (_givenValue ==char('l')) @@ -804,17 +808,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_SUFFIX - _cnt328 as int = 0 + _cnt329 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt328 >= 1): - goto _loop328_breakloop + if (_cnt329 >= 1): + goto _loop329_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt328 - :_loop328_breakloop + ++_cnt329 + :_loop329_breakloop if ((cached_LA1==char('E') or cached_LA1==char('e'))): mEXPONENT(false) else: // line 2053 @@ -865,17 +869,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt335 as int = 0 + _cnt336 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt335 >= 1): - goto _loop335_breakloop + if (_cnt336 >= 1): + goto _loop336_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt335 - :_loop335_breakloop + ++_cnt336 + :_loop336_breakloop if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1347,18 +1351,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched383 as bool = false + synPredMatched384 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m383 as int = mark() - synPredMatched383 = true + _m384 as int = mark() + synPredMatched384 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched383 = false - rewind(_m383) + synPredMatched384 = false + rewind(_m384) --inputState.guessing - if synPredMatched383: + if synPredMatched384: mML_COMMENT(false) if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1371,8 +1375,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop388_breakloop - :_loop388_breakloop + goto _loop389_breakloop + :_loop389_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; elif ((_givenValue == char('='))): // 1831 @@ -1401,8 +1405,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop413_breakloop - :_loop413_breakloop + goto _loop418_breakloop + :_loop418_breakloop match("*/") if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1415,7 +1419,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt392 as int = 0 + _cnt393 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1429,12 +1433,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt392 >= 1): - goto _loop392_breakloop + if (_cnt393 >= 1): + goto _loop393_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt392 - :_loop392_breakloop + ++_cnt393 + :_loop393_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1477,8 +1481,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop396_breakloop - :_loop396_breakloop + goto _loop397_breakloop + :_loop397_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1507,8 +1511,56 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): mSESC(false) elif ((_givenValue == char('"'))): // 1831 match('"') - elif ((_givenValue == char('$'))): // 1831 - match('$') + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mSINGLE_QUOTED_STRING(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = SINGLE_QUOTED_STRING + + _saveIndex = text.Length + match('\'') + text.Length = _saveIndex + while true: + if ((cached_LA1==char('\\'))): + mSQS_ESC(false) + elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 + match(tokenSet_4_) + else: + goto _loop401_breakloop + :_loop401_breakloop + _saveIndex = text.Length + match('\'') + text.Length = _saveIndex + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mSQS_ESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = SQS_ESC + + _saveIndex = text.Length + match('\\') + text.Length = _saveIndex + _givenValue = cached_LA1 + if ((_givenValue == char('0')) + or (_givenValue ==char('\\')) + or (_givenValue ==char('a')) + or (_givenValue ==char('b')) + or (_givenValue ==char('f')) + or (_givenValue ==char('n')) + or (_givenValue ==char('r')) + or (_givenValue ==char('t')) + ): // 1827 + mSESC(false) + elif ((_givenValue == char('\''))): // 1831 + match('\'') else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1576,49 +1628,22 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _token.setText(text.ToString(_begin, text.Length-_begin)) returnToken_ = _token - protected def mSQS_ESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = SQS_ESC - - _saveIndex = text.Length - match('\\') - text.Length = _saveIndex - _givenValue = cached_LA1 - if ((_givenValue == char('0')) - or (_givenValue ==char('\\')) - or (_givenValue ==char('a')) - or (_givenValue ==char('b')) - or (_givenValue ==char('f')) - or (_givenValue ==char('n')) - or (_givenValue ==char('r')) - or (_givenValue ==char('t')) - ): // 1827 - mSESC(false) - elif ((_givenValue == char('\''))): // 1831 - match('\'') - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - protected def mRE_LITERAL(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException _ttype as int; _token as IToken; _begin = text.Length; _ttype = RE_LITERAL match('/') - _cnt416 as int = 0 + _cnt421 as int = 0 while true: - if ((tokenSet_4_.member(cast(int, cached_LA1)))): + if ((tokenSet_5_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt416 >= 1): - goto _loop416_breakloop + if (_cnt421 >= 1): + goto _loop421_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt416 - :_loop416_breakloop + ++_cnt421 + :_loop421_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1631,8 +1656,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('\\'))): mRE_ESC(false) - elif ((tokenSet_5_.member(cast(int, cached_LA1)))): // line 2102 - match(tokenSet_5_) + elif ((tokenSet_6_.member(cast(int, cached_LA1)))): // line 2102 + match(tokenSet_6_) else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1676,17 +1701,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt422 as int = 0 + _cnt427 as int = 0 while true: - if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_6_.member(cast(int, cached_LA2))) and (true)): + if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt422 >= 1): - goto _loop422_breakloop + if (_cnt427 >= 1): + goto _loop427_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt422 - :_loop422_breakloop + ++_cnt427 + :_loop427_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) @@ -1812,8 +1837,9 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) private static def mk_tokenSet_4_() as (long): data = array(long, 2048) - data[0]=-140741783332360L - i = 1 + data[0]=-549755823112L + data[1]=-268435457L + i = 2 while i<=1022: data[i] = -1L ++i @@ -1827,8 +1853,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): private static def mk_tokenSet_5_() as (long): data = array(long, 2048) data[0]=-140741783332360L - data[1]=-268435457L - i = 2 + i = 1 while i<=1022: data[i] = -1L ++i @@ -1840,6 +1865,21 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): return data public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) private static def mk_tokenSet_6_() as (long): + data = array(long, 2048) + data[0]=-140741783332360L + data[1]=-268435457L + i = 2 + while i<=1022: + data[i] = -1L + ++i + data[1023]=9223372036854775807L + i = 1024 + while i<=2047: + data[i] = 0L + ++i + return data + public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) + private static def mk_tokenSet_7_() as (long): data = array(long, 2048) data[0]=-4294977032L i = 1 @@ -1852,5 +1892,5 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): data[i] = 0L ++i return data - public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) + public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 8219790..51d2f74 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -130,19 +130,20 @@ class UnityScriptParser(antlr.LLkParser): public static final DOUBLE = 101 public static final INT = 102 public static final LONG = 103 - public static final DOUBLE_SUFFIX = 104 - public static final EXPONENT = 105 - public static final WHITE_SPACE = 106 - public static final DQS_ESC = 107 - public static final SQS_ESC = 108 - public static final SESC = 109 - public static final ML_COMMENT = 110 - public static final RE_CHAR = 111 - public static final RE_ESC = 112 - public static final NEWLINE = 113 - public static final ID_LETTER = 114 - public static final DIGIT = 115 - public static final HEXDIGIT = 116 + public static final SINGLE_QUOTED_STRING = 104 + public static final DOUBLE_SUFFIX = 105 + public static final EXPONENT = 106 + public static final WHITE_SPACE = 107 + public static final DQS_ESC = 108 + public static final SQS_ESC = 109 + public static final SESC = 110 + public static final ML_COMMENT = 111 + public static final RE_CHAR = 112 + public static final RE_ESC = 113 + public static final NEWLINE = 114 + public static final ID_LETTER = 115 + public static final DIGIT = 116 + public static final HEXDIGIT = 117 [property(CompilerContext)] @@ -469,6 +470,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 _givenValue = LA(1) if ((_givenValue == FALSE) @@ -493,6 +495,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 expression_statement(b) elif ((_givenValue == YIELD)): // 1831 @@ -529,7 +532,9 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==LONG) ): // 1827 e=integer_literal() - elif ((_givenValue == DOUBLE_QUOTED_STRING)): // 1831 + elif ((_givenValue == DOUBLE_QUOTED_STRING) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 e=string_literal() elif ((_givenValue == FALSE) or (_givenValue ==TRUE) @@ -587,12 +592,24 @@ class UnityScriptParser(antlr.LLkParser): e as Expression dqs as IToken = null + sqs as IToken = null try: // for error handling - dqs = LT(1) - match(DOUBLE_QUOTED_STRING) + _givenValue = LA(1) + if ((_givenValue == DOUBLE_QUOTED_STRING)): // 1831 + dqs = LT(1) + match(DOUBLE_QUOTED_STRING) + if 0 == inputState.guessing: + s = dqs; + elif ((_givenValue == SINGLE_QUOTED_STRING)): // 1831 + sqs = LT(1) + match(SINGLE_QUOTED_STRING) + if 0 == inputState.guessing: + s = sqs; + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) if 0 == inputState.guessing: - e = StringLiteralExpression(ToLexicalInfo(dqs), dqs.getText()) + e = StringLiteralExpression(ToLexicalInfo(s), s.getText()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -852,6 +869,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 attribute_parameter(attr) while true: @@ -1313,6 +1331,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 pass // 947 else: // line 1969 @@ -1443,6 +1462,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 pass // 947 else: // line 1969 @@ -1501,6 +1521,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 pass // 947 else: // line 1969 @@ -2376,6 +2397,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 _givenValue = LA(1) if ((_givenValue == FALSE) @@ -2400,6 +2422,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 expression_statement(b) elif ((_givenValue == YIELD)): // 1831 @@ -2532,6 +2555,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 pass // 947 else: // line 1969 @@ -2689,6 +2713,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 pass // 947 else: // line 1969 @@ -2777,6 +2802,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 expression_statement(container) elif ((_givenValue == EOS)): // 1831 @@ -2807,6 +2833,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 condition=expression() elif ((_givenValue == EOS)): // 1831 @@ -2837,6 +2864,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 update=assignment_expression() elif ((_givenValue == RPAREN)): // 1831 @@ -3200,6 +3228,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 e=expression() if 0 == inputState.guessing: @@ -3244,6 +3273,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 e=literal() elif ((_givenValue == NEW)): // 1831 @@ -3277,7 +3307,9 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==LONG) ): // 1827 e=integer_literal() - elif ((_givenValue == DOUBLE_QUOTED_STRING)): // 1831 + elif ((_givenValue == DOUBLE_QUOTED_STRING) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 e=string_literal() elif ((_givenValue == LBRACK)): // 1831 e=array_literal() @@ -3356,6 +3388,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 pass // 947 else: // line 1969 @@ -3466,6 +3499,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 end=expression() elif ((_givenValue == COLON)): // 1831 @@ -3501,6 +3535,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 begin=expression() _givenValue = LA(1) @@ -3529,6 +3564,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 end=expression() elif ((_givenValue == COLON) @@ -3684,6 +3720,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 e=postfix_unary_expression() else: // line 1969 @@ -4209,6 +4246,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 pair=expression_pair() if 0 == inputState.guessing: @@ -4415,6 +4453,7 @@ class UnityScriptParser(antlr.LLkParser): 'DOUBLE', 'INT', 'LONG', + 'SINGLE_QUOTED_STRING', 'DOUBLE_SUFFIX', 'EXPONENT', 'WHITE_SPACE', @@ -4439,11 +4478,11 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) private static def mk_tokenSet_2_() as (long): - data = (-8808777125549366752L, 1047972555776L, 0L, 0L, ) + data = (-8808777125549366752L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) private static def mk_tokenSet_3_() as (long): - data = (-7494834249975239822L, 1095216660479L, 0L, 0L, ) + data = (-7494834249975239822L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) private static def mk_tokenSet_4_() as (long): @@ -4451,7 +4490,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) private static def mk_tokenSet_5_() as (long): - data = (-8808759441280505054L, 1055488748544L, 0L, 0L, ) + data = (-8808759441280505054L, 2155000376320L, 0L, 0L, ) return data public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) private static def mk_tokenSet_6_() as (long): @@ -4459,7 +4498,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) private static def mk_tokenSet_7_() as (long): - data = (-8808759441281553630L, 1051193781248L, 0L, 0L, ) + data = (-8808759441281553630L, 2150705409024L, 0L, 0L, ) return data public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) private static def mk_tokenSet_8_() as (long): @@ -4471,7 +4510,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_9_ = BitSet(mk_tokenSet_9_()) private static def mk_tokenSet_10_() as (long): - data = (-2467966685823229952L, 1047972555776L, 0L, 0L, ) + data = (-2467966685823229952L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_10_ = BitSet(mk_tokenSet_10_()) private static def mk_tokenSet_11_() as (long): @@ -4479,11 +4518,11 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_11_ = BitSet(mk_tokenSet_11_()) private static def mk_tokenSet_12_() as (long): - data = (-42953084942L, 1095216660479L, 0L, 0L, ) + data = (-42953084942L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_12_ = BitSet(mk_tokenSet_12_()) private static def mk_tokenSet_13_() as (long): - data = (-8809034961160888320L, 1047972555776L, 0L, 0L, ) + data = (-8809034961160888320L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_13_ = BitSet(mk_tokenSet_13_()) private static def mk_tokenSet_14_() as (long): @@ -4495,11 +4534,11 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_15_ = BitSet(mk_tokenSet_15_()) private static def mk_tokenSet_16_() as (long): - data = (342279069305544704L, 962072674304L, 0L, 0L, ) + data = (342279069305544704L, 2061584302080L, 0L, 0L, ) return data public static final tokenSet_16_ = BitSet(mk_tokenSet_16_()) private static def mk_tokenSet_17_() as (long): - data = (-2467966685823229952L, 1047972555778L, 0L, 0L, ) + data = (-2467966685823229952L, 2147484183554L, 0L, 0L, ) return data public static final tokenSet_17_ = BitSet(mk_tokenSet_17_()) private static def mk_tokenSet_18_() as (long): @@ -4507,19 +4546,19 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_18_ = BitSet(mk_tokenSet_18_()) private static def mk_tokenSet_19_() as (long): - data = (918739821608968192L, 962072674304L, 0L, 0L, ) + data = (918739821608968192L, 2061584302080L, 0L, 0L, ) return data public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) private static def mk_tokenSet_20_() as (long): - data = (-8808759439134069982L, 1051193781248L, 0L, 0L, ) + data = (-8808759439134069982L, 2150705409024L, 0L, 0L, ) return data public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) private static def mk_tokenSet_21_() as (long): - data = (-7494834213467755662L, 1095216660479L, 0L, 0L, ) + data = (-7494834213467755662L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) private static def mk_tokenSet_22_() as (long): - data = (-42949939214L, 1099511627775L, 0L, 0L, ) + data = (-42949939214L, 2199023255551L, 0L, 0L, ) return data public static final tokenSet_22_ = BitSet(mk_tokenSet_22_()) private static def mk_tokenSet_23_() as (long): @@ -4559,43 +4598,43 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) private static def mk_tokenSet_32_() as (long): - data = (-8663799828275531870L, 1051193781504L, 0L, 0L, ) + data = (-8663799828275531870L, 2150705409280L, 0L, 0L, ) return data public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) private static def mk_tokenSet_33_() as (long): - data = (-8663799826126999646L, 1055488748800L, 0L, 0L, ) + data = (-8663799826126999646L, 2155000376576L, 0L, 0L, ) return data public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) private static def mk_tokenSet_34_() as (long): - data = (-3149838L, 1095216660479L, 0L, 0L, ) + data = (-3149838L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) private static def mk_tokenSet_35_() as (long): - data = (-8664644251058214110L, 1051193781248L, 0L, 0L, ) + data = (-8664644251058214110L, 2150705409024L, 0L, 0L, ) return data public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) private static def mk_tokenSet_36_() as (long): - data = (-8809026165067866112L, 1047972556032L, 0L, 0L, ) + data = (-8809026165067866112L, 2147484183808L, 0L, 0L, ) return data public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) private static def mk_tokenSet_37_() as (long): - data = (-7495109769854574512L, 1091995435007L, 0L, 0L, ) + data = (-7495109769854574512L, 2191507062783L, 0L, 0L, ) return data public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) private static def mk_tokenSet_38_() as (long): - data = (-8808777125549366752L, 1047972556032L, 0L, 0L, ) + data = (-8808777125549366752L, 2147484183808L, 0L, 0L, ) return data public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) private static def mk_tokenSet_39_() as (long): - data = (-7510878323647713294L, 1086056299995L, 0L, 0L, ) + data = (-7510878323647713294L, 2185567927771L, 0L, 0L, ) return data public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) private static def mk_tokenSet_40_() as (long): - data = (-42950987790L, 1095216660479L, 0L, 0L, ) + data = (-42950987790L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) private static def mk_tokenSet_41_() as (long): - data = (-8590987278L, 1095216660479L, 0L, 0L, ) + data = (-8590987278L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) private static def mk_tokenSet_42_() as (long): @@ -4619,31 +4658,31 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) private static def mk_tokenSet_47_() as (long): - data = (-6358801241844520158L, 1051193782016L, 0L, 0L, ) + data = (-6358801241844520158L, 2150705409792L, 0L, 0L, ) return data public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) private static def mk_tokenSet_48_() as (long): - data = (-8663799826128048222L, 1051193781504L, 0L, 0L, ) + data = (-8663799826128048222L, 2150705409280L, 0L, 0L, ) return data public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) private static def mk_tokenSet_49_() as (long): - data = (-8664661937473510880L, 1047972556032L, 0L, 0L, ) + data = (-8664661937473510880L, 2147484183808L, 0L, 0L, ) return data public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) private static def mk_tokenSet_50_() as (long): - data = (-7493989825045073934L, 1095216660479L, 0L, 0L, ) + data = (-7493989825045073934L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) private static def mk_tokenSet_51_() as (long): - data = (-8663799828271337566L, 1051193782016L, 0L, 0L, ) + data = (-8663799828271337566L, 2150705409792L, 0L, 0L, ) return data public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) private static def mk_tokenSet_52_() as (long): - data = (-8087339075972108382L, 1051193781504L, 0L, 0L, ) + data = (-8087339075972108382L, 2150705409280L, 0L, 0L, ) return data public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) private static def mk_tokenSet_53_() as (long): - data = (-8593084430L, 1095216660479L, 0L, 0L, ) + data = (-8593084430L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) private static def mk_tokenSet_54_() as (long): @@ -4655,7 +4694,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) private static def mk_tokenSet_56_() as (long): - data = (-6503191951947194368L, 1047972555776L, 0L, 0L, ) + data = (-6503191951947194368L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) private static def mk_tokenSet_57_() as (long): @@ -4663,7 +4702,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) private static def mk_tokenSet_58_() as (long): - data = (-8232574208857464832L, 1047972555776L, 0L, 0L, ) + data = (-8232574208857464832L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) private static def mk_tokenSet_59_() as (long): @@ -4675,11 +4714,11 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_60_ = BitSet(mk_tokenSet_60_()) private static def mk_tokenSet_61_() as (long): - data = (-7511998268457148336L, 1082835074267L, 0L, 0L, ) + data = (-7511998268457148336L, 2182346702043L, 0L, 0L, ) return data public static final tokenSet_61_ = BitSet(mk_tokenSet_61_()) private static def mk_tokenSet_62_() as (long): - data = (-8809034961160888320L, 1047972555777L, 0L, 0L, ) + data = (-8809034961160888320L, 2147484183553L, 0L, 0L, ) return data public static final tokenSet_62_ = BitSet(mk_tokenSet_62_()) diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.boo b/src/UnityScript/Parser/UnityScriptTokenTypes.boo index 778e28b..7bb2fb8 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.boo +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.boo @@ -104,17 +104,18 @@ class UnityScriptTokenTypes: public static final DOUBLE = 101 public static final INT = 102 public static final LONG = 103 - public static final DOUBLE_SUFFIX = 104 - public static final EXPONENT = 105 - public static final WHITE_SPACE = 106 - public static final DQS_ESC = 107 - public static final SQS_ESC = 108 - public static final SESC = 109 - public static final ML_COMMENT = 110 - public static final RE_CHAR = 111 - public static final RE_ESC = 112 - public static final NEWLINE = 113 - public static final ID_LETTER = 114 - public static final DIGIT = 115 - public static final HEXDIGIT = 116 + public static final SINGLE_QUOTED_STRING = 104 + public static final DOUBLE_SUFFIX = 105 + public static final EXPONENT = 106 + public static final WHITE_SPACE = 107 + public static final DQS_ESC = 108 + public static final SQS_ESC = 109 + public static final SESC = 110 + public static final ML_COMMENT = 111 + public static final RE_CHAR = 112 + public static final RE_ESC = 113 + public static final NEWLINE = 114 + public static final ID_LETTER = 115 + public static final DIGIT = 116 + public static final HEXDIGIT = 117 diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.txt b/src/UnityScript/Parser/UnityScriptTokenTypes.txt index 49e52fd..9851722 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.txt +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.txt @@ -100,16 +100,17 @@ RE_LITERAL=100 DOUBLE=101 INT=102 LONG=103 -DOUBLE_SUFFIX=104 -EXPONENT=105 -WHITE_SPACE=106 -DQS_ESC=107 -SQS_ESC=108 -SESC=109 -ML_COMMENT=110 -RE_CHAR=111 -RE_ESC=112 -NEWLINE=113 -ID_LETTER=114 -DIGIT=115 -HEXDIGIT=116 +SINGLE_QUOTED_STRING=104 +DOUBLE_SUFFIX=105 +EXPONENT=106 +WHITE_SPACE=107 +DQS_ESC=108 +SQS_ESC=109 +SESC=110 +ML_COMMENT=111 +RE_CHAR=112 +RE_ESC=113 +NEWLINE=114 +ID_LETTER=115 +DIGIT=116 +HEXDIGIT=117 diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 02ce421..e4ddb1a 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -1152,7 +1152,6 @@ atom returns [Expression e] e=simple_reference_expression | e=paren_expression | e=new_expression | - //e=cast_expression | e=typeof_expression ) ; @@ -1625,7 +1624,6 @@ literal returns [Expression e] e=string_literal | e=array_literal | e=hash_literal | - //e=closure_expression | e=re_literal | e=bool_literal | e=null_literal | @@ -1755,10 +1753,8 @@ integer_literal returns [IntegerLiteralExpression e] string_literal returns [Expression e] { }: - dqs:DOUBLE_QUOTED_STRING - { - e = StringLiteralExpression(ToLexicalInfo(dqs), dqs.getText()) - } + (dqs:DOUBLE_QUOTED_STRING { s = dqs; } | sqs:SINGLE_QUOTED_STRING { s = sqs; }) + { e = StringLiteralExpression(ToLexicalInfo(s), s.getText()) } ; @@ -1917,8 +1913,18 @@ DOUBLE_QUOTED_STRING: '"'! ; +SINGLE_QUOTED_STRING: + '\''! + ( + SQS_ESC | + ~('\'' | '\\' | '\r' | '\n') + )* + '\''! +; + + protected -DQS_ESC: '\\'! ( SESC | '"' | '$') ; +DQS_ESC: '\\'! ( SESC | '"' ) ; protected SQS_ESC: '\\'! ( SESC | '\'' ); diff --git a/tests/parser/strings.js b/tests/parser/strings.js new file mode 100644 index 0000000..e7ce5eb --- /dev/null +++ b/tests/parser/strings.js @@ -0,0 +1,6 @@ +/* +s = '\'this\' is a string' +s = 'and so is "this"' +*/ +s = "'this' is a string"; +s = 'and so is "this"'; From 02951a4f8e8ca158cd6a6e6a37d47974fa733344 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sun, 26 Sep 2010 10:55:36 -0300 Subject: [PATCH 095/276] sanity check for primitive array initializers in static fields --- src/UnityScript.Tests/DuckyIntegrationTestFixture.boo | 4 ++++ src/UnityScript.Tests/StrictIntegrationTestFixture.boo | 4 ++++ tests/integration/array-initializer-in-static-field.js | 6 ++++++ 3 files changed, 14 insertions(+) create mode 100644 tests/integration/array-initializer-in-static-field.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 6f15886..29ee49e 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -99,6 +99,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-implicit-from-null.js") + [Test] def array_initializer_in_static_field(): + RunTestCase("tests/integration/array-initializer-in-static-field.js") + + [Test] def array_instantiation_with_object_argument_in_strict_mode(): RunTestCase("tests/integration/array-instantiation-with-object-argument-in-strict-mode.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index bdf9144..2230140 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -101,6 +101,10 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-implicit-from-null.js") + [Test] def array_initializer_in_static_field(): + RunTestCase("tests/integration/array-initializer-in-static-field.js") + + [Test] def array_instantiation_with_object_argument_in_strict_mode(): RunTestCase("tests/integration/array-instantiation-with-object-argument-in-strict-mode.js") diff --git a/tests/integration/array-initializer-in-static-field.js b/tests/integration/array-initializer-in-static-field.js new file mode 100644 index 0000000..9a07c48 --- /dev/null +++ b/tests/integration/array-initializer-in-static-field.js @@ -0,0 +1,6 @@ +/* +1, 2, 3, 4 +*/ +static var a:int[] = [1, 2, 3, 4]; + +print(String.Join(", ", [i.ToString() for (i in a)])); From 7db09d0386edc89c5484a558b5254a4dd8e28ef7 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 1 Oct 2010 23:21:02 -0300 Subject: [PATCH 096/276] unused import --- src/us/us.boo | 1 - 1 file changed, 1 deletion(-) diff --git a/src/us/us.boo b/src/us/us.boo index 01da066..6e79d11 100755 --- a/src/us/us.boo +++ b/src/us/us.boo @@ -2,7 +2,6 @@ namespace us import System import System.Reflection -import System.IO import Boo.Lang.Compiler def Main([required] argv as (string)) as int: From dac353a370042d4bc81186ecede63d11f1b07f5f Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 12 Oct 2010 12:00:49 -0300 Subject: [PATCH 097/276] flag assignment errors to avoid cascading error reports --- src/UnityScript/Steps/ProcessUnityScriptMethods.boo | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index 9eac235..b53a3f4 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -179,8 +179,10 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): override def ProcessStaticallyTypedAssignment(node as BinaryExpression): TryToResolveAmbiguousAssignment(node) ApplyImplicitArrayConversion(node) - ValidateAssignment(node) - BindExpressionType(node, GetExpressionType(node.Right)) + if ValidateAssignment(node): + BindExpressionType(node, GetExpressionType(node.Right)) + else: + Error(node) def ApplyImplicitArrayConversion(node as BinaryExpression): left = GetExpressionType(node.Left) From 1b21d93c42dc4a570c2d526644acfd3cae2bab70 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 12 Oct 2010 14:30:31 -0300 Subject: [PATCH 098/276] unused import --- src/us/us.boo | 1 - 1 file changed, 1 deletion(-) diff --git a/src/us/us.boo b/src/us/us.boo index 01da066..6e79d11 100755 --- a/src/us/us.boo +++ b/src/us/us.boo @@ -2,7 +2,6 @@ namespace us import System import System.Reflection -import System.IO import Boo.Lang.Compiler def Main([required] argv as (string)) as int: From d4037555bb3eb2ae1c9ae643bee2ab9c7cbe45bc Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 12 Oct 2010 14:34:09 -0300 Subject: [PATCH 099/276] final/static/internal class modifiers; annotations on enum declarations and values; class nested enum declarations; --- .../ParserTestFixture.Generated.boo | 12 + src/UnityScript/Parser/UnityScriptLexer.boo | 102 +- src/UnityScript/Parser/UnityScriptParser.boo | 1218 +++++++++-------- src/UnityScript/UnityScript.g | 85 +- tests/parser/class-modifiers.js | 25 + tests/parser/enums.js | 33 + tests/parser/nested-enums.js | 34 + 7 files changed, 807 insertions(+), 702 deletions(-) create mode 100644 tests/parser/class-modifiers.js create mode 100644 tests/parser/enums.js create mode 100644 tests/parser/nested-enums.js diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index 01b5e4d..f986f87 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -22,10 +22,18 @@ partial class ParserTestFixture: RunTestCase("tests/parser/class-2.js") + [Test] def class_modifiers(): + RunTestCase("tests/parser/class-modifiers.js") + + [Test] def commentbug(): RunTestCase("tests/parser/commentbug.js") + [Test] def enums(): + RunTestCase("tests/parser/enums.js") + + [Test] def final_1(): RunTestCase("tests/parser/final-1.js") @@ -138,6 +146,10 @@ partial class ParserTestFixture: RunTestCase("tests/parser/lambdas.js") + [Test] def nested_enums(): + RunTestCase("tests/parser/nested-enums.js") + + [Test] def new_1(): RunTestCase("tests/parser/new-1.js") diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index fce5a4a..77c0157 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -584,8 +584,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mDIGIT(false) else: // line 1969 - goto _loop312_breakloop - :_loop312_breakloop + goto _loop315_breakloop + :_loop315_breakloop _ttype = testLiteralsTable(_ttype) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -678,17 +678,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): match("0x") - _cnt316 as int = 0 + _cnt319 as int = 0 while true: if ((tokenSet_0_.member(cast(int, cached_LA1)))): mHEXDIGIT(false) else: - if (_cnt316 >= 1): - goto _loop316_breakloop + if (_cnt319 >= 1): + goto _loop319_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt316 - :_loop316_breakloop + ++_cnt319 + :_loop319_breakloop if ((cached_LA1==char('L') or cached_LA1==char('l'))): _givenValue = cached_LA1 if ((_givenValue == char('l'))): // 1831 @@ -702,17 +702,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): else: // line 2053 pass // 947 elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt320 as int = 0 + _cnt323 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt320 >= 1): - goto _loop320_breakloop + if (_cnt323 >= 1): + goto _loop323_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt320 - :_loop320_breakloop + ++_cnt323 + :_loop323_breakloop _givenValue = cached_LA1 if ((_givenValue == char('L')) or (_givenValue ==char('l')) @@ -808,17 +808,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_SUFFIX - _cnt329 as int = 0 + _cnt332 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt329 >= 1): - goto _loop329_breakloop + if (_cnt332 >= 1): + goto _loop332_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt329 - :_loop329_breakloop + ++_cnt332 + :_loop332_breakloop if ((cached_LA1==char('E') or cached_LA1==char('e'))): mEXPONENT(false) else: // line 2053 @@ -869,17 +869,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt336 as int = 0 + _cnt339 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt336 >= 1): - goto _loop336_breakloop + if (_cnt339 >= 1): + goto _loop339_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt336 - :_loop336_breakloop + ++_cnt339 + :_loop339_breakloop if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1351,18 +1351,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched384 as bool = false + synPredMatched387 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m384 as int = mark() - synPredMatched384 = true + _m387 as int = mark() + synPredMatched387 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched384 = false - rewind(_m384) + synPredMatched387 = false + rewind(_m387) --inputState.guessing - if synPredMatched384: + if synPredMatched387: mML_COMMENT(false) if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1375,8 +1375,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop389_breakloop - :_loop389_breakloop + goto _loop392_breakloop + :_loop392_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; elif ((_givenValue == char('='))): // 1831 @@ -1405,8 +1405,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop418_breakloop - :_loop418_breakloop + goto _loop421_breakloop + :_loop421_breakloop match("*/") if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1419,7 +1419,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt393 as int = 0 + _cnt396 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1433,12 +1433,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt393 >= 1): - goto _loop393_breakloop + if (_cnt396 >= 1): + goto _loop396_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt393 - :_loop393_breakloop + ++_cnt396 + :_loop396_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1481,8 +1481,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop397_breakloop - :_loop397_breakloop + goto _loop400_breakloop + :_loop400_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1531,8 +1531,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_4_) else: - goto _loop401_breakloop - :_loop401_breakloop + goto _loop404_breakloop + :_loop404_breakloop _saveIndex = text.Length match('\'') text.Length = _saveIndex @@ -1633,17 +1633,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt421 as int = 0 + _cnt424 as int = 0 while true: if ((tokenSet_5_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt421 >= 1): - goto _loop421_breakloop + if (_cnt424 >= 1): + goto _loop424_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt421 - :_loop421_breakloop + ++_cnt424 + :_loop424_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1701,17 +1701,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt427 as int = 0 + _cnt430 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt427 >= 1): - goto _loop427_breakloop + if (_cnt430 >= 1): + goto _loop430_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt427 - :_loop427_breakloop + ++_cnt430 + :_loop430_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 51d2f74..b02f01e 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -379,39 +379,54 @@ class UnityScriptParser(antlr.LLkParser): raise public def module_member( - m as Module + module as Module ) as void: //throws RecognitionException, TokenStreamException + globals = module.Globals try: // for error handling - _givenValue = LA(1) - if ((_givenValue == CLASS) - or (_givenValue ==PARTIAL) - ): // 1827 - class_declaration(m) - elif ((_givenValue == INTERFACE)): // 1831 - interface_declaration(m) - elif ((_givenValue == ENUM)): // 1831 - enum_declaration(m) - elif ((_givenValue == FINAL) - or (_givenValue ==FUNCTION) - or (_givenValue ==PUBLIC) - or (_givenValue ==PROTECTED) - or (_givenValue ==INTERNAL) - or (_givenValue ==PRIVATE) - or (_givenValue ==STATIC) - or (_givenValue ==VAR) - or (_givenValue ==VIRTUAL) - ): // 1827 - module_function_or_field(m) - elif ((_givenValue == SCRIPT_ATTRIBUTE_MARKER)): // 1831 - script_attribute(m) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) + synPredMatched28 as bool = false + if (((tokenSet_7_.member(cast(int, LA(1)))) and (tokenSet_8_.member(cast(int, LA(2))))) and (GlobalVariablesBecomeFields())): + _m28 as int = mark() + synPredMatched28 = true + ++inputState.guessing + try: + module_member_modifiers() + match(VAR) + except x as RecognitionException: + synPredMatched28 = false + rewind(_m28) + --inputState.guessing + if synPredMatched28: + module_field(module) + elif ((LA(1)==VAR) and (LA(2)==ID)): // line 2102 + declaration_statement(globals) + eos() + elif ((LA(1)==SCRIPT_ATTRIBUTE_MARKER)): // line 2102 + script_attribute(module) + elif ((tokenSet_9_.member(cast(int, LA(1)))) and (tokenSet_10_.member(cast(int, LA(2))))): // line 2102 + mod=module_member_modifiers() + _givenValue = LA(1) + if ((_givenValue == CLASS) + or (_givenValue ==PARTIAL) + ): // 1827 + mm=class_declaration(module) + elif ((_givenValue == INTERFACE)): // 1831 + mm=interface_declaration(module) + elif ((_givenValue == ENUM)): // 1831 + mm=enum_declaration(module) + elif ((_givenValue == FUNCTION)): // 1831 + mm=module_function(module) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + mm.Modifiers |= mod if mm is not null + else: + raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_7_) + recover(ex,tokenSet_11_) else: raise @@ -518,7 +533,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_7_) + recover(ex,tokenSet_11_) else: raise @@ -545,16 +560,16 @@ class UnityScriptParser(antlr.LLkParser): elif ((_givenValue == DOUBLE)): // 1831 e=double_literal() else: // line 1969 - if ((LA(1)==ID) and (tokenSet_8_.member(cast(int, LA(2))))): + if ((LA(1)==ID) and (tokenSet_12_.member(cast(int, LA(2))))): e=attribute_parameter_value_bitwise_expression() - elif ((tokenSet_9_.member(cast(int, LA(1)))) and (tokenSet_10_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 e=typeof_expression() else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_11_) + recover(ex,tokenSet_15_) else: raise return e @@ -583,7 +598,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -613,7 +628,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -641,7 +656,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -659,7 +674,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -677,7 +692,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return rle @@ -705,7 +720,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_11_) + recover(ex,tokenSet_15_) else: raise return e @@ -720,11 +735,11 @@ class UnityScriptParser(antlr.LLkParser): if ((_givenValue == TYPEOF)): // 1831 t = LT(1) match(TYPEOF) - if ((LA(1)==LPAREN) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==LPAREN) and (tokenSet_17_.member(cast(int, LA(2))))): match(LPAREN) arg=expression() match(RPAREN) - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 arg=expression() else: raise NoViableAltException(LT(1), getFilename()) @@ -755,7 +770,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -769,7 +784,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_14_) + recover(ex,tokenSet_18_) else: raise return e @@ -785,12 +800,12 @@ class UnityScriptParser(antlr.LLkParser): match(DOT) e=member_reference_expression(e) else: - goto _loop192_breakloop - :_loop192_breakloop + goto _loop195_breakloop + :_loop195_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_19_) else: raise return e @@ -819,7 +834,7 @@ class UnityScriptParser(antlr.LLkParser): value=attribute_parameter_value() if 0 == inputState.guessing: attr.NamedArguments.Add(ExpressionPair(name, value)) - elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_20_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 value=attribute_parameter_value() if 0 == inputState.guessing: attr.Arguments.Add(value) @@ -828,7 +843,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_11_) + recover(ex,tokenSet_15_) else: raise @@ -843,7 +858,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_22_) else: raise @@ -855,7 +870,7 @@ class UnityScriptParser(antlr.LLkParser): name=qname() if 0 == inputState.guessing: attr = Ast.Attribute(ToLexicalInfo(name), name.getText()) - if ((LA(1)==LPAREN) and (tokenSet_19_.member(cast(int, LA(2))))): + if ((LA(1)==LPAREN) and (tokenSet_23_.member(cast(int, LA(2))))): match(LPAREN) _givenValue = LA(1) if ((_givenValue == FALSE) @@ -884,14 +899,14 @@ class UnityScriptParser(antlr.LLkParser): else: // line 1969 raise NoViableAltException(LT(1), getFilename()) match(RPAREN) - elif ((tokenSet_20_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_20_) + recover(ex,tokenSet_24_) else: raise return attr @@ -918,21 +933,213 @@ class UnityScriptParser(antlr.LLkParser): buffer.Append(".") buffer.Append(other.getText()) else: - goto _loop38_breakloop - :_loop38_breakloop + goto _loop41_breakloop + :_loop41_breakloop if 0 == inputState.guessing: id.setText(buffer.ToString()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_22_) + recover(ex,tokenSet_26_) else: raise return id + public def module_member_modifiers() as TypeMemberModifiers : //throws RecognitionException, TokenStreamException + m as TypeMemberModifiers + + v as IToken = null + m = TypeMemberModifiers.None + + try: // for error handling + while true: + _givenValue = LA(1) + if ((_givenValue == FINAL)): // 1831 + match(FINAL) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Final + elif ((_givenValue == PUBLIC)): // 1831 + match(PUBLIC) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Public + elif ((_givenValue == PRIVATE)): // 1831 + match(PRIVATE) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Private + elif ((_givenValue == PROTECTED)): // 1831 + match(PROTECTED) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Protected + elif ((_givenValue == INTERNAL)): // 1831 + match(INTERNAL) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Internal + elif ((_givenValue == STATIC)): // 1831 + match(STATIC) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Static + elif ((_givenValue == VIRTUAL)): // 1831 + v = LT(1) + match(VIRTUAL) + if 0 == inputState.guessing: + VirtualKeywordHasNoEffect(v) + else: // line 1969 + goto _loop50_breakloop + :_loop50_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_27_) + else: + raise + return m + + public def module_field( + m as Module + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + mod=module_member_modifiers() + f=field_member(m) + if 0 == inputState.guessing: + f.Modifiers |= mod + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_11_) + else: + raise + + public def declaration_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + d=declaration() + _givenValue = LA(1) + if ((_givenValue == ASSIGN)): // 1831 + match(ASSIGN) + i=expression() + elif ((_givenValue == EOF) + or (_givenValue ==BREAK) + or (_givenValue ==CATCH) + or (_givenValue ==CLASS) + or (_givenValue ==CONTINUE) + or (_givenValue ==ELSE) + or (_givenValue ==ENUM) + or (_givenValue ==FALSE) + or (_givenValue ==FINAL) + or (_givenValue ==FINALLY) + or (_givenValue ==FOR) + or (_givenValue ==FUNCTION) + or (_givenValue ==IF) + or (_givenValue ==INTERFACE) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==RETURN) + or (_givenValue ==PUBLIC) + or (_givenValue ==PROTECTED) + or (_givenValue ==INTERNAL) + or (_givenValue ==PARTIAL) + or (_givenValue ==PRIVATE) + or (_givenValue ==STATIC) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==THROW) + or (_givenValue ==TRUE) + or (_givenValue ==TRY) + or (_givenValue ==TYPEOF) + or (_givenValue ==VAR) + or (_givenValue ==VIRTUAL) + or (_givenValue ==WHILE) + or (_givenValue ==YIELD) + or (_givenValue ==SWITCH) + or (_givenValue ==CASE) + or (_givenValue ==DEFAULT) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==RBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==EOS) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==AT) + or (_givenValue ==SCRIPT_ATTRIBUTE_MARKER) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + stmt = DeclarationStatement(d.LexicalInfo, Declaration: d, Initializer: i) + b.Add(stmt) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_28_) + else: + raise + + public def eos() as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + if ((LA(1)==EOS) and (tokenSet_29_.member(cast(int, LA(2))))): + _cnt47 as int = 0 + while true: + if ((LA(1)==EOS) and (tokenSet_29_.member(cast(int, LA(2))))): + match(EOS) + else: + if (_cnt47 >= 1): + goto _loop47_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) + ++_cnt47 + :_loop47_breakloop + elif ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_30_.member(cast(int, LA(2))))): // line 2102 + if 0 == inputState.guessing: + SemicolonExpected() + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_29_) + else: + raise + + public def script_attribute( + m as Module + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + match(SCRIPT_ATTRIBUTE_MARKER) + attr=attribute_constructor() + if 0 == inputState.guessing: + m.Attributes.Add(attr); + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_11_) + else: + raise + public def class_declaration( parent as TypeDefinition - ) as void: //throws RecognitionException, TokenStreamException + ) as TypeMember : //throws RecognitionException, TokenStreamException + member as TypeMember p as IToken = null name as IToken = null @@ -961,7 +1168,7 @@ class UnityScriptParser(antlr.LLkParser): else: // line 1969 raise NoViableAltException(LT(1), getFilename()) if 0 == inputState.guessing: - cd = ClassDefinition(ToLexicalInfo(name), Name: name.getText()) + member = cd = ClassDefinition(ToLexicalInfo(name), Name: name.getText()) baseTypes = cd.BaseTypes if baseType is not null: baseTypes.Add(baseType) @@ -984,13 +1191,14 @@ class UnityScriptParser(antlr.LLkParser): BaseTypeAnnotations.AnnotateImplements(typeRef) match(LBRACE) while true: - if ((tokenSet_23_.member(cast(int, LA(1))))): + if ((tokenSet_31_.member(cast(int, LA(1))))): if 0 == inputState.guessing: mod = TypeMemberModifiers.None _givenValue = LA(1) if ((_givenValue == AT)): // 1831 attributes() - elif ((_givenValue == FINAL) + elif ((_givenValue == ENUM) + or (_givenValue ==FINAL) or (_givenValue ==FUNCTION) or (_givenValue ==NEW) or (_givenValue ==PUBLIC) @@ -1005,9 +1213,9 @@ class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): + if ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_33_.member(cast(int, LA(2))))): mod=member_modifiers() - elif ((LA(1)==FUNCTION or LA(1)==VAR) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==ENUM or LA(1)==FUNCTION or LA(1)==VAR) and (tokenSet_34_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1016,13 +1224,15 @@ class UnityScriptParser(antlr.LLkParser): m=function_member(cd) elif ((_givenValue == VAR)): // 1831 m=field_member(cd) + elif ((_givenValue == ENUM)): // 1831 + m=enum_declaration(cd) else: // line 1969 raise NoViableAltException(LT(1), getFilename()) if 0 == inputState.guessing: - m.Modifiers |= mod if m is not null + m.Modifiers |= mod if m is not null else: - goto _loop59_breakloop - :_loop59_breakloop + goto _loop62_breakloop + :_loop62_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: @@ -1031,18 +1241,20 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS)): match(EOS) else: - goto _loop61_breakloop - :_loop61_breakloop + goto _loop64_breakloop + :_loop64_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_7_) + recover(ex,tokenSet_11_) else: raise + return member public def interface_declaration( parent as TypeDefinition - ) as void: //throws RecognitionException, TokenStreamException + ) as TypeMember : //throws RecognitionException, TokenStreamException + member as TypeMember name as IToken = null rbrace as IToken = null @@ -1052,7 +1264,7 @@ class UnityScriptParser(antlr.LLkParser): name = LT(1) match(ID) if 0 == inputState.guessing: - td = InterfaceDefinition(ToLexicalInfo(name), Name: name.getText()) + member = td = InterfaceDefinition(ToLexicalInfo(name), Name: name.getText()) baseTypes = td.BaseTypes FlushAttributes(td) parent.Members.Add(td) @@ -1076,8 +1288,8 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) interface_member(td) else: - goto _loop66_breakloop - :_loop66_breakloop + goto _loop69_breakloop + :_loop69_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: @@ -1086,18 +1298,20 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS)): match(EOS) else: - goto _loop68_breakloop - :_loop68_breakloop + goto _loop71_breakloop + :_loop71_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_7_) + recover(ex,tokenSet_11_) else: raise + return member public def enum_declaration( container as TypeDefinition - ) as void: //throws RecognitionException, TokenStreamException + ) as TypeMember : //throws RecognitionException, TokenStreamException + member as TypeMember name as IToken = null rbrace as IToken = null @@ -1107,294 +1321,107 @@ class UnityScriptParser(antlr.LLkParser): name = LT(1) match(ID) if 0 == inputState.guessing: - ed = EnumDefinition(ToLexicalInfo(name), Name: name.getText()) + member = ed = EnumDefinition(ToLexicalInfo(name), Name: name.getText()) + FlushAttributes(member); container.Members.Add(ed) match(LBRACE) _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 + if ((_givenValue == ID) + or (_givenValue ==AT) + ): // 1827 enum_member(ed) while true: - if ((LA(1)==COMMA) and (LA(2)==ID)): + if ((LA(1)==COMMA) and (LA(2)==ID or LA(2)==AT)): match(COMMA) enum_member(ed) - else: - goto _loop77_breakloop - :_loop77_breakloop - _givenValue = LA(1) - if ((_givenValue == COMMA)): // 1831 - match(COMMA) - elif ((_givenValue == RBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - elif ((_givenValue == RBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - rbrace = LT(1) - match(RBRACE) - if 0 == inputState.guessing: - SetEndSourceLocation(ed, rbrace) - while true: - if ((LA(1)==EOS)): - match(EOS) - else: - goto _loop80_breakloop - :_loop80_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_7_) - else: - raise - - public def module_function_or_field( - m as Module - ) as void: //throws RecognitionException, TokenStreamException - - globals = m.Globals - - try: // for error handling - synPredMatched30 as bool = false - if (((tokenSet_27_.member(cast(int, LA(1)))) and (tokenSet_28_.member(cast(int, LA(2))))) and (GlobalVariablesBecomeFields())): - _m30 as int = mark() - synPredMatched30 = true - ++inputState.guessing - try: - module_member_modifiers() - match(VAR) - except x as RecognitionException: - synPredMatched30 = false - rewind(_m30) - --inputState.guessing - if synPredMatched30: - module_field(m) - elif ((LA(1)==VAR) and (LA(2)==ID)): // line 2102 - declaration_statement(globals) - eos() - elif ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_30_.member(cast(int, LA(2))))): // line 2102 - module_function(m) - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_7_) - else: - raise - - public def script_attribute( - m as Module - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - match(SCRIPT_ATTRIBUTE_MARKER) - attr=attribute_constructor() - if 0 == inputState.guessing: - m.Attributes.Add(attr); - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_7_) - else: - raise - - public def module_member_modifiers() as TypeMemberModifiers : //throws RecognitionException, TokenStreamException - m as TypeMemberModifiers - - v as IToken = null - m = TypeMemberModifiers.None - - try: // for error handling - while true: - _givenValue = LA(1) - if ((_givenValue == FINAL)): // 1831 - match(FINAL) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Final - elif ((_givenValue == PUBLIC)): // 1831 - match(PUBLIC) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Public - elif ((_givenValue == PRIVATE)): // 1831 - match(PRIVATE) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Private - elif ((_givenValue == PROTECTED)): // 1831 - match(PROTECTED) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Protected - elif ((_givenValue == INTERNAL)): // 1831 - match(INTERNAL) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Internal - elif ((_givenValue == STATIC)): // 1831 - match(STATIC) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Static - elif ((_givenValue == VIRTUAL)): // 1831 - v = LT(1) - match(VIRTUAL) - if 0 == inputState.guessing: - VirtualKeywordHasNoEffect(v) - else: // line 1969 - goto _loop47_breakloop - :_loop47_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_31_) - else: - raise - return m - - public def module_field( - m as Module - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - mod=module_member_modifiers() - f=field_member(m) - if 0 == inputState.guessing: - f.Modifiers |= mod - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_7_) - else: - raise - - public def declaration_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - d=declaration() - _givenValue = LA(1) - if ((_givenValue == ASSIGN)): // 1831 - match(ASSIGN) - i=expression() - elif ((_givenValue == EOF) - or (_givenValue ==BREAK) - or (_givenValue ==CATCH) - or (_givenValue ==CLASS) - or (_givenValue ==CONTINUE) - or (_givenValue ==ELSE) - or (_givenValue ==ENUM) - or (_givenValue ==FALSE) - or (_givenValue ==FINAL) - or (_givenValue ==FINALLY) - or (_givenValue ==FOR) - or (_givenValue ==FUNCTION) - or (_givenValue ==IF) - or (_givenValue ==INTERFACE) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==RETURN) - or (_givenValue ==PUBLIC) - or (_givenValue ==PROTECTED) - or (_givenValue ==INTERNAL) - or (_givenValue ==PARTIAL) - or (_givenValue ==PRIVATE) - or (_givenValue ==STATIC) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==THROW) - or (_givenValue ==TRUE) - or (_givenValue ==TRY) - or (_givenValue ==TYPEOF) - or (_givenValue ==VAR) - or (_givenValue ==VIRTUAL) - or (_givenValue ==WHILE) - or (_givenValue ==YIELD) - or (_givenValue ==SWITCH) - or (_givenValue ==CASE) - or (_givenValue ==DEFAULT) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==RBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==EOS) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==AT) - or (_givenValue ==SCRIPT_ATTRIBUTE_MARKER) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 + else: + goto _loop80_breakloop + :_loop80_breakloop + _givenValue = LA(1) + if ((_givenValue == COMMA)): // 1831 + match(COMMA) + elif ((_givenValue == RBRACE)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) + rbrace = LT(1) + match(RBRACE) if 0 == inputState.guessing: - stmt = DeclarationStatement(d.LexicalInfo, Declaration: d, Initializer: i) - b.Add(stmt) + SetEndSourceLocation(ed, rbrace) + while true: + if ((LA(1)==EOS)): + match(EOS) + else: + goto _loop83_breakloop + :_loop83_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_35_) else: raise + return member - public def eos() as void: //throws RecognitionException, TokenStreamException + public def module_function( + parent as TypeDefinition + ) as TypeMember : //throws RecognitionException, TokenStreamException + member as TypeMember + name as IToken = null try: // for error handling - if ((LA(1)==EOS) and (tokenSet_33_.member(cast(int, LA(2))))): - _cnt44 as int = 0 - while true: - if ((LA(1)==EOS) and (tokenSet_33_.member(cast(int, LA(2))))): - match(EOS) - else: - if (_cnt44 >= 1): - goto _loop44_breakloop - else: - raise NoViableAltException(LT(1), getFilename()) - ++_cnt44 - :_loop44_breakloop - elif ((tokenSet_33_.member(cast(int, LA(1)))) and (tokenSet_34_.member(cast(int, LA(2))))): // line 2102 - if 0 == inputState.guessing: - SemicolonExpected() - else: - raise NoViableAltException(LT(1), getFilename()) + match(FUNCTION) + name = LT(1) + match(ID) + if 0 == inputState.guessing: + member = method = Method(ToLexicalInfo(name), Name: name.getText()) + FlushAttributes(method) + parent.Members.Add(method) + function_body(method) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_33_) + recover(ex,tokenSet_11_) else: raise + return member - public def module_function( - parent as TypeDefinition + public def function_body( + method as Method ) as void: //throws RecognitionException, TokenStreamException - name as IToken = null try: // for error handling - mod=module_member_modifiers() - match(FUNCTION) - name = LT(1) - match(ID) + match(LPAREN) + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + parameter_declaration_list(method) + elif ((_givenValue == RPAREN)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RPAREN) + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + if 0 == inputState.guessing: + method.ReturnType = tr; + elif ((_givenValue == LBRACE)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + compound_statement(method.Body) if 0 == inputState.guessing: - method = Method(ToLexicalInfo(name), Name: name.getText()) - method.Modifiers = mod - FlushAttributes(method) - parent.Members.Add(method) - function_body(method) + method.EndSourceLocation = method.Body.EndSourceLocation except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_7_) + recover(ex,tokenSet_35_) else: raise @@ -1563,7 +1590,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_28_) else: raise @@ -1577,10 +1604,10 @@ class UnityScriptParser(antlr.LLkParser): f = LT(1) match(FOR) match(LPAREN) - synPredMatched127 as bool = false + synPredMatched130 as bool = false if ((LA(1)==VAR or LA(1)==ID) and (LA(2)==IN or LA(2)==ID)): - _m127 as int = mark() - synPredMatched127 = true + _m130 as int = mark() + synPredMatched130 = true ++inputState.guessing try: _givenValue = LA(1) @@ -1592,10 +1619,10 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) match(IN) except x as RecognitionException: - synPredMatched127 = false - rewind(_m127) + synPredMatched130 = false + rewind(_m130) --inputState.guessing - if synPredMatched127: + if synPredMatched130: stmt=for_in(container) elif ((tokenSet_36_.member(cast(int, LA(1)))) and (tokenSet_37_.member(cast(int, LA(2))))): // line 2102 stmt=for_c(container) @@ -1606,7 +1633,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_28_) else: raise @@ -1632,14 +1659,14 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: b = s.FalseBlock = Block(ToLexicalInfo(et)) compound_or_single_stmt(b) - elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_28_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_28_) else: raise @@ -1685,18 +1712,18 @@ class UnityScriptParser(antlr.LLkParser): tr = null compound_or_single_stmt(b) else: - goto _loop153_breakloop - :_loop153_breakloop + goto _loop156_breakloop + :_loop156_breakloop if ((LA(1)==FINALLY) and (tokenSet_38_.member(cast(int, LA(2))))): finally_block(s) - elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_28_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_28_) else: raise @@ -1739,22 +1766,22 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: item.Arguments.Add(e); else: - goto _loop141_breakloop - :_loop141_breakloop - _cnt143 as int = 0 + goto _loop144_breakloop + :_loop144_breakloop + _cnt146 as int = 0 while true: if ((tokenSet_38_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt143 >= 1): - goto _loop143_breakloop + if (_cnt146 >= 1): + goto _loop146_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt143 - :_loop143_breakloop + ++_cnt146 + :_loop146_breakloop else: - goto _loop144_breakloop - :_loop144_breakloop + goto _loop147_breakloop + :_loop147_breakloop _givenValue = LA(1) if ((_givenValue == DEFAULT)): // 1831 d = LT(1) @@ -1764,32 +1791,32 @@ class UnityScriptParser(antlr.LLkParser): item = MacroStatement(ToLexicalInfo(d), Name: d.getText()) itemBlock = item.Body switchBlock.Add(item) - _cnt147 as int = 0 + _cnt150 as int = 0 while true: if ((tokenSet_38_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt147 >= 1): - goto _loop147_breakloop + if (_cnt150 >= 1): + goto _loop150_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt147 - :_loop147_breakloop + ++_cnt150 + :_loop150_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) match(RBRACE) while true: - if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_28_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop149_breakloop - :_loop149_breakloop + goto _loop152_breakloop + :_loop152_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_28_) else: raise @@ -1805,7 +1832,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_28_) else: raise @@ -1818,9 +1845,9 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling yt = LT(1) match(YIELD) - if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_39_.member(cast(int, LA(2))))): + if ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_39_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_28_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1829,7 +1856,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_28_) else: raise @@ -1842,9 +1869,9 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling ret = LT(1) match(RETURN) - if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_39_.member(cast(int, LA(2))))): + if ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_39_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_28_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1853,7 +1880,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_28_) else: raise @@ -1871,7 +1898,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_28_) else: raise @@ -1894,7 +1921,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_28_) else: raise @@ -1907,9 +1934,9 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling t = LT(1) match(THROW) - if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_39_.member(cast(int, LA(2))))): + if ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_39_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_28_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1918,7 +1945,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_28_) else: raise @@ -1969,12 +1996,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: VirtualKeywordHasNoEffect(v) else: // line 1969 - goto _loop50_breakloop - :_loop50_breakloop + goto _loop53_breakloop + :_loop53_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_31_) + recover(ex,tokenSet_40_) else: raise return m @@ -1996,14 +2023,14 @@ class UnityScriptParser(antlr.LLkParser): match(RBRACK) if 0 == inputState.guessing: tr = ArrayTypeReference(tr.LexicalInfo, tr); - elif ((tokenSet_40_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_41_.member(cast(int, LA(1)))) and (tokenSet_42_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_40_) + recover(ex,tokenSet_41_) else: raise return tr @@ -2024,12 +2051,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: typeReferences.Add(tr) else: - goto _loop177_breakloop - :_loop177_breakloop + goto _loop180_breakloop + :_loop180_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_42_) + recover(ex,tokenSet_43_) else: raise @@ -2091,7 +2118,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_43_) + recover(ex,tokenSet_44_) else: raise return member @@ -2137,12 +2164,12 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS)): match(EOS) else: - goto _loop73_breakloop - :_loop73_breakloop + goto _loop76_breakloop + :_loop76_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_44_) + recover(ex,tokenSet_45_) else: raise @@ -2158,12 +2185,12 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) parameter_declaration(m) else: - goto _loop95_breakloop - :_loop95_breakloop + goto _loop98_breakloop + :_loop98_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_45_) + recover(ex,tokenSet_46_) else: raise @@ -2174,6 +2201,13 @@ class UnityScriptParser(antlr.LLkParser): name as IToken = null try: // for error handling + _givenValue = LA(1) + if ((_givenValue == AT)): // 1831 + attributes() + elif ((_givenValue == ID)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) name = LT(1) match(ID) _givenValue = LA(1) @@ -2187,14 +2221,13 @@ class UnityScriptParser(antlr.LLkParser): else: // line 1969 raise NoViableAltException(LT(1), getFilename()) if 0 == inputState.guessing: - em = EnumMember(ToLexicalInfo(name), - Name: name.getText(), - Initializer: initializer) + em = EnumMember(ToLexicalInfo(name), Name: name.getText(), Initializer: initializer) + FlushAttributes(em) container.Members.Add(em) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_46_) + recover(ex,tokenSet_47_) else: raise @@ -2221,7 +2254,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_47_) + recover(ex,tokenSet_48_) else: raise return token @@ -2235,46 +2268,11 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e - public def function_body( - method as Method - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - match(LPAREN) - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - parameter_declaration_list(method) - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RPAREN) - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - if 0 == inputState.guessing: - method.ReturnType = tr; - elif ((_givenValue == LBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - compound_statement(method.Body) - if 0 == inputState.guessing: - method.EndSourceLocation = method.Body.EndSourceLocation - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_35_) - else: - raise - public def compound_statement( b as Block ) as void: //throws RecognitionException, TokenStreamException @@ -2283,15 +2281,15 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling block(b) while true: - if ((LA(1)==EOS) and (tokenSet_48_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_49_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop101_breakloop - :_loop101_breakloop + goto _loop104_breakloop + :_loop104_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_48_) + recover(ex,tokenSet_49_) else: raise @@ -2320,7 +2318,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_11_) + recover(ex,tokenSet_15_) else: raise @@ -2330,16 +2328,16 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - if ((LA(1)==LBRACE) and (tokenSet_49_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_50_.member(cast(int, LA(2))))): compound_statement(b) - elif ((tokenSet_38_.member(cast(int, LA(1)))) and (tokenSet_50_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_38_.member(cast(int, LA(1)))) and (tokenSet_51_.member(cast(int, LA(2))))): // line 2102 statement(b) else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_28_) else: raise @@ -2441,23 +2439,23 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) eos() elif ((_givenValue == EOS)): // 1831 - _cnt111 as int = 0 + _cnt114 as int = 0 while true: - if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_28_.member(cast(int, LA(2))))): match(EOS) else: - if (_cnt111 >= 1): - goto _loop111_breakloop + if (_cnt114 >= 1): + goto _loop114_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt111 - :_loop111_breakloop + ++_cnt114 + :_loop114_breakloop else: // line 1969 raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_28_) else: raise @@ -2473,8 +2471,8 @@ class UnityScriptParser(antlr.LLkParser): if ((tokenSet_38_.member(cast(int, LA(1))))): statement(b) else: - goto _loop104_breakloop - :_loop104_breakloop + goto _loop107_breakloop + :_loop107_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: @@ -2482,7 +2480,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise @@ -2565,7 +2563,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_51_) + recover(ex,tokenSet_52_) else: raise return d @@ -2721,7 +2719,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_52_) + recover(ex,tokenSet_53_) else: raise return e @@ -2762,7 +2760,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_28_) else: raise return stmt @@ -2891,7 +2889,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_28_) else: raise return stmt @@ -2907,7 +2905,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -2927,7 +2925,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_28_) else: raise @@ -2938,7 +2936,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=logical_or() - if ((LA(1)==QUESTION_MARK) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==QUESTION_MARK) and (tokenSet_17_.member(cast(int, LA(2))))): qm = LT(1) match(QUESTION_MARK) trueValue=logical_or() @@ -2949,14 +2947,14 @@ class UnityScriptParser(antlr.LLkParser): Condition: e, TrueValue: trueValue, FalseValue: falseValue) - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -2990,7 +2988,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return name @@ -3009,7 +3007,7 @@ class UnityScriptParser(antlr.LLkParser): arguments = gtr.GenericArguments type_reference_list(arguments) match(GREATER_THAN) - elif ((tokenSet_40_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_41_.member(cast(int, LA(1)))) and (tokenSet_42_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: tr = SimpleTypeReference(ToLexicalInfo(typeName), Name: typeName.getText()) else: @@ -3017,7 +3015,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_40_) + recover(ex,tokenSet_41_) else: raise return tr @@ -3039,14 +3037,14 @@ class UnityScriptParser(antlr.LLkParser): returnType=type_reference() if 0 == inputState.guessing: callableTypeRef.ReturnType = returnType - elif ((tokenSet_40_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_41_.member(cast(int, LA(1)))) and (tokenSet_42_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_40_) + recover(ex,tokenSet_41_) else: raise return tr @@ -3072,8 +3070,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) else: - goto _loop169_breakloop - :_loop169_breakloop + goto _loop172_breakloop + :_loop172_breakloop elif ((_givenValue == RPAREN)): // 1831 pass // 947 else: // line 1969 @@ -3082,7 +3080,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_40_) + recover(ex,tokenSet_41_) else: raise @@ -3100,7 +3098,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -3115,7 +3113,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=term() while true: - if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_17_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == ADD)): // 1831 add = LT(1) @@ -3137,12 +3135,12 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop244_breakloop - :_loop244_breakloop + goto _loop247_breakloop + :_loop247_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -3157,7 +3155,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -3167,18 +3165,18 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched181 as bool = false + synPredMatched184 as bool = false if ((LA(1)==NEW) and (LA(2)==ID)): - _m181 as int = mark() - synPredMatched181 = true + _m184 as int = mark() + synPredMatched184 = true ++inputState.guessing try: new_array_expression() except x as RecognitionException: - synPredMatched181 = false - rewind(_m181) + synPredMatched184 = false + rewind(_m184) --inputState.guessing - if synPredMatched181: + if synPredMatched184: e=new_array_expression() elif ((LA(1)==NEW) and (LA(2)==ID)): // line 2102 match(NEW) @@ -3194,7 +3192,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -3240,8 +3238,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ec.Add(e); else: - goto _loop210_breakloop - :_loop210_breakloop + goto _loop213_breakloop + :_loop213_breakloop elif ((_givenValue == RPAREN) or (_givenValue ==RBRACK) ): // 1827 @@ -3251,7 +3249,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_54_) + recover(ex,tokenSet_55_) else: raise @@ -3281,18 +3279,18 @@ class UnityScriptParser(antlr.LLkParser): else: // line 1969 if ((LA(1)==FUNCTION) and (LA(2)==LPAREN)): e=function_expression() - elif ((LA(1)==ID) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==ID) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 e=simple_reference_expression() - elif ((LA(1)==LPAREN) and (tokenSet_13_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==LPAREN) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 e=paren_expression() - elif ((tokenSet_9_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 e=typeof_expression() else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -3334,7 +3332,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -3393,9 +3391,9 @@ class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((LA(1)==LBRACE) and (tokenSet_49_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_50_.member(cast(int, LA(2))))): block(body) - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 returnValue=expression() if 0 == inputState.guessing: body.Add(returnValue) @@ -3404,7 +3402,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -3422,7 +3420,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -3457,7 +3455,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -3598,7 +3596,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_55_) + recover(ex,tokenSet_56_) else: raise @@ -3615,7 +3613,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=atom() while true: - if ((LA(1)==LBRACK) and (tokenSet_56_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACK) and (tokenSet_57_.member(cast(int, LA(2))))): lbrack = LT(1) match(LBRACK) if 0 == inputState.guessing: @@ -3628,13 +3626,13 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) slice(se) else: - goto _loop226_breakloop - :_loop226_breakloop + goto _loop229_breakloop + :_loop229_breakloop match(RBRACK) - elif ((LA(1)==DOT) and (tokenSet_57_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DOT) and (tokenSet_58_.member(cast(int, LA(2))))): // line 2102 match(DOT) e=member_reference_expression(e) - elif ((LA(1)==LPAREN) and (tokenSet_58_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==LPAREN) and (tokenSet_59_.member(cast(int, LA(2))))): // line 2102 lparen = LT(1) match(LPAREN) if 0 == inputState.guessing: @@ -3645,12 +3643,12 @@ class UnityScriptParser(antlr.LLkParser): expression_list(args) match(RPAREN) else: - goto _loop229_breakloop - :_loop229_breakloop + goto _loop232_breakloop + :_loop232_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -3663,17 +3661,17 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=slicing_expression() - if ((LA(1)==INCREMENT) and (tokenSet_12_.member(cast(int, LA(2))))): + if ((LA(1)==INCREMENT) and (tokenSet_16_.member(cast(int, LA(2))))): postinc = LT(1) match(INCREMENT) if 0 == inputState.guessing: token = postinc; operator = UnaryOperatorType.PostIncrement; - elif ((LA(1)==DECREMENT) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DECREMENT) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 preinc = LT(1) match(DECREMENT) if 0 == inputState.guessing: token = preinc; operator= UnaryOperatorType.PostDecrement; - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3682,7 +3680,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -3737,14 +3735,14 @@ class UnityScriptParser(antlr.LLkParser): tr=type_reference() if 0 == inputState.guessing: e = CastExpression(ToLexicalInfo(c), Target: e, Type: tr) - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -3794,7 +3792,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -3810,7 +3808,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=unary_expression() while true: - if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_17_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == MULTIPLY)): // 1831 m = LT(1) @@ -3837,12 +3835,12 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop240_breakloop - :_loop240_breakloop + goto _loop243_breakloop + :_loop243_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -3856,7 +3854,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=sum() while true: - if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_17_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == SHIFT_LEFT)): // 1831 sl = LT(1) @@ -3874,12 +3872,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop248_breakloop - :_loop248_breakloop + goto _loop251_breakloop + :_loop251_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -3900,7 +3898,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=shift() while true: - if ((tokenSet_59_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((tokenSet_60_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == IN) or (_givenValue ==LESS_THAN) @@ -3954,12 +3952,12 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop260_breakloop - :_loop260_breakloop + goto _loop263_breakloop + :_loop263_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -3975,7 +3973,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=comparison() while true: - if ((tokenSet_60_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((tokenSet_61_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == EQUALITY)): // 1831 te = LT(1) @@ -4003,12 +4001,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), op, e, r) else: - goto _loop268_breakloop - :_loop268_breakloop + goto _loop271_breakloop + :_loop271_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -4021,7 +4019,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=equality() while true: - if ((LA(1)==BITWISE_AND) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_AND) and (tokenSet_17_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_AND) if 0 == inputState.guessing: @@ -4030,12 +4028,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop271_breakloop - :_loop271_breakloop + goto _loop274_breakloop + :_loop274_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -4048,7 +4046,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_and() while true: - if ((LA(1)==BITWISE_XOR) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_XOR) and (tokenSet_17_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_XOR) if 0 == inputState.guessing: @@ -4057,12 +4055,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop274_breakloop - :_loop274_breakloop + goto _loop277_breakloop + :_loop277_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -4075,7 +4073,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_xor() while true: - if ((LA(1)==BITWISE_OR) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_OR) and (tokenSet_17_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_OR) if 0 == inputState.guessing: @@ -4084,12 +4082,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop277_breakloop - :_loop277_breakloop + goto _loop280_breakloop + :_loop280_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -4102,7 +4100,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_or() while true: - if ((LA(1)==LOGICAL_AND) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==LOGICAL_AND) and (tokenSet_17_.member(cast(int, LA(2))))): op = LT(1) match(LOGICAL_AND) rhs=bitwise_or() @@ -4112,12 +4110,12 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop280_breakloop - :_loop280_breakloop + goto _loop283_breakloop + :_loop283_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -4130,7 +4128,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=logical_and() while true: - if ((LA(1)==LOGICAL_OR) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==LOGICAL_OR) and (tokenSet_17_.member(cast(int, LA(2))))): op = LT(1) match(LOGICAL_OR) rhs=logical_and() @@ -4140,12 +4138,12 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop283_breakloop - :_loop283_breakloop + goto _loop286_breakloop + :_loop286_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -4159,19 +4157,19 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling lbrack = LT(1) match(LBRACK) - synPredMatched291 as bool = false - if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_61_.member(cast(int, LA(2))))): - _m291 as int = mark() - synPredMatched291 = true + synPredMatched294 as bool = false + if ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_62_.member(cast(int, LA(2))))): + _m294 as int = mark() + synPredMatched294 = true ++inputState.guessing try: expression() match(FOR) except x as RecognitionException: - synPredMatched291 = false - rewind(_m291) + synPredMatched294 = false + rewind(_m294) --inputState.guessing - if synPredMatched291: + if synPredMatched294: projection=expression() match(FOR) match(LPAREN) @@ -4197,7 +4195,7 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) - elif ((tokenSet_62_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_63_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)); items = ale.Items; expression_list(items) @@ -4207,7 +4205,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -4258,8 +4256,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dle.Items.Add(pair); else: - goto _loop299_breakloop - :_loop299_breakloop + goto _loop302_breakloop + :_loop302_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 @@ -4268,7 +4266,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return dle @@ -4286,7 +4284,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return re @@ -4304,7 +4302,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -4322,7 +4320,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_16_) else: raise return e @@ -4342,7 +4340,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_46_) + recover(ex,tokenSet_47_) else: raise return ep @@ -4474,7 +4472,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_0_ = BitSet(mk_tokenSet_0_()) private static def mk_tokenSet_1_() as (long): - data = (18040874567090432L, 0L, ) + data = (18040878870448384L, 0L, ) return data public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) private static def mk_tokenSet_2_() as (long): @@ -4494,119 +4492,119 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) private static def mk_tokenSet_6_() as (long): - data = (26482542004480L, 2147483648L, 0L, 0L, ) + data = (18040881051486464L, 2147483648L, 0L, 0L, ) return data public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) private static def mk_tokenSet_7_() as (long): - data = (-8808759441281553630L, 2150705409024L, 0L, 0L, ) + data = (26476057477120L, 0L, ) return data public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) private static def mk_tokenSet_8_() as (long): - data = (6341068275337658368L, 2L, 0L, 0L, ) + data = (18040874566959104L, 0L, ) return data public static final tokenSet_8_ = BitSet(mk_tokenSet_8_()) private static def mk_tokenSet_9_() as (long): - data = (306249172707835904L, 0L, ) + data = (17684267944192L, 0L, ) return data public static final tokenSet_9_ = BitSet(mk_tokenSet_9_()) private static def mk_tokenSet_10_() as (long): - data = (-2467966685823229952L, 2147484183552L, 0L, 0L, ) + data = (18032082777426176L, 0L, ) return data public static final tokenSet_10_ = BitSet(mk_tokenSet_10_()) private static def mk_tokenSet_11_() as (long): - data = (5188146770730811392L, 0L, ) + data = (-8808759441281553630L, 2150705409024L, 0L, 0L, ) return data public static final tokenSet_11_ = BitSet(mk_tokenSet_11_()) private static def mk_tokenSet_12_() as (long): - data = (-42953084942L, 2194728288255L, 0L, 0L, ) + data = (6341068275337658368L, 2L, 0L, 0L, ) return data public static final tokenSet_12_ = BitSet(mk_tokenSet_12_()) private static def mk_tokenSet_13_() as (long): - data = (-8809034961160888320L, 2147484183552L, 0L, 0L, ) + data = (306249172707835904L, 0L, ) return data public static final tokenSet_13_ = BitSet(mk_tokenSet_13_()) private static def mk_tokenSet_14_() as (long): - data = (5188146770730811392L, 2L, 0L, 0L, ) + data = (-2467966685823229952L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_14_ = BitSet(mk_tokenSet_14_()) private static def mk_tokenSet_15_() as (long): - data = (5476377146882523136L, 514L, 0L, 0L, ) + data = (5188146770730811392L, 0L, ) return data public static final tokenSet_15_ = BitSet(mk_tokenSet_15_()) private static def mk_tokenSet_16_() as (long): - data = (342279069305544704L, 2061584302080L, 0L, 0L, ) + data = (-42953084942L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_16_ = BitSet(mk_tokenSet_16_()) private static def mk_tokenSet_17_() as (long): - data = (-2467966685823229952L, 2147484183554L, 0L, 0L, ) + data = (-8809034961160888320L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_17_ = BitSet(mk_tokenSet_17_()) private static def mk_tokenSet_18_() as (long): - data = (26482542004480L, 3221225472L, 0L, 0L, ) + data = (5188146770730811392L, 2L, 0L, 0L, ) return data public static final tokenSet_18_ = BitSet(mk_tokenSet_18_()) private static def mk_tokenSet_19_() as (long): - data = (918739821608968192L, 2061584302080L, 0L, 0L, ) + data = (5476377146882523136L, 514L, 0L, 0L, ) return data public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) private static def mk_tokenSet_20_() as (long): - data = (-8808759439134069982L, 2150705409024L, 0L, 0L, ) + data = (342279069305544704L, 2061584302080L, 0L, 0L, ) return data public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) private static def mk_tokenSet_21_() as (long): - data = (-7494834213467755662L, 2194728288255L, 0L, 0L, ) + data = (-2467966685823229952L, 2147484183554L, 0L, 0L, ) return data public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) private static def mk_tokenSet_22_() as (long): - data = (-42949939214L, 2199023255551L, 0L, 0L, ) + data = (18040881051486464L, 3221225472L, 0L, 0L, ) return data public static final tokenSet_22_ = BitSet(mk_tokenSet_22_()) private static def mk_tokenSet_23_() as (long): - data = (26478238646272L, 1073741824L, 0L, 0L, ) + data = (918739821608968192L, 2061584302080L, 0L, 0L, ) return data public static final tokenSet_23_ = BitSet(mk_tokenSet_23_()) private static def mk_tokenSet_24_() as (long): - data = (26478238646272L, 0L, ) + data = (-8808759439134069982L, 2150705409024L, 0L, 0L, ) return data public static final tokenSet_24_ = BitSet(mk_tokenSet_24_()) private static def mk_tokenSet_25_() as (long): - data = (18040911108128768L, 0L, ) + data = (-2883148195040367758L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_25_ = BitSet(mk_tokenSet_25_()) private static def mk_tokenSet_26_() as (long): - data = (18014432869498880L, 0L, ) + data = (-42949939214L, 2199023255551L, 0L, 0L, ) return data public static final tokenSet_26_ = BitSet(mk_tokenSet_26_()) private static def mk_tokenSet_27_() as (long): - data = (26476057477120L, 0L, ) + data = (8800396511488L, 0L, ) return data public static final tokenSet_27_ = BitSet(mk_tokenSet_27_()) private static def mk_tokenSet_28_() as (long): - data = (18040874566959104L, 0L, ) + data = (-8663799828275531870L, 2150705409280L, 0L, 0L, ) return data public static final tokenSet_28_ = BitSet(mk_tokenSet_28_()) private static def mk_tokenSet_29_() as (long): - data = (17679964585984L, 0L, ) + data = (-8663799826126999646L, 2155000376576L, 0L, 0L, ) return data public static final tokenSet_29_ = BitSet(mk_tokenSet_29_()) private static def mk_tokenSet_30_() as (long): - data = (18032078474067968L, 0L, ) + data = (-3149838L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) private static def mk_tokenSet_31_() as (long): - data = (8796093153280L, 0L, ) + data = (26478238648320L, 1073741824L, 0L, 0L, ) return data public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) private static def mk_tokenSet_32_() as (long): - data = (-8663799828275531870L, 2150705409280L, 0L, 0L, ) + data = (26478238648320L, 0L, ) return data public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) private static def mk_tokenSet_33_() as (long): - data = (-8663799826126999646L, 2155000376576L, 0L, 0L, ) + data = (18040911108130816L, 0L, ) return data public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) private static def mk_tokenSet_34_() as (long): - data = (-3149838L, 2194728288255L, 0L, 0L, ) + data = (18014432869498880L, 0L, ) return data public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) private static def mk_tokenSet_35_() as (long): @@ -4630,95 +4628,99 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) private static def mk_tokenSet_40_() as (long): - data = (-42950987790L, 2194728288255L, 0L, 0L, ) + data = (8796093155328L, 0L, ) return data public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) private static def mk_tokenSet_41_() as (long): - data = (-8590987278L, 2194728288255L, 0L, 0L, ) + data = (-42950987790L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) private static def mk_tokenSet_42_() as (long): - data = (72057594037927936L, 67108864L, 0L, 0L, ) + data = (-8590987278L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) private static def mk_tokenSet_43_() as (long): - data = (144141666314502144L, 1073741824L, 0L, 0L, ) + data = (72057594037927936L, 67108864L, 0L, 0L, ) return data public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) private static def mk_tokenSet_44_() as (long): - data = (144115188075986944L, 1073741824L, 0L, 0L, ) + data = (144141666314504192L, 1073741824L, 0L, 0L, ) return data public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) private static def mk_tokenSet_45_() as (long): - data = (576460752303423488L, 0L, ) + data = (144115188075986944L, 1073741824L, 0L, 0L, ) return data public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) private static def mk_tokenSet_46_() as (long): - data = (4755801206503243776L, 0L, ) + data = (576460752303423488L, 0L, ) return data public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) private static def mk_tokenSet_47_() as (long): - data = (-6358801241844520158L, 2150705409792L, 0L, 0L, ) + data = (4755801206503243776L, 0L, ) return data public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) private static def mk_tokenSet_48_() as (long): - data = (-8663799826128048222L, 2150705409280L, 0L, 0L, ) + data = (-6358801241844520158L, 2150705409792L, 0L, 0L, ) return data public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) private static def mk_tokenSet_49_() as (long): - data = (-8664661937473510880L, 2147484183808L, 0L, 0L, ) + data = (-8663799826128048222L, 2150705409280L, 0L, 0L, ) return data public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) private static def mk_tokenSet_50_() as (long): - data = (-7493989825045073934L, 2194728288255L, 0L, 0L, ) + data = (-8664661937473510880L, 2147484183808L, 0L, 0L, ) return data public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) private static def mk_tokenSet_51_() as (long): - data = (-8663799828271337566L, 2150705409792L, 0L, 0L, ) + data = (-7493989825045073934L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) private static def mk_tokenSet_52_() as (long): - data = (-8087339075972108382L, 2150705409280L, 0L, 0L, ) + data = (-8663799828271337566L, 2150705409792L, 0L, 0L, ) return data public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) private static def mk_tokenSet_53_() as (long): - data = (-8593084430L, 2194728288255L, 0L, 0L, ) + data = (-8087339075972108382L, 2150705409280L, 0L, 0L, ) return data public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) private static def mk_tokenSet_54_() as (long): - data = (576460752303423488L, 1L, 0L, 0L, ) + data = (-8593084430L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) private static def mk_tokenSet_55_() as (long): - data = (4611686018427387904L, 1L, 0L, 0L, ) + data = (576460752303423488L, 1L, 0L, 0L, ) return data public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) private static def mk_tokenSet_56_() as (long): - data = (-6503191951947194368L, 2147484183552L, 0L, 0L, ) + data = (4611686018427387904L, 1L, 0L, 0L, ) return data public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) private static def mk_tokenSet_57_() as (long): - data = (18014432869482496L, 4194304L, 0L, 0L, ) + data = (-6503191951947194368L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) private static def mk_tokenSet_58_() as (long): - data = (-8232574208857464832L, 2147484183552L, 0L, 0L, ) + data = (18014432869482496L, 4194304L, 0L, 0L, ) return data public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) private static def mk_tokenSet_59_() as (long): - data = (20971520L, 213909504L, 0L, 0L, ) + data = (-8232574208857464832L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_59_ = BitSet(mk_tokenSet_59_()) private static def mk_tokenSet_60_() as (long): - data = (0L, 3342336L, 0L, 0L, ) + data = (20971520L, 213909504L, 0L, 0L, ) return data public static final tokenSet_60_ = BitSet(mk_tokenSet_60_()) private static def mk_tokenSet_61_() as (long): - data = (-7511998268457148336L, 2182346702043L, 0L, 0L, ) + data = (0L, 3342336L, 0L, 0L, ) return data public static final tokenSet_61_ = BitSet(mk_tokenSet_61_()) private static def mk_tokenSet_62_() as (long): - data = (-8809034961160888320L, 2147484183553L, 0L, 0L, ) + data = (-7511998268457148336L, 2182346702043L, 0L, 0L, ) return data public static final tokenSet_62_ = BitSet(mk_tokenSet_62_()) + private static def mk_tokenSet_63_() as (long): + data = (-8809034961160888320L, 2147484183553L, 0L, 0L, ) + return data + public static final tokenSet_63_ = BitSet(mk_tokenSet_63_()) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index e4ddb1a..f994c74 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -339,32 +339,45 @@ attribute_constructor returns [Boo.Lang.Compiler.Ast.Attribute attr] )? ; -module_member[Module m] +module_member[Module module] { + globals = module.Globals }: - class_declaration[m] - | interface_declaration[m] - | enum_declaration[m] - | module_function_or_field[m] - | script_attribute[m] + + {GlobalVariablesBecomeFields()}? (module_member_modifiers VAR) => module_field[module] + | (declaration_statement[globals] eos) + | script_attribute[module] + | + ( + mod=module_member_modifiers + ( + mm=class_declaration[module] + | mm=interface_declaration[module] + | mm=enum_declaration[module] + | mm=module_function[module] + ) + { mm.Modifiers |= mod if mm is not null } + ) ; -script_attribute[Module m] +module_function[TypeDefinition parent] returns [TypeMember member] { }: - SCRIPT_ATTRIBUTE_MARKER - attr=attribute_constructor - { m.Attributes.Add(attr); } + FUNCTION name:ID + { + member = method = Method(ToLexicalInfo(name), Name: name.getText()) + FlushAttributes(method) + parent.Members.Add(method) + } + function_body[method] ; -module_function_or_field[Module m] +script_attribute[Module m] { - globals = m.Globals }: - - {GlobalVariablesBecomeFields()}? (module_member_modifiers VAR) => module_field[m] - | declaration_statement[globals] eos - | module_function[m] + SCRIPT_ATTRIBUTE_MARKER + attr=attribute_constructor + { m.Attributes.Add(attr); } ; module_field[Module m] @@ -483,12 +496,12 @@ member_modifiers returns [TypeMemberModifiers m] )* ; -class_declaration[TypeDefinition parent] +class_declaration[TypeDefinition parent] returns [TypeMember member] { }: (p:PARTIAL)? CLASS name:ID (EXTENDS baseType=type_reference)? { - cd = ClassDefinition(ToLexicalInfo(name), Name: name.getText()) + member = cd = ClassDefinition(ToLexicalInfo(name), Name: name.getText()) baseTypes = cd.BaseTypes if baseType is not null: @@ -515,22 +528,21 @@ class_declaration[TypeDefinition parent] (mod=member_modifiers)? ( m=function_member[cd] | - m=field_member[cd] + m=field_member[cd] | + m=enum_declaration[cd] ) - { - m.Modifiers |= mod if m is not null - } + { m.Modifiers |= mod if m is not null } )* rbrace:RBRACE { SetEndSourceLocation(cd, rbrace) } (EOS)* ; -interface_declaration[TypeDefinition parent] +interface_declaration[TypeDefinition parent] returns [TypeMember member] { }: INTERFACE name:ID { - td = InterfaceDefinition(ToLexicalInfo(name), Name: name.getText()) + member = td = InterfaceDefinition(ToLexicalInfo(name), Name: name.getText()) baseTypes = td.BaseTypes FlushAttributes(td) parent.Members.Add(td) @@ -561,12 +573,13 @@ interface_member[TypeDefinition parent] (EOS)* ; -enum_declaration [TypeDefinition container] +enum_declaration [TypeDefinition container] returns [TypeMember member] { }: ENUM name:ID { - ed = EnumDefinition(ToLexicalInfo(name), Name: name.getText()) + member = ed = EnumDefinition(ToLexicalInfo(name), Name: name.getText()) + FlushAttributes(member); container.Members.Add(ed) } LBRACE @@ -585,11 +598,11 @@ enum_declaration [TypeDefinition container] enum_member [EnumDefinition container] { }: + (attributes)? name:ID (ASSIGN initializer=integer_literal)? { - em = EnumMember(ToLexicalInfo(name), - Name: name.getText(), - Initializer: initializer) + em = EnumMember(ToLexicalInfo(name), Name: name.getText(), Initializer: initializer) + FlushAttributes(em) container.Members.Add(em) } ; @@ -657,20 +670,6 @@ function_member[ClassDefinition cd] returns [TypeMember member] } ; -module_function[TypeDefinition parent] -{ -}: - mod=module_member_modifiers - FUNCTION name:ID - { - method = Method(ToLexicalInfo(name), Name: name.getText()) - method.Modifiers = mod - FlushAttributes(method) - parent.Members.Add(method) - } - function_body[method] -; - function_body[Method method] { }: diff --git a/tests/parser/class-modifiers.js b/tests/parser/class-modifiers.js new file mode 100644 index 0000000..0e18f92 --- /dev/null +++ b/tests/parser/class-modifiers.js @@ -0,0 +1,25 @@ +/* +final class C1: + pass + +internal class C2: + pass + +internal final class C3: + pass + +static class C4: + pass +*/ + +final class C1 { +} + +internal class C2 { +} + +internal final class C3 { +} + +static class C4 { +} \ No newline at end of file diff --git a/tests/parser/enums.js b/tests/parser/enums.js new file mode 100644 index 0000000..6f52877 --- /dev/null +++ b/tests/parser/enums.js @@ -0,0 +1,33 @@ +/* +enum E1: + + Foo + + Bar + +public enum E2: + + Foo + + Bar + +[flags] +enum E3: + + [attr] + Foo = 1 + + [attr] + Bar = 2 +*/ +enum E1 { Foo, Bar } +public enum E2 { Foo, Bar } + +@flags +enum E3 { + @attr Foo = 1, + @attr + Bar = 2 +} + + diff --git a/tests/parser/nested-enums.js b/tests/parser/nested-enums.js new file mode 100644 index 0000000..eb96d33 --- /dev/null +++ b/tests/parser/nested-enums.js @@ -0,0 +1,34 @@ +/* +class Container: + + enum E1: + + Foo + + Bar + + public enum E2: + + Foo + + Bar + + [flags] + enum E3: + + Foo = 1 + + Bar = 2 +*/ +class Container { + enum E1 { Foo, Bar } + public enum E2 { Foo, Bar } + + @flags + enum E3 { + Foo = 1, + Bar = 2 + } + +} + From 593482e87b42c614df5b6ef925535e10681575e9 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 12 Oct 2010 15:50:15 -0300 Subject: [PATCH 100/276] classes, enums and interfaces are public by default --- .../AbstractSemanticsTestFixture.boo | 7 +--- .../Steps/ApplyDefaultVisibility.boo | 35 +++++++++++++++++++ src/UnityScript/Steps/ApplySemantics.boo | 27 ++------------ src/UnityScript/UnityScript.booproj | 1 + src/UnityScript/UnityScriptCompiler.boo | 6 ++-- tests/semantics/Magic2Class.js | 2 +- tests/semantics/MagicClass.js | 2 +- tests/semantics/class-3.js | 4 +-- tests/semantics/coroutine.js | 2 +- tests/semantics/fields-1.js | 4 +-- tests/semantics/functions-2.js | 2 +- tests/semantics/magic-members.js | 2 +- tests/semantics/single-update-function.js | 2 +- tests/semantics/variables.js | 2 +- 14 files changed, 55 insertions(+), 43 deletions(-) create mode 100644 src/UnityScript/Steps/ApplyDefaultVisibility.boo diff --git a/src/UnityScript.Tests/AbstractSemanticsTestFixture.boo b/src/UnityScript.Tests/AbstractSemanticsTestFixture.boo index 4312319..0e2775d 100755 --- a/src/UnityScript.Tests/AbstractSemanticsTestFixture.boo +++ b/src/UnityScript.Tests/AbstractSemanticsTestFixture.boo @@ -1,6 +1,5 @@ namespace UnityScript.Tests -import Boo.Lang.Compiler import NUnit.Framework class AbstractSemanticsTestFixture(AbstractCompilerTestFixture): @@ -11,8 +10,4 @@ class AbstractSemanticsTestFixture(AbstractCompilerTestFixture): _compiler.Parameters.Imports.Add("UnityScript.Tests") override protected def CreateCompilerPipeline(): - pipeline = CompilerPipeline() - pipeline.Add(UnityScript.Steps.Parse()) - pipeline.Add(Boo.Lang.Compiler.Steps.PreErrorChecking()) - pipeline.Add(UnityScript.Steps.ApplySemantics()) - return pipeline + return UnityScript.UnityScriptCompiler.Pipelines.Parse() diff --git a/src/UnityScript/Steps/ApplyDefaultVisibility.boo b/src/UnityScript/Steps/ApplyDefaultVisibility.boo new file mode 100644 index 0000000..d048750 --- /dev/null +++ b/src/UnityScript/Steps/ApplyDefaultVisibility.boo @@ -0,0 +1,35 @@ +namespace UnityScript.Steps + +import Boo.Lang.Compiler.Ast +import Boo.Lang.Compiler.Steps + +class ApplyDefaultVisibility(AbstractVisitorCompilerStep): + + override def Run(): + Visit(CompileUnit) + + override def LeaveEnumDefinition(node as EnumDefinition): + SetPublicByDefault(node) + + override def LeaveInterfaceDefinition(node as InterfaceDefinition): + SetPublicByDefault(node) + + override def LeaveClassDefinition(node as ClassDefinition): + SetPublicByDefault(node) + + override def OnField(node as Field): + SetPublicByDefault(node) + + override def OnConstructor(node as Constructor): + SetPublicByDefault(node) + + override def OnMethod(node as Method): + if node.IsPrivate: return + + SetPublicByDefault(node) + if node.IsFinal: return + if node.IsStatic: return + node.Modifiers |= TypeMemberModifiers.Virtual + + def SetPublicByDefault(node as TypeMember): + node.Modifiers |= TypeMemberModifiers.Public unless node.IsVisibilitySet \ No newline at end of file diff --git a/src/UnityScript/Steps/ApplySemantics.boo b/src/UnityScript/Steps/ApplySemantics.boo index c0ad8fd..006cc94 100755 --- a/src/UnityScript/Steps/ApplySemantics.boo +++ b/src/UnityScript/Steps/ApplySemantics.boo @@ -41,7 +41,7 @@ class ApplySemantics(AbstractVisitorCompilerStep): SetUpDefaultImports(module) script = FindOrCreateScriptClass(module) - SetUpScriptClass(script) + MakeItPartial(script) MoveMembers(module, script) SetUpMainMethod(module, script) MoveAttributes(module, script) @@ -75,9 +75,8 @@ class ApplySemantics(AbstractVisitorCompilerStep): and len(method.Parameters) == 0 return method if isMainMethod - def SetUpScriptClass(global as ClassDefinition): - global.Modifiers |= TypeMemberModifiers.Partial - SetMembersPublicByDefault(global) + def MakeItPartial(global as ClassDefinition): + global.Modifiers |= TypeMemberModifiers.Partial def SetUpDefaultImports(module as Module): for ns as string in self.UnityScriptParameters.Imports: @@ -120,20 +119,6 @@ class ApplySemantics(AbstractVisitorCompilerStep): LexicalInfo: method.LexicalInfo, EndSourceLocation: method.EndSourceLocation) - override def OnField(node as Field): - SetPublicByDefault(node) - - override def OnConstructor(node as Constructor): - SetPublicByDefault(node) - - override def OnMethod(node as Method): - if node.IsPrivate: return - - SetPublicByDefault(node) - if node.IsFinal: return - if node.IsStatic: return - node.Modifiers |= TypeMemberModifiers.Virtual - def FindOrCreateScriptClass(module as Module): for existing as ClassDefinition in module.Members.Select(NodeType.ClassDefinition): if existing.Name == module.Name: @@ -149,12 +134,6 @@ class ApplySemantics(AbstractVisitorCompilerStep): def AddScriptBaseType(klass as ClassDefinition): klass.BaseTypes.Add(CodeBuilder.CreateTypeReference(UnityScriptParameters.ScriptBaseType)) - def SetMembersPublicByDefault(node as ClassDefinition): - for member in node.Members: Visit(member) - - def SetPublicByDefault(node as TypeMember): - node.Modifiers |= TypeMemberModifiers.Public unless node.IsVisibilitySet - ScriptMainMethod: get: return self.UnityScriptParameters.ScriptMainMethod diff --git a/src/UnityScript/UnityScript.booproj b/src/UnityScript/UnityScript.booproj index f7fe2a7..a1b6222 100755 --- a/src/UnityScript/UnityScript.booproj +++ b/src/UnityScript/UnityScript.booproj @@ -82,6 +82,7 @@ + diff --git a/src/UnityScript/UnityScriptCompiler.boo b/src/UnityScript/UnityScriptCompiler.boo index 781019d..54ad4b9 100755 --- a/src/UnityScript/UnityScriptCompiler.boo +++ b/src/UnityScript/UnityScriptCompiler.boo @@ -20,7 +20,7 @@ class UnityScriptCompiler: return CompilerPipeline() { UnityScript.Steps.PreProcess(), UnityScript.Steps.Parse() } def Parse(): - return RawParsing() { UnityScript.Steps.ApplySemantics() } + return RawParsing() { UnityScript.Steps.ApplySemantics(), UnityScript.Steps.ApplyDefaultVisibility() } def Compile(): return AdjustBooPipeline(Boo.Lang.Compiler.Pipelines.Compile()) @@ -43,7 +43,9 @@ class UnityScriptCompiler: UnityScript.Steps.IntroduceUnityGlobalNamespaces()) pipeline.InsertAfter(Boo.Lang.Compiler.Steps.PreErrorChecking, - UnityScript.Steps.ApplySemantics()) + UnityScript.Steps.ApplySemantics()) + pipeline.InsertAfter(UnityScript.Steps.ApplySemantics, + UnityScript.Steps.ApplyDefaultVisibility()) pipeline.InsertBefore(Boo.Lang.Compiler.Steps.ExpandDuckTypedExpressions, UnityScript.Steps.ProcessAssignmentToDuckMembers()) diff --git a/tests/semantics/Magic2Class.js b/tests/semantics/Magic2Class.js index 47ce26f..eaea32a 100755 --- a/tests/semantics/Magic2Class.js +++ b/tests/semantics/Magic2Class.js @@ -1,7 +1,7 @@ /* import UnityScript.Tests -partial class Magic2Class: +partial public class Magic2Class: public virtual def foo(): pass diff --git a/tests/semantics/MagicClass.js b/tests/semantics/MagicClass.js index 6d31c23..76be708 100755 --- a/tests/semantics/MagicClass.js +++ b/tests/semantics/MagicClass.js @@ -1,7 +1,7 @@ /* import UnityScript.Tests -partial class MagicClass(AnotherMagicClass): +partial public class MagicClass(AnotherMagicClass): public virtual def foo(): pass diff --git a/tests/semantics/class-3.js b/tests/semantics/class-3.js index f57d535..c3517e6 100755 --- a/tests/semantics/class-3.js +++ b/tests/semantics/class-3.js @@ -1,7 +1,7 @@ /* import UnityScript.Tests -class Person: +public class Person: public _name as string @@ -25,7 +25,7 @@ class Person: public static def StaticFunction(): pass -partial class class-3(UnityScript.Tests.MonoBehaviour): +partial public class class-3(UnityScript.Tests.MonoBehaviour): public p as Person = Person('Eric Idle', 42) diff --git a/tests/semantics/coroutine.js b/tests/semantics/coroutine.js index d323879..8250bba 100755 --- a/tests/semantics/coroutine.js +++ b/tests/semantics/coroutine.js @@ -1,7 +1,7 @@ /* import UnityScript.Tests -partial class coroutine(UnityScript.Tests.MonoBehaviour): +partial public class coroutine(UnityScript.Tests.MonoBehaviour): private def spam(): yield diff --git a/tests/semantics/fields-1.js b/tests/semantics/fields-1.js index 41cb3f8..e357c7e 100644 --- a/tests/semantics/fields-1.js +++ b/tests/semantics/fields-1.js @@ -1,13 +1,13 @@ /* import UnityScript.Tests -class Fields: +public class Fields: public FirstName as string public LastName as string -partial class fields-1(UnityScript.Tests.MonoBehaviour): +partial public class fields-1(UnityScript.Tests.MonoBehaviour): public virtual def Awake(): pass diff --git a/tests/semantics/functions-2.js b/tests/semantics/functions-2.js index 2a864d5..5a74013 100755 --- a/tests/semantics/functions-2.js +++ b/tests/semantics/functions-2.js @@ -1,7 +1,7 @@ /* import UnityScript.Tests -partial class functions-2(UnityScript.Tests.MonoBehaviour): +partial public class functions-2(UnityScript.Tests.MonoBehaviour): public value = 1 diff --git a/tests/semantics/magic-members.js b/tests/semantics/magic-members.js index 0671b02..6194e7f 100755 --- a/tests/semantics/magic-members.js +++ b/tests/semantics/magic-members.js @@ -1,7 +1,7 @@ /* import UnityScript.Tests -partial class magic-members(UnityScript.Tests.MonoBehaviour): +partial public class magic-members(UnityScript.Tests.MonoBehaviour): public value = 5 diff --git a/tests/semantics/single-update-function.js b/tests/semantics/single-update-function.js index 1f95365..15c9f63 100755 --- a/tests/semantics/single-update-function.js +++ b/tests/semantics/single-update-function.js @@ -1,7 +1,7 @@ /* import UnityScript.Tests -partial class single-update-function(UnityScript.Tests.MonoBehaviour): +partial public class single-update-function(UnityScript.Tests.MonoBehaviour): public virtual def Update(): pass diff --git a/tests/semantics/variables.js b/tests/semantics/variables.js index 5bb9329..500bb6b 100644 --- a/tests/semantics/variables.js +++ b/tests/semantics/variables.js @@ -1,7 +1,7 @@ /* import UnityScript.Tests -partial class variables(UnityScript.Tests.MonoBehaviour): +partial public class variables(UnityScript.Tests.MonoBehaviour): public value = 5 From e844e84f2da7de1a45e536dafe34cebe0238c09b Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 12 Oct 2010 15:51:16 -0300 Subject: [PATCH 101/276] support for nested classes and interfaces --- .../DuckyIntegrationTestFixture.boo | 4 + .../ParserTestFixture.Generated.boo | 8 + .../StrictIntegrationTestFixture.boo | 4 + src/UnityScript/Parser/UnityScriptParser.boo | 143 +++++++++--------- src/UnityScript/UnityScript.g | 8 +- tests/integration/nested-classes.js | 55 +++++++ tests/parser/nested-classes.js | 25 +++ tests/parser/nested-interfaces.js | 25 +++ 8 files changed, 200 insertions(+), 72 deletions(-) create mode 100644 tests/integration/nested-classes.js create mode 100644 tests/parser/nested-classes.js create mode 100644 tests/parser/nested-interfaces.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 6f15886..d51432d 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -431,6 +431,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/nested-class-1.js") + [Test] def nested_classes(): + RunTestCase("tests/integration/nested-classes.js") + + [Test] def new_1(): RunTestCase("tests/integration/new-1.js") diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index f986f87..7b4fd06 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -146,10 +146,18 @@ partial class ParserTestFixture: RunTestCase("tests/parser/lambdas.js") + [Test] def nested_classes(): + RunTestCase("tests/parser/nested-classes.js") + + [Test] def nested_enums(): RunTestCase("tests/parser/nested-enums.js") + [Test] def nested_interfaces(): + RunTestCase("tests/parser/nested-interfaces.js") + + [Test] def new_1(): RunTestCase("tests/parser/new-1.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index bdf9144..a034725 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -433,6 +433,10 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/nested-class-1.js") + [Test] def nested_classes(): + RunTestCase("tests/integration/nested-classes.js") + + [Test] def new_1(): RunTestCase("tests/integration/new-1.js") diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index b02f01e..c812e3c 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -1197,14 +1197,17 @@ class UnityScriptParser(antlr.LLkParser): _givenValue = LA(1) if ((_givenValue == AT)): // 1831 attributes() - elif ((_givenValue == ENUM) + elif ((_givenValue == CLASS) + or (_givenValue ==ENUM) or (_givenValue ==FINAL) or (_givenValue ==FUNCTION) + or (_givenValue ==INTERFACE) or (_givenValue ==NEW) or (_givenValue ==PUBLIC) or (_givenValue ==PROTECTED) or (_givenValue ==INTERNAL) or (_givenValue ==OVERRIDE) + or (_givenValue ==PARTIAL) or (_givenValue ==PRIVATE) or (_givenValue ==STATIC) or (_givenValue ==VAR) @@ -1215,7 +1218,7 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) if ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_33_.member(cast(int, LA(2))))): mod=member_modifiers() - elif ((LA(1)==ENUM or LA(1)==FUNCTION or LA(1)==VAR) and (tokenSet_34_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_27_.member(cast(int, LA(1)))) and (tokenSet_34_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1226,6 +1229,12 @@ class UnityScriptParser(antlr.LLkParser): m=field_member(cd) elif ((_givenValue == ENUM)): // 1831 m=enum_declaration(cd) + elif ((_givenValue == CLASS) + or (_givenValue ==PARTIAL) + ): // 1827 + m=class_declaration(cd) + elif ((_givenValue == INTERFACE)): // 1831 + m=interface_declaration(cd) else: // line 1969 raise NoViableAltException(LT(1), getFilename()) if 0 == inputState.guessing: @@ -1246,7 +1255,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_11_) + recover(ex,tokenSet_35_) else: raise return member @@ -1303,7 +1312,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_11_) + recover(ex,tokenSet_35_) else: raise return member @@ -2001,7 +2010,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_40_) + recover(ex,tokenSet_27_) else: raise return m @@ -2023,14 +2032,14 @@ class UnityScriptParser(antlr.LLkParser): match(RBRACK) if 0 == inputState.guessing: tr = ArrayTypeReference(tr.LexicalInfo, tr); - elif ((tokenSet_41_.member(cast(int, LA(1)))) and (tokenSet_42_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_40_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_41_) + recover(ex,tokenSet_40_) else: raise return tr @@ -2056,7 +2065,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_43_) + recover(ex,tokenSet_42_) else: raise @@ -2118,7 +2127,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_44_) + recover(ex,tokenSet_43_) else: raise return member @@ -2169,7 +2178,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_45_) + recover(ex,tokenSet_44_) else: raise @@ -2190,7 +2199,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_46_) + recover(ex,tokenSet_45_) else: raise @@ -2227,7 +2236,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_47_) + recover(ex,tokenSet_46_) else: raise @@ -2254,7 +2263,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_48_) + recover(ex,tokenSet_47_) else: raise return token @@ -2281,7 +2290,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling block(b) while true: - if ((LA(1)==EOS) and (tokenSet_49_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_48_.member(cast(int, LA(2))))): match(EOS) else: goto _loop104_breakloop @@ -2289,7 +2298,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_49_) + recover(ex,tokenSet_48_) else: raise @@ -2328,9 +2337,9 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - if ((LA(1)==LBRACE) and (tokenSet_50_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_49_.member(cast(int, LA(2))))): compound_statement(b) - elif ((tokenSet_38_.member(cast(int, LA(1)))) and (tokenSet_51_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_38_.member(cast(int, LA(1)))) and (tokenSet_50_.member(cast(int, LA(2))))): // line 2102 statement(b) else: raise NoViableAltException(LT(1), getFilename()) @@ -2563,7 +2572,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_52_) + recover(ex,tokenSet_51_) else: raise return d @@ -2719,7 +2728,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_53_) + recover(ex,tokenSet_52_) else: raise return e @@ -2947,7 +2956,7 @@ class UnityScriptParser(antlr.LLkParser): Condition: e, TrueValue: trueValue, FalseValue: falseValue) - elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3007,7 +3016,7 @@ class UnityScriptParser(antlr.LLkParser): arguments = gtr.GenericArguments type_reference_list(arguments) match(GREATER_THAN) - elif ((tokenSet_41_.member(cast(int, LA(1)))) and (tokenSet_42_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_40_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: tr = SimpleTypeReference(ToLexicalInfo(typeName), Name: typeName.getText()) else: @@ -3015,7 +3024,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_41_) + recover(ex,tokenSet_40_) else: raise return tr @@ -3037,14 +3046,14 @@ class UnityScriptParser(antlr.LLkParser): returnType=type_reference() if 0 == inputState.guessing: callableTypeRef.ReturnType = returnType - elif ((tokenSet_41_.member(cast(int, LA(1)))) and (tokenSet_42_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_40_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_41_) + recover(ex,tokenSet_40_) else: raise return tr @@ -3080,7 +3089,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_41_) + recover(ex,tokenSet_40_) else: raise @@ -3249,7 +3258,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_55_) + recover(ex,tokenSet_54_) else: raise @@ -3391,7 +3400,7 @@ class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((LA(1)==LBRACE) and (tokenSet_50_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_49_.member(cast(int, LA(2))))): block(body) elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 returnValue=expression() @@ -3596,7 +3605,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_56_) + recover(ex,tokenSet_55_) else: raise @@ -3613,7 +3622,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=atom() while true: - if ((LA(1)==LBRACK) and (tokenSet_57_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACK) and (tokenSet_56_.member(cast(int, LA(2))))): lbrack = LT(1) match(LBRACK) if 0 == inputState.guessing: @@ -3629,10 +3638,10 @@ class UnityScriptParser(antlr.LLkParser): goto _loop229_breakloop :_loop229_breakloop match(RBRACK) - elif ((LA(1)==DOT) and (tokenSet_58_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DOT) and (tokenSet_57_.member(cast(int, LA(2))))): // line 2102 match(DOT) e=member_reference_expression(e) - elif ((LA(1)==LPAREN) and (tokenSet_59_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==LPAREN) and (tokenSet_58_.member(cast(int, LA(2))))): // line 2102 lparen = LT(1) match(LPAREN) if 0 == inputState.guessing: @@ -3671,7 +3680,7 @@ class UnityScriptParser(antlr.LLkParser): match(DECREMENT) if 0 == inputState.guessing: token = preinc; operator= UnaryOperatorType.PostDecrement; - elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3735,7 +3744,7 @@ class UnityScriptParser(antlr.LLkParser): tr=type_reference() if 0 == inputState.guessing: e = CastExpression(ToLexicalInfo(c), Target: e, Type: tr) - elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3898,7 +3907,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=shift() while true: - if ((tokenSet_60_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): + if ((tokenSet_59_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == IN) or (_givenValue ==LESS_THAN) @@ -3973,7 +3982,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=comparison() while true: - if ((tokenSet_61_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): + if ((tokenSet_60_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == EQUALITY)): // 1831 te = LT(1) @@ -4158,7 +4167,7 @@ class UnityScriptParser(antlr.LLkParser): lbrack = LT(1) match(LBRACK) synPredMatched294 as bool = false - if ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_62_.member(cast(int, LA(2))))): + if ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_61_.member(cast(int, LA(2))))): _m294 as int = mark() synPredMatched294 = true ++inputState.guessing @@ -4195,7 +4204,7 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) - elif ((tokenSet_63_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_62_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)); items = ale.Items; expression_list(items) @@ -4340,7 +4349,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_47_) + recover(ex,tokenSet_46_) else: raise return ep @@ -4592,19 +4601,19 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) private static def mk_tokenSet_31_() as (long): - data = (26478238648320L, 1073741824L, 0L, 0L, ) + data = (26482542004480L, 1073741824L, 0L, 0L, ) return data public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) private static def mk_tokenSet_32_() as (long): - data = (26478238648320L, 0L, ) + data = (26482542004480L, 0L, ) return data public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) private static def mk_tokenSet_33_() as (long): - data = (18040911108130816L, 0L, ) + data = (18040915411486976L, 0L, ) return data public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) private static def mk_tokenSet_34_() as (long): - data = (18014432869498880L, 0L, ) + data = (18014432869499136L, 0L, ) return data public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) private static def mk_tokenSet_35_() as (long): @@ -4628,99 +4637,95 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) private static def mk_tokenSet_40_() as (long): - data = (8796093155328L, 0L, ) + data = (-42950987790L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) private static def mk_tokenSet_41_() as (long): - data = (-42950987790L, 2194728288255L, 0L, 0L, ) + data = (-8590987278L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) private static def mk_tokenSet_42_() as (long): - data = (-8590987278L, 2194728288255L, 0L, 0L, ) + data = (72057594037927936L, 67108864L, 0L, 0L, ) return data public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) private static def mk_tokenSet_43_() as (long): - data = (72057594037927936L, 67108864L, 0L, 0L, ) + data = (144141670617860352L, 1073741824L, 0L, 0L, ) return data public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) private static def mk_tokenSet_44_() as (long): - data = (144141666314504192L, 1073741824L, 0L, 0L, ) + data = (144115188075986944L, 1073741824L, 0L, 0L, ) return data public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) private static def mk_tokenSet_45_() as (long): - data = (144115188075986944L, 1073741824L, 0L, 0L, ) + data = (576460752303423488L, 0L, ) return data public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) private static def mk_tokenSet_46_() as (long): - data = (576460752303423488L, 0L, ) + data = (4755801206503243776L, 0L, ) return data public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) private static def mk_tokenSet_47_() as (long): - data = (4755801206503243776L, 0L, ) + data = (-6358801241844520158L, 2150705409792L, 0L, 0L, ) return data public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) private static def mk_tokenSet_48_() as (long): - data = (-6358801241844520158L, 2150705409792L, 0L, 0L, ) + data = (-8663799826128048222L, 2150705409280L, 0L, 0L, ) return data public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) private static def mk_tokenSet_49_() as (long): - data = (-8663799826128048222L, 2150705409280L, 0L, 0L, ) + data = (-8664661937473510880L, 2147484183808L, 0L, 0L, ) return data public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) private static def mk_tokenSet_50_() as (long): - data = (-8664661937473510880L, 2147484183808L, 0L, 0L, ) + data = (-7493989825045073934L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) private static def mk_tokenSet_51_() as (long): - data = (-7493989825045073934L, 2194728288255L, 0L, 0L, ) + data = (-8663799828271337566L, 2150705409792L, 0L, 0L, ) return data public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) private static def mk_tokenSet_52_() as (long): - data = (-8663799828271337566L, 2150705409792L, 0L, 0L, ) + data = (-8087339075972108382L, 2150705409280L, 0L, 0L, ) return data public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) private static def mk_tokenSet_53_() as (long): - data = (-8087339075972108382L, 2150705409280L, 0L, 0L, ) + data = (-8593084430L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) private static def mk_tokenSet_54_() as (long): - data = (-8593084430L, 2194728288255L, 0L, 0L, ) + data = (576460752303423488L, 1L, 0L, 0L, ) return data public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) private static def mk_tokenSet_55_() as (long): - data = (576460752303423488L, 1L, 0L, 0L, ) + data = (4611686018427387904L, 1L, 0L, 0L, ) return data public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) private static def mk_tokenSet_56_() as (long): - data = (4611686018427387904L, 1L, 0L, 0L, ) + data = (-6503191951947194368L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) private static def mk_tokenSet_57_() as (long): - data = (-6503191951947194368L, 2147484183552L, 0L, 0L, ) + data = (18014432869482496L, 4194304L, 0L, 0L, ) return data public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) private static def mk_tokenSet_58_() as (long): - data = (18014432869482496L, 4194304L, 0L, 0L, ) + data = (-8232574208857464832L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) private static def mk_tokenSet_59_() as (long): - data = (-8232574208857464832L, 2147484183552L, 0L, 0L, ) + data = (20971520L, 213909504L, 0L, 0L, ) return data public static final tokenSet_59_ = BitSet(mk_tokenSet_59_()) private static def mk_tokenSet_60_() as (long): - data = (20971520L, 213909504L, 0L, 0L, ) + data = (0L, 3342336L, 0L, 0L, ) return data public static final tokenSet_60_ = BitSet(mk_tokenSet_60_()) private static def mk_tokenSet_61_() as (long): - data = (0L, 3342336L, 0L, 0L, ) + data = (-7511998268457148336L, 2182346702043L, 0L, 0L, ) return data public static final tokenSet_61_ = BitSet(mk_tokenSet_61_()) private static def mk_tokenSet_62_() as (long): - data = (-7511998268457148336L, 2182346702043L, 0L, 0L, ) - return data - public static final tokenSet_62_ = BitSet(mk_tokenSet_62_()) - private static def mk_tokenSet_63_() as (long): data = (-8809034961160888320L, 2147484183553L, 0L, 0L, ) return data - public static final tokenSet_63_ = BitSet(mk_tokenSet_63_()) + public static final tokenSet_62_ = BitSet(mk_tokenSet_62_()) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index f994c74..8d28f23 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -527,9 +527,11 @@ class_declaration[TypeDefinition parent] returns [TypeMember member] (attributes)? (mod=member_modifiers)? ( - m=function_member[cd] | - m=field_member[cd] | - m=enum_declaration[cd] + m=function_member[cd] + | m=field_member[cd] + | m=enum_declaration[cd] + | m=class_declaration[cd] + | m=interface_declaration[cd] ) { m.Modifiers |= mod if m is not null } )* diff --git a/tests/integration/nested-classes.js b/tests/integration/nested-classes.js new file mode 100644 index 0000000..154c9d9 --- /dev/null +++ b/tests/integration/nested-classes.js @@ -0,0 +1,55 @@ +/* +public class A extends Object { +} +public class A.B extends Object { +} +public class A.B.C extends E { + public var value; +} +private class A.D extends Object { +} +internal class E extends Object { +} +*/ + +import System.Reflection; + +class A { + + public class B { + class C extends E { + var value = "C.value"; + } + } + + private class D { + } +} + +internal class E { +} + +function printEffectiveTypeDeclaration(type: System.Type) { + print(visibilityOf(type) + " class " + fullNameOf(type) + " extends " + type.BaseType.Name + " {"); + printFieldsOf(type); + print("}"); +} + +function printFieldsOf(type: System.Type) { + for (var f in type.GetFields(BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance)) + print("\t" + (f.IsPublic ? "public" : "private") + " var " + f.Name + ";"); +} + +function visibilityOf(type: System.Type) { + if (type.IsPublic || type.IsNestedPublic) return "public"; + if (type.IsNestedPrivate) return "private"; + if (type.IsNestedFamily) return "protected"; + return "internal"; +} + +function fullNameOf(type: System.Type) { + return type.FullName.Replace("+", "."); +} + +for (var type in [A, A.B, A.B.C, A.D, E]) + printEffectiveTypeDeclaration(type); \ No newline at end of file diff --git a/tests/parser/nested-classes.js b/tests/parser/nested-classes.js new file mode 100644 index 0000000..630af6a --- /dev/null +++ b/tests/parser/nested-classes.js @@ -0,0 +1,25 @@ +/* +class A: + + class B: + + [attr] + public class C: + pass + + [attr] + internal class D: + pass +*/ + +class A { + + class B { + @attr + public class C {} + } + + @attr + internal class D { + } +} \ No newline at end of file diff --git a/tests/parser/nested-interfaces.js b/tests/parser/nested-interfaces.js new file mode 100644 index 0000000..7bf8616 --- /dev/null +++ b/tests/parser/nested-interfaces.js @@ -0,0 +1,25 @@ +/* +class A: + + class B: + + [attr] + public interface C: + pass + + [attr] + internal interface D: + pass +*/ + +class A { + + class B { + @attr + public interface C {} + } + + @attr + internal interface D { + } +} \ No newline at end of file From ae63d3ea73e911fbe417caf4a29ecd7d148c08ce Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 20 Oct 2010 16:40:24 -0200 Subject: [PATCH 102/276] support for calling methods taking a variable number of arguments by explicitly passing a compatible array as the last argument (fixes #379002) --- .../UnityScript.Tests.CSharp.csproj | 1 + src/UnityScript.Tests.CSharp/VarArgs.cs | 23 ++++++++ .../DuckyIntegrationTestFixture.boo | 8 +++ .../StrictIntegrationTestFixture.boo | 8 +++ .../Steps/AutoExplodeVarArgsInvocation.boo | 27 +++++++++ .../UnityExpandVarArgsMethodInvocations.boo | 13 ----- .../UnityCallableResolutionService.boo | 13 ++++- src/UnityScript/UnityScript.booproj | 2 +- src/UnityScript/UnityScriptCompiler.boo | 19 ++++--- .../varargs-in-constructor-with-vector3.js | 55 +++++++++++++++++++ tests/integration/varargs-with-vector3.js | 10 ++++ 11 files changed, 156 insertions(+), 23 deletions(-) create mode 100644 src/UnityScript.Tests.CSharp/VarArgs.cs create mode 100644 src/UnityScript/Steps/AutoExplodeVarArgsInvocation.boo delete mode 100755 src/UnityScript/Steps/UnityExpandVarArgsMethodInvocations.boo create mode 100644 tests/integration/varargs-in-constructor-with-vector3.js create mode 100644 tests/integration/varargs-with-vector3.js diff --git a/src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj b/src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj index 77397e6..4e42a89 100755 --- a/src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj +++ b/src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj @@ -46,6 +46,7 @@ + \ No newline at end of file diff --git a/src/UnityScript.Tests.CSharp/VarArgs.cs b/src/UnityScript.Tests.CSharp/VarArgs.cs new file mode 100644 index 0000000..435ebe8 --- /dev/null +++ b/src/UnityScript.Tests.CSharp/VarArgs.cs @@ -0,0 +1,23 @@ +using System; + +namespace UnityScript.Tests.CSharp +{ + public static class VarArgsMethods + { + public static int WithVector3(params Vector3[] array) + { + return array.Length; + } + } + + public class VarArgsConstructors + { + public readonly Vector3[] array; + + public VarArgsConstructors(params Vector3[] array) + { + this.array = array; + } + } +} + diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index c719e7f..8ab05f4 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -559,6 +559,14 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/valuetypes-1.js") + [Test] def varargs_in_constructor_with_vector3(): + RunTestCase("tests/integration/varargs-in-constructor-with-vector3.js") + + + [Test] def varargs_with_vector3(): + RunTestCase("tests/integration/varargs-with-vector3.js") + + [Test] def variable_declaration_2(): RunTestCase("tests/integration/variable-declaration-2.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index ae81672..2398d92 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -561,6 +561,14 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/valuetypes-1.js") + [Test] def varargs_in_constructor_with_vector3(): + RunTestCase("tests/integration/varargs-in-constructor-with-vector3.js") + + + [Test] def varargs_with_vector3(): + RunTestCase("tests/integration/varargs-with-vector3.js") + + [Test] def variable_declaration_2(): RunTestCase("tests/integration/variable-declaration-2.js") diff --git a/src/UnityScript/Steps/AutoExplodeVarArgsInvocation.boo b/src/UnityScript/Steps/AutoExplodeVarArgsInvocation.boo new file mode 100644 index 0000000..f566728 --- /dev/null +++ b/src/UnityScript/Steps/AutoExplodeVarArgsInvocation.boo @@ -0,0 +1,27 @@ +namespace UnityScript.Steps + +import Boo.Lang.Compiler.Ast +import Boo.Lang.Compiler.Steps +import Boo.Lang.Compiler.TypeSystem +import UnityScript.TypeSystem + +class AutoExplodeVarArgsInvocations(AbstractVisitorCompilerStep): + + override def Run(): + Visit(CompileUnit) + + override def LeaveMethodInvocationExpression(node as MethodInvocationExpression): + entity = node.Target.Entity as IEntityWithParameters + if entity is null: + return + + args = node.Arguments + if not entity.AcceptVarArgs or not IsArrayArgumentExplicitlyProvided(entity.GetParameters(), args): + return + + lastArg = args[-1] + args.ReplaceAt(-1, + UnaryExpression( + Operator: UnaryOperatorType.Explode, + Operand: lastArg, + ExpressionType: GetExpressionType(lastArg))) diff --git a/src/UnityScript/Steps/UnityExpandVarArgsMethodInvocations.boo b/src/UnityScript/Steps/UnityExpandVarArgsMethodInvocations.boo deleted file mode 100755 index 1a27e98..0000000 --- a/src/UnityScript/Steps/UnityExpandVarArgsMethodInvocations.boo +++ /dev/null @@ -1,13 +0,0 @@ -namespace UnityScript.Steps - -import Boo.Lang.Compiler.Steps -import Boo.Lang.Compiler.Ast -import Boo.Lang.Compiler.TypeSystem - -class UnityExpandVarArgsMethodInvocations(ExpandVarArgsMethodInvocations): - - override def ExpandInvocation(node as MethodInvocationExpression, parameters as (IParameter)): - args = node.Arguments - if len(args) == len(parameters) and GetExpressionType(args[-1]) == parameters[-1].Type: - return - super(node, parameters) diff --git a/src/UnityScript/TypeSystem/UnityCallableResolutionService.boo b/src/UnityScript/TypeSystem/UnityCallableResolutionService.boo index 6be3ba6..7410727 100755 --- a/src/UnityScript/TypeSystem/UnityCallableResolutionService.boo +++ b/src/UnityScript/TypeSystem/UnityCallableResolutionService.boo @@ -2,14 +2,25 @@ namespace UnityScript.TypeSystem import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.TypeSystem +import Boo.Lang.Compiler.TypeSystem.Core class UnityCallableResolutionService(CallableResolutionService): override def CheckVarArgsParameter(parameters as (IParameter), args as ExpressionCollection): + if IsArrayArgumentExplicitlyProvided(parameters, args): + return true return super(parameters, args) override def ShouldExpandArgs(method as IMethod, args as ExpressionCollection): parameters = method.GetParameters() - if len(parameters) == len(args) and parameters[-1].Type == ArgumentType(args[-1]): + if IsArrayArgumentExplicitlyProvided(parameters, args): return false return super(method, args) + +def IsArrayArgumentExplicitlyProvided(parameters as (IParameter), args as ExpressionCollection): + if len(parameters) != len(args): + return false + + lastArgType = TypeSystemServices.GetExpressionType(args[-1]) + lastParamType = parameters[-1].Type + return lastArgType == lastParamType or lastArgType == EmptyArrayType.Default diff --git a/src/UnityScript/UnityScript.booproj b/src/UnityScript/UnityScript.booproj index a1b6222..bffd04f 100755 --- a/src/UnityScript/UnityScript.booproj +++ b/src/UnityScript/UnityScript.booproj @@ -69,7 +69,6 @@ - @@ -83,6 +82,7 @@ + diff --git a/src/UnityScript/UnityScriptCompiler.boo b/src/UnityScript/UnityScriptCompiler.boo index 54ad4b9..3534ea2 100755 --- a/src/UnityScript/UnityScriptCompiler.boo +++ b/src/UnityScript/UnityScriptCompiler.boo @@ -35,33 +35,36 @@ class UnityScriptCompiler: return AdjustBooPipeline(Boo.Lang.Compiler.Pipelines.CompileToBoo()) def AdjustBooPipeline(pipeline as CompilerPipeline): - pipeline.Insert(0, UnityScript.Steps.PreProcess()) + pipeline.Insert(0, + UnityScript.Steps.PreProcess()) - pipeline.Replace(Boo.Lang.Compiler.Steps.Parsing, UnityScript.Steps.Parse()) + pipeline.Replace(Boo.Lang.Compiler.Steps.Parsing, + UnityScript.Steps.Parse()) pipeline.Replace(Boo.Lang.Compiler.Steps.IntroduceGlobalNamespaces, UnityScript.Steps.IntroduceUnityGlobalNamespaces()) pipeline.InsertAfter(Boo.Lang.Compiler.Steps.PreErrorChecking, - UnityScript.Steps.ApplySemantics()) + UnityScript.Steps.ApplySemantics()) + pipeline.InsertAfter(UnityScript.Steps.ApplySemantics, - UnityScript.Steps.ApplyDefaultVisibility()) - + UnityScript.Steps.ApplyDefaultVisibility()) + pipeline.InsertBefore(Boo.Lang.Compiler.Steps.ExpandDuckTypedExpressions, UnityScript.Steps.ProcessAssignmentToDuckMembers()) pipeline.Replace(Boo.Lang.Compiler.Steps.ProcessMethodBodiesWithDuckTyping, UnityScript.Steps.ProcessUnityScriptMethods()) + pipeline.InsertAfter(UnityScript.Steps.ProcessUnityScriptMethods, + UnityScript.Steps.AutoExplodeVarArgsInvocations()) + pipeline.InsertAfter(UnityScript.Steps.ProcessUnityScriptMethods, UnityScript.Steps.ProcessEvalInvocations()) pipeline.ReplaceOptional(Boo.Lang.Compiler.Steps.ExpandDuckTypedExpressions, UnityScript.Steps.ExpandUnityDuckTypedExpressions()) - pipeline.ReplaceOptional(Boo.Lang.Compiler.Steps.ExpandVarArgsMethodInvocations, - UnityScript.Steps.UnityExpandVarArgsMethodInvocations()) - pipeline.InsertBefore(Boo.Lang.Compiler.Steps.EmitAssembly, UnityScript.Steps.EnableRawArrayIndexing()) diff --git a/tests/integration/varargs-in-constructor-with-vector3.js b/tests/integration/varargs-in-constructor-with-vector3.js new file mode 100644 index 0000000..f6e9dd2 --- /dev/null +++ b/tests/integration/varargs-in-constructor-with-vector3.js @@ -0,0 +1,55 @@ +/* +2 +1 +1 +0 +0 +2 +1 +0 +0 +*/ +import UnityScript.Tests.CSharp; + +class C1 extends VarArgsConstructors { + function C1() { + super(Vector3(0, 0, 0), Vector3(0, 0, 0)); + } +} + +class C2 extends VarArgsConstructors { + function C2() { + super([Vector3(0, 0, 0)]); + } +} + +class C3 extends VarArgsConstructors { + function C3() { + super([]); + } +} + +class C4 extends VarArgsConstructors { + function C4() { + super(); + } +} + + +function printArrayLen(o: VarArgsConstructors) { + print(o.array.Length); +} + +var items = [ + VarArgsConstructors(Vector3(0, 0, 0), Vector3(0, 0, 0)), + VarArgsConstructors([Vector3(0, 0, 0)]), + VarArgsConstructors(Vector3(0, 0, 0)), + VarArgsConstructors([]), + VarArgsConstructors(), + C1(), + C2(), + C3(), + C4() +]; +for (var item in items) + printArrayLen(item); diff --git a/tests/integration/varargs-with-vector3.js b/tests/integration/varargs-with-vector3.js new file mode 100644 index 0000000..87fa970 --- /dev/null +++ b/tests/integration/varargs-with-vector3.js @@ -0,0 +1,10 @@ +/* +2 +1 +0 +*/ +import UnityScript.Tests.CSharp; + +print(VarArgsMethods.WithVector3(Vector3(0, 0, 0), Vector3(0, 0, 0))); +print(VarArgsMethods.WithVector3([Vector3(0, 0, 0)])); +print(VarArgsMethods.WithVector3([])); From 7ce8737125551c5745d5739ffcacd5641514f4ab Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 21 Oct 2010 15:10:23 -0200 Subject: [PATCH 103/276] test case for multidimensional array access --- .../MultidimensionalArrays.cs | 18 ++++++++++++++++++ .../UnityScript.Tests.CSharp.csproj | 1 + .../DuckyIntegrationTestFixture.boo | 4 ++++ .../StrictIntegrationTestFixture.boo | 4 ++++ tests/integration/multidimensional-arrays-1.js | 17 +++++++++++++++++ 5 files changed, 44 insertions(+) create mode 100644 src/UnityScript.Tests.CSharp/MultidimensionalArrays.cs create mode 100644 tests/integration/multidimensional-arrays-1.js diff --git a/src/UnityScript.Tests.CSharp/MultidimensionalArrays.cs b/src/UnityScript.Tests.CSharp/MultidimensionalArrays.cs new file mode 100644 index 0000000..a064be7 --- /dev/null +++ b/src/UnityScript.Tests.CSharp/MultidimensionalArrays.cs @@ -0,0 +1,18 @@ +using System; + +namespace UnityScript.Tests.CSharp +{ + public static class MultidimensionalArrays + { + public static int[,,] GetArray(int i, int j, int k) + { + var array = new int[i, j, k]; + for (var ii=0; ii + \ No newline at end of file diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 8ab05f4..04d22f8 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -431,6 +431,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/magicconstructor_2.js") + [Test] def multidimensional_arrays_1(): + RunTestCase("tests/integration/multidimensional-arrays-1.js") + + [Test] def nested_class_1(): RunTestCase("tests/integration/nested-class-1.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index 2398d92..c06401e 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -433,6 +433,10 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/magicconstructor_2.js") + [Test] def multidimensional_arrays_1(): + RunTestCase("tests/integration/multidimensional-arrays-1.js") + + [Test] def nested_class_1(): RunTestCase("tests/integration/nested-class-1.js") diff --git a/tests/integration/multidimensional-arrays-1.js b/tests/integration/multidimensional-arrays-1.js new file mode 100644 index 0000000..f2a450f --- /dev/null +++ b/tests/integration/multidimensional-arrays-1.js @@ -0,0 +1,17 @@ +/* +012 123 234 +123 234 345 +234 345 456 +*/ +import System; +import UnityScript.Tests.CSharp; + +var a = MultidimensionalArrays.GetArray(3, 3, 3); +for (var i = 0; i<3; ++i) { + for (var j = 0; j<3; ++j) { + for (var k = 0; k<3; ++k) + Console.Write(a[i, j, k]); + Console.Write(" "); + } + Console.WriteLine(); +} From 0dcfef5f6e7bd79b8eea9515c76cceab75fa99b1 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 3 Nov 2010 20:02:56 -0200 Subject: [PATCH 104/276] ability to disable specific pragmas using: #pragma off --- src/UnityScript.Tests/Core/PragmasTest.boo | 31 + .../PragmaEnablementTest.boo | 45 ++ .../UnityScript.Tests.booproj | 3 + src/UnityScript/Core/Pragmas.boo | 37 + src/UnityScript/Parser/UnityScriptLexer.boo | 102 +-- src/UnityScript/Parser/UnityScriptParser.boo | 659 +++++++++--------- .../Steps/ExpandUnityDuckTypedExpressions.boo | 4 +- src/UnityScript/Steps/IntroducePragmas.boo | 6 +- .../Steps/ProcessUnityScriptMethods.boo | 6 +- src/UnityScript/UnityScript.booproj | 1 + src/UnityScript/UnityScript.g | 13 +- 11 files changed, 523 insertions(+), 384 deletions(-) create mode 100644 src/UnityScript.Tests/Core/PragmasTest.boo create mode 100644 src/UnityScript.Tests/PragmaEnablementTest.boo create mode 100644 src/UnityScript/Core/Pragmas.boo diff --git a/src/UnityScript.Tests/Core/PragmasTest.boo b/src/UnityScript.Tests/Core/PragmasTest.boo new file mode 100644 index 0000000..cf05d31 --- /dev/null +++ b/src/UnityScript.Tests/Core/PragmasTest.boo @@ -0,0 +1,31 @@ +namespace UnityScript.Tests.Core + +import NUnit.Framework +import Boo.Lang.Compiler.Ast +import UnityScript.Core + + +[TestFixture] +class PragmasTest: + + [Test] + def GivenIsNotEnabledWhenTryToEnableOnThenIsEnabledOnReturnsTrue(): + + m = Module() + for pragma in Pragmas.All: + assert not Pragmas.IsEnabledOn(m, pragma) + assert Pragmas.TryToEnableOn(m, pragma) + assert Pragmas.IsEnabledOn(m, pragma) + + + [Test] + def GivenIsDisabledWhenTryToEnabledOnThenIsEnabledOnReturnsFalse(): + + m = Module() + for pragma in Pragmas.All: + Pragmas.DisableOn(m, pragma) + assert not Pragmas.TryToEnableOn(m, pragma) + assert not Pragmas.IsEnabledOn(m, pragma) + + + diff --git a/src/UnityScript.Tests/PragmaEnablementTest.boo b/src/UnityScript.Tests/PragmaEnablementTest.boo new file mode 100644 index 0000000..4cac78d --- /dev/null +++ b/src/UnityScript.Tests/PragmaEnablementTest.boo @@ -0,0 +1,45 @@ +namespace UnityScript.Tests + +import NUnit.Framework +import us + +[TestFixture] +class PragmaEnablementTest: + + [Test] + def PragmaDowncastCanBeDisabled(): + + m1 = """ + var i:int = 42 cast Object; + """ + + m2 = """ + #pragma downcast on + var i:int = 42 cast Object; + """ + + m3 = """ + #pragma downcast off + var i:int = 42 cast Object; + """ + + result = CompileModulesWithPragmas("strict,downcast", m1, m2, m3) + Assert.AreEqual("m3.js(3,16): BCE0022: Cannot convert 'Object' to 'int'.", result.Errors.ToString().Trim()) + +def CompileModulesWithPragmas(pragmas as string, *modules as (string)): + options = CommandLineOptions("-pragmas:$pragmas", "-method:Awake", "-base:${typeof(MonoBehaviour).FullName}", "-r:${GetAssemblyLocation()}") + + compiler = UnityScriptCompilerFactory.FromCommandLineOptions(options) + for i as int, m in enumerate(modules): + input = Boo.Lang.Compiler.IO.StringInput("m$(i+1).js", TrimLines(m)) + compiler.Parameters.Input.Add(input) + + return compiler.Run() + + +def TrimLines(source as string): + return join(line.Trim() for line in /\n/.Split(source), "\n") + + + + diff --git a/src/UnityScript.Tests/UnityScript.Tests.booproj b/src/UnityScript.Tests/UnityScript.Tests.booproj index 983e142..6df757b 100755 --- a/src/UnityScript.Tests/UnityScript.Tests.booproj +++ b/src/UnityScript.Tests/UnityScript.Tests.booproj @@ -70,6 +70,8 @@ + + @@ -91,5 +93,6 @@ + \ No newline at end of file diff --git a/src/UnityScript/Core/Pragmas.boo b/src/UnityScript/Core/Pragmas.boo new file mode 100644 index 0000000..c361b21 --- /dev/null +++ b/src/UnityScript/Core/Pragmas.boo @@ -0,0 +1,37 @@ +namespace UnityScript.Core + +import Boo.Lang.Compiler.Ast + +static class Pragmas: + + public final Strict = "strict" + + public final Expando = "expando" + + public final Implicit = "implicit" + + public final Downcast = "downcast" + + final ValidPragmas = Strict, Expando, Implicit, Downcast + + final Enabled = object() + + final Disabled = object() + + All: + get: return ValidPragmas[:] + + def IsValid(pragma as string): + return pragma in ValidPragmas + + def IsEnabledOn(module as Module, pragma as string): + return module[pragma] is Enabled + + def TryToEnableOn(module as Module, pragma as string): + if module.ContainsAnnotation(pragma): + return false + module.Annotate(pragma, Enabled) + return true + + def DisableOn(module as Module, pragma as string): + module[pragma] = Disabled \ No newline at end of file diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index 77c0157..568dd43 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -584,8 +584,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mDIGIT(false) else: // line 1969 - goto _loop315_breakloop - :_loop315_breakloop + goto _loop316_breakloop + :_loop316_breakloop _ttype = testLiteralsTable(_ttype) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -678,17 +678,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): match("0x") - _cnt319 as int = 0 + _cnt320 as int = 0 while true: if ((tokenSet_0_.member(cast(int, cached_LA1)))): mHEXDIGIT(false) else: - if (_cnt319 >= 1): - goto _loop319_breakloop + if (_cnt320 >= 1): + goto _loop320_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt319 - :_loop319_breakloop + ++_cnt320 + :_loop320_breakloop if ((cached_LA1==char('L') or cached_LA1==char('l'))): _givenValue = cached_LA1 if ((_givenValue == char('l'))): // 1831 @@ -702,17 +702,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): else: // line 2053 pass // 947 elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt323 as int = 0 + _cnt324 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt323 >= 1): - goto _loop323_breakloop + if (_cnt324 >= 1): + goto _loop324_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt323 - :_loop323_breakloop + ++_cnt324 + :_loop324_breakloop _givenValue = cached_LA1 if ((_givenValue == char('L')) or (_givenValue ==char('l')) @@ -808,17 +808,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_SUFFIX - _cnt332 as int = 0 + _cnt333 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt332 >= 1): - goto _loop332_breakloop + if (_cnt333 >= 1): + goto _loop333_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt332 - :_loop332_breakloop + ++_cnt333 + :_loop333_breakloop if ((cached_LA1==char('E') or cached_LA1==char('e'))): mEXPONENT(false) else: // line 2053 @@ -869,17 +869,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt339 as int = 0 + _cnt340 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt339 >= 1): - goto _loop339_breakloop + if (_cnt340 >= 1): + goto _loop340_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt339 - :_loop339_breakloop + ++_cnt340 + :_loop340_breakloop if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1351,18 +1351,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched387 as bool = false + synPredMatched388 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m387 as int = mark() - synPredMatched387 = true + _m388 as int = mark() + synPredMatched388 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched387 = false - rewind(_m387) + synPredMatched388 = false + rewind(_m388) --inputState.guessing - if synPredMatched387: + if synPredMatched388: mML_COMMENT(false) if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1375,8 +1375,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop392_breakloop - :_loop392_breakloop + goto _loop393_breakloop + :_loop393_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; elif ((_givenValue == char('='))): // 1831 @@ -1405,8 +1405,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop421_breakloop - :_loop421_breakloop + goto _loop422_breakloop + :_loop422_breakloop match("*/") if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1419,7 +1419,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt396 as int = 0 + _cnt397 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1433,12 +1433,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt396 >= 1): - goto _loop396_breakloop + if (_cnt397 >= 1): + goto _loop397_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt396 - :_loop396_breakloop + ++_cnt397 + :_loop397_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1481,8 +1481,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop400_breakloop - :_loop400_breakloop + goto _loop401_breakloop + :_loop401_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1531,8 +1531,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_4_) else: - goto _loop404_breakloop - :_loop404_breakloop + goto _loop405_breakloop + :_loop405_breakloop _saveIndex = text.Length match('\'') text.Length = _saveIndex @@ -1633,17 +1633,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt424 as int = 0 + _cnt425 as int = 0 while true: if ((tokenSet_5_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt424 >= 1): - goto _loop424_breakloop + if (_cnt425 >= 1): + goto _loop425_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt424 - :_loop424_breakloop + ++_cnt425 + :_loop425_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1701,17 +1701,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt430 as int = 0 + _cnt431 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt430 >= 1): - goto _loop430_breakloop + if (_cnt431 >= 1): + goto _loop431_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt430 - :_loop430_breakloop + ++_cnt431 + :_loop431_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index c812e3c..ba54aa9 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -246,8 +246,6 @@ class UnityScriptParser(antlr.LLkParser): static def CreateModuleName(fname as string): return System.IO.Path.GetFileNameWithoutExtension(fname) - - static final ValidPragmas = ("strict", "expando", "implicit", "downcast") protected def initialize(): @@ -337,17 +335,30 @@ class UnityScriptParser(antlr.LLkParser): ) as void: //throws RecognitionException, TokenStreamException id as IToken = null + option as IToken = null try: // for error handling match(HASH) match(PRAGMA) id = LT(1) match(ID) + if ((LA(1)==ID) and (tokenSet_5_.member(cast(int, LA(2))))): + option = LT(1) + match(ID) + elif ((tokenSet_5_.member(cast(int, LA(1)))) and (tokenSet_6_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) if 0 == inputState.guessing: pragma = id.getText() - if pragma not in ValidPragmas: + pragmaOption = (option.getText() if option is not null else "on") + if Pragmas.IsValid(pragma): + if pragmaOption == "on": + Pragmas.TryToEnableOn(container, pragma) + else: + Pragmas.DisableOn(container, pragma) + else: ReportError(UnityScriptCompilerErrors.UnknownPragma(ToLexicalInfo(id), pragma)) - container.Annotate(pragma) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -374,7 +385,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_6_) + recover(ex,tokenSet_7_) else: raise @@ -386,7 +397,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling synPredMatched28 as bool = false - if (((tokenSet_7_.member(cast(int, LA(1)))) and (tokenSet_8_.member(cast(int, LA(2))))) and (GlobalVariablesBecomeFields())): + if (((tokenSet_8_.member(cast(int, LA(1)))) and (tokenSet_9_.member(cast(int, LA(2))))) and (GlobalVariablesBecomeFields())): _m28 as int = mark() synPredMatched28 = true ++inputState.guessing @@ -404,7 +415,7 @@ class UnityScriptParser(antlr.LLkParser): eos() elif ((LA(1)==SCRIPT_ATTRIBUTE_MARKER)): // line 2102 script_attribute(module) - elif ((tokenSet_9_.member(cast(int, LA(1)))) and (tokenSet_10_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_10_.member(cast(int, LA(1)))) and (tokenSet_11_.member(cast(int, LA(2))))): // line 2102 mod=module_member_modifiers() _givenValue = LA(1) if ((_givenValue == CLASS) @@ -426,7 +437,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_11_) + recover(ex,tokenSet_12_) else: raise @@ -533,7 +544,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_11_) + recover(ex,tokenSet_12_) else: raise @@ -560,16 +571,16 @@ class UnityScriptParser(antlr.LLkParser): elif ((_givenValue == DOUBLE)): // 1831 e=double_literal() else: // line 1969 - if ((LA(1)==ID) and (tokenSet_12_.member(cast(int, LA(2))))): + if ((LA(1)==ID) and (tokenSet_13_.member(cast(int, LA(2))))): e=attribute_parameter_value_bitwise_expression() - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_15_.member(cast(int, LA(2))))): // line 2102 e=typeof_expression() else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_16_) else: raise return e @@ -598,7 +609,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -628,7 +639,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -656,7 +667,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -674,7 +685,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -692,7 +703,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return rle @@ -720,7 +731,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_16_) else: raise return e @@ -735,11 +746,11 @@ class UnityScriptParser(antlr.LLkParser): if ((_givenValue == TYPEOF)): // 1831 t = LT(1) match(TYPEOF) - if ((LA(1)==LPAREN) and (tokenSet_17_.member(cast(int, LA(2))))): + if ((LA(1)==LPAREN) and (tokenSet_18_.member(cast(int, LA(2))))): match(LPAREN) arg=expression() match(RPAREN) - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 arg=expression() else: raise NoViableAltException(LT(1), getFilename()) @@ -770,7 +781,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -784,7 +795,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_19_) else: raise return e @@ -800,12 +811,12 @@ class UnityScriptParser(antlr.LLkParser): match(DOT) e=member_reference_expression(e) else: - goto _loop195_breakloop - :_loop195_breakloop + goto _loop196_breakloop + :_loop196_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_20_) else: raise return e @@ -834,7 +845,7 @@ class UnityScriptParser(antlr.LLkParser): value=attribute_parameter_value() if 0 == inputState.guessing: attr.NamedArguments.Add(ExpressionPair(name, value)) - elif ((tokenSet_20_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_21_.member(cast(int, LA(1)))) and (tokenSet_22_.member(cast(int, LA(2))))): // line 2102 value=attribute_parameter_value() if 0 == inputState.guessing: attr.Arguments.Add(value) @@ -843,7 +854,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_16_) else: raise @@ -858,7 +869,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_22_) + recover(ex,tokenSet_23_) else: raise @@ -870,7 +881,7 @@ class UnityScriptParser(antlr.LLkParser): name=qname() if 0 == inputState.guessing: attr = Ast.Attribute(ToLexicalInfo(name), name.getText()) - if ((LA(1)==LPAREN) and (tokenSet_23_.member(cast(int, LA(2))))): + if ((LA(1)==LPAREN) and (tokenSet_24_.member(cast(int, LA(2))))): match(LPAREN) _givenValue = LA(1) if ((_givenValue == FALSE) @@ -899,14 +910,14 @@ class UnityScriptParser(antlr.LLkParser): else: // line 1969 raise NoViableAltException(LT(1), getFilename()) match(RPAREN) - elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_25_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_25_) else: raise return attr @@ -940,7 +951,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_26_) + recover(ex,tokenSet_27_) else: raise return id @@ -984,12 +995,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: VirtualKeywordHasNoEffect(v) else: // line 1969 - goto _loop50_breakloop - :_loop50_breakloop + goto _loop51_breakloop + :_loop51_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_27_) + recover(ex,tokenSet_28_) else: raise return m @@ -1007,7 +1018,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_11_) + recover(ex,tokenSet_12_) else: raise @@ -1087,7 +1098,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_29_) else: raise @@ -1095,19 +1106,19 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - if ((LA(1)==EOS) and (tokenSet_29_.member(cast(int, LA(2))))): - _cnt47 as int = 0 + if ((LA(1)==EOS) and (tokenSet_30_.member(cast(int, LA(2))))): + _cnt48 as int = 0 while true: - if ((LA(1)==EOS) and (tokenSet_29_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_30_.member(cast(int, LA(2))))): match(EOS) else: - if (_cnt47 >= 1): - goto _loop47_breakloop + if (_cnt48 >= 1): + goto _loop48_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt47 - :_loop47_breakloop - elif ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_30_.member(cast(int, LA(2))))): // line 2102 + ++_cnt48 + :_loop48_breakloop + elif ((tokenSet_30_.member(cast(int, LA(1)))) and (tokenSet_31_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: SemicolonExpected() else: @@ -1115,7 +1126,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_30_) else: raise @@ -1132,7 +1143,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_11_) + recover(ex,tokenSet_12_) else: raise @@ -1191,7 +1202,7 @@ class UnityScriptParser(antlr.LLkParser): BaseTypeAnnotations.AnnotateImplements(typeRef) match(LBRACE) while true: - if ((tokenSet_31_.member(cast(int, LA(1))))): + if ((tokenSet_32_.member(cast(int, LA(1))))): if 0 == inputState.guessing: mod = TypeMemberModifiers.None _givenValue = LA(1) @@ -1216,9 +1227,9 @@ class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_33_.member(cast(int, LA(2))))): + if ((tokenSet_33_.member(cast(int, LA(1)))) and (tokenSet_34_.member(cast(int, LA(2))))): mod=member_modifiers() - elif ((tokenSet_27_.member(cast(int, LA(1)))) and (tokenSet_34_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_28_.member(cast(int, LA(1)))) and (tokenSet_35_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1240,8 +1251,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: m.Modifiers |= mod if m is not null else: - goto _loop62_breakloop - :_loop62_breakloop + goto _loop63_breakloop + :_loop63_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: @@ -1250,12 +1261,12 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS)): match(EOS) else: - goto _loop64_breakloop - :_loop64_breakloop + goto _loop65_breakloop + :_loop65_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_35_) + recover(ex,tokenSet_36_) else: raise return member @@ -1297,8 +1308,8 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) interface_member(td) else: - goto _loop69_breakloop - :_loop69_breakloop + goto _loop70_breakloop + :_loop70_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: @@ -1307,12 +1318,12 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS)): match(EOS) else: - goto _loop71_breakloop - :_loop71_breakloop + goto _loop72_breakloop + :_loop72_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_35_) + recover(ex,tokenSet_36_) else: raise return member @@ -1344,8 +1355,8 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) enum_member(ed) else: - goto _loop80_breakloop - :_loop80_breakloop + goto _loop81_breakloop + :_loop81_breakloop _givenValue = LA(1) if ((_givenValue == COMMA)): // 1831 match(COMMA) @@ -1365,12 +1376,12 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS)): match(EOS) else: - goto _loop83_breakloop - :_loop83_breakloop + goto _loop84_breakloop + :_loop84_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_35_) + recover(ex,tokenSet_36_) else: raise return member @@ -1394,7 +1405,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_11_) + recover(ex,tokenSet_12_) else: raise return member @@ -1430,7 +1441,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_35_) + recover(ex,tokenSet_36_) else: raise @@ -1573,7 +1584,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_35_) + recover(ex,tokenSet_36_) else: raise return member @@ -1599,7 +1610,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_29_) else: raise @@ -1613,10 +1624,10 @@ class UnityScriptParser(antlr.LLkParser): f = LT(1) match(FOR) match(LPAREN) - synPredMatched130 as bool = false + synPredMatched131 as bool = false if ((LA(1)==VAR or LA(1)==ID) and (LA(2)==IN or LA(2)==ID)): - _m130 as int = mark() - synPredMatched130 = true + _m131 as int = mark() + synPredMatched131 = true ++inputState.guessing try: _givenValue = LA(1) @@ -1628,12 +1639,12 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) match(IN) except x as RecognitionException: - synPredMatched130 = false - rewind(_m130) + synPredMatched131 = false + rewind(_m131) --inputState.guessing - if synPredMatched130: + if synPredMatched131: stmt=for_in(container) - elif ((tokenSet_36_.member(cast(int, LA(1)))) and (tokenSet_37_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_37_.member(cast(int, LA(1)))) and (tokenSet_38_.member(cast(int, LA(2))))): // line 2102 stmt=for_c(container) else: raise NoViableAltException(LT(1), getFilename()) @@ -1642,7 +1653,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_29_) else: raise @@ -1662,20 +1673,20 @@ class UnityScriptParser(antlr.LLkParser): b = s.TrueBlock = Block() container.Add(s) compound_or_single_stmt(b) - if ((LA(1)==ELSE) and (tokenSet_38_.member(cast(int, LA(2))))): + if ((LA(1)==ELSE) and (tokenSet_39_.member(cast(int, LA(2))))): et = LT(1) match(ELSE) if 0 == inputState.guessing: b = s.FalseBlock = Block(ToLexicalInfo(et)) compound_or_single_stmt(b) - elif ((tokenSet_28_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_29_) else: raise @@ -1721,18 +1732,18 @@ class UnityScriptParser(antlr.LLkParser): tr = null compound_or_single_stmt(b) else: - goto _loop156_breakloop - :_loop156_breakloop - if ((LA(1)==FINALLY) and (tokenSet_38_.member(cast(int, LA(2))))): + goto _loop157_breakloop + :_loop157_breakloop + if ((LA(1)==FINALLY) and (tokenSet_39_.member(cast(int, LA(2))))): finally_block(s) - elif ((tokenSet_28_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_29_) else: raise @@ -1775,22 +1786,22 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: item.Arguments.Add(e); else: - goto _loop144_breakloop - :_loop144_breakloop - _cnt146 as int = 0 + goto _loop145_breakloop + :_loop145_breakloop + _cnt147 as int = 0 while true: - if ((tokenSet_38_.member(cast(int, LA(1))))): + if ((tokenSet_39_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt146 >= 1): - goto _loop146_breakloop + if (_cnt147 >= 1): + goto _loop147_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt146 - :_loop146_breakloop + ++_cnt147 + :_loop147_breakloop else: - goto _loop147_breakloop - :_loop147_breakloop + goto _loop148_breakloop + :_loop148_breakloop _givenValue = LA(1) if ((_givenValue == DEFAULT)): // 1831 d = LT(1) @@ -1800,32 +1811,32 @@ class UnityScriptParser(antlr.LLkParser): item = MacroStatement(ToLexicalInfo(d), Name: d.getText()) itemBlock = item.Body switchBlock.Add(item) - _cnt150 as int = 0 + _cnt151 as int = 0 while true: - if ((tokenSet_38_.member(cast(int, LA(1))))): + if ((tokenSet_39_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt150 >= 1): - goto _loop150_breakloop + if (_cnt151 >= 1): + goto _loop151_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt150 - :_loop150_breakloop + ++_cnt151 + :_loop151_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) match(RBRACE) while true: - if ((LA(1)==EOS) and (tokenSet_28_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_29_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop152_breakloop - :_loop152_breakloop + goto _loop153_breakloop + :_loop153_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_29_) else: raise @@ -1841,7 +1852,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_29_) else: raise @@ -1854,9 +1865,9 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling yt = LT(1) match(YIELD) - if ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_39_.member(cast(int, LA(2))))): + if ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_40_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_28_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1865,7 +1876,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_29_) else: raise @@ -1878,9 +1889,9 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling ret = LT(1) match(RETURN) - if ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_39_.member(cast(int, LA(2))))): + if ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_40_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_28_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1889,7 +1900,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_29_) else: raise @@ -1907,7 +1918,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_29_) else: raise @@ -1930,7 +1941,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_29_) else: raise @@ -1943,9 +1954,9 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling t = LT(1) match(THROW) - if ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_39_.member(cast(int, LA(2))))): + if ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_40_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_28_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1954,7 +1965,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_29_) else: raise @@ -2005,12 +2016,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: VirtualKeywordHasNoEffect(v) else: // line 1969 - goto _loop53_breakloop - :_loop53_breakloop + goto _loop54_breakloop + :_loop54_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_27_) + recover(ex,tokenSet_28_) else: raise return m @@ -2032,14 +2043,14 @@ class UnityScriptParser(antlr.LLkParser): match(RBRACK) if 0 == inputState.guessing: tr = ArrayTypeReference(tr.LexicalInfo, tr); - elif ((tokenSet_40_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_41_.member(cast(int, LA(1)))) and (tokenSet_42_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_40_) + recover(ex,tokenSet_41_) else: raise return tr @@ -2060,12 +2071,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: typeReferences.Add(tr) else: - goto _loop180_breakloop - :_loop180_breakloop + goto _loop181_breakloop + :_loop181_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_42_) + recover(ex,tokenSet_43_) else: raise @@ -2127,7 +2138,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_43_) + recover(ex,tokenSet_44_) else: raise return member @@ -2173,12 +2184,12 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS)): match(EOS) else: - goto _loop76_breakloop - :_loop76_breakloop + goto _loop77_breakloop + :_loop77_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_44_) + recover(ex,tokenSet_45_) else: raise @@ -2194,12 +2205,12 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) parameter_declaration(m) else: - goto _loop98_breakloop - :_loop98_breakloop + goto _loop99_breakloop + :_loop99_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_45_) + recover(ex,tokenSet_46_) else: raise @@ -2236,7 +2247,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_46_) + recover(ex,tokenSet_47_) else: raise @@ -2263,7 +2274,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_47_) + recover(ex,tokenSet_48_) else: raise return token @@ -2277,7 +2288,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -2290,15 +2301,15 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling block(b) while true: - if ((LA(1)==EOS) and (tokenSet_48_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_49_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop104_breakloop - :_loop104_breakloop + goto _loop105_breakloop + :_loop105_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_48_) + recover(ex,tokenSet_49_) else: raise @@ -2327,7 +2338,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_16_) else: raise @@ -2337,16 +2348,16 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - if ((LA(1)==LBRACE) and (tokenSet_49_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_50_.member(cast(int, LA(2))))): compound_statement(b) - elif ((tokenSet_38_.member(cast(int, LA(1)))) and (tokenSet_50_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_39_.member(cast(int, LA(1)))) and (tokenSet_51_.member(cast(int, LA(2))))): // line 2102 statement(b) else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_29_) else: raise @@ -2448,23 +2459,23 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) eos() elif ((_givenValue == EOS)): // 1831 - _cnt114 as int = 0 + _cnt115 as int = 0 while true: - if ((LA(1)==EOS) and (tokenSet_28_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_29_.member(cast(int, LA(2))))): match(EOS) else: - if (_cnt114 >= 1): - goto _loop114_breakloop + if (_cnt115 >= 1): + goto _loop115_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt114 - :_loop114_breakloop + ++_cnt115 + :_loop115_breakloop else: // line 1969 raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_29_) else: raise @@ -2477,11 +2488,11 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling match(LBRACE) while true: - if ((tokenSet_38_.member(cast(int, LA(1))))): + if ((tokenSet_39_.member(cast(int, LA(1))))): statement(b) else: - goto _loop107_breakloop - :_loop107_breakloop + goto _loop108_breakloop + :_loop108_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: @@ -2489,7 +2500,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise @@ -2572,7 +2583,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_51_) + recover(ex,tokenSet_52_) else: raise return d @@ -2728,7 +2739,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_52_) + recover(ex,tokenSet_53_) else: raise return e @@ -2769,7 +2780,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_29_) else: raise return stmt @@ -2898,7 +2909,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_29_) else: raise return stmt @@ -2914,7 +2925,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -2934,7 +2945,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_29_) else: raise @@ -2945,7 +2956,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=logical_or() - if ((LA(1)==QUESTION_MARK) and (tokenSet_17_.member(cast(int, LA(2))))): + if ((LA(1)==QUESTION_MARK) and (tokenSet_18_.member(cast(int, LA(2))))): qm = LT(1) match(QUESTION_MARK) trueValue=logical_or() @@ -2956,14 +2967,14 @@ class UnityScriptParser(antlr.LLkParser): Condition: e, TrueValue: trueValue, FalseValue: falseValue) - elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -2997,7 +3008,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return name @@ -3016,7 +3027,7 @@ class UnityScriptParser(antlr.LLkParser): arguments = gtr.GenericArguments type_reference_list(arguments) match(GREATER_THAN) - elif ((tokenSet_40_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_41_.member(cast(int, LA(1)))) and (tokenSet_42_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: tr = SimpleTypeReference(ToLexicalInfo(typeName), Name: typeName.getText()) else: @@ -3024,7 +3035,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_40_) + recover(ex,tokenSet_41_) else: raise return tr @@ -3046,14 +3057,14 @@ class UnityScriptParser(antlr.LLkParser): returnType=type_reference() if 0 == inputState.guessing: callableTypeRef.ReturnType = returnType - elif ((tokenSet_40_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_41_.member(cast(int, LA(1)))) and (tokenSet_42_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_40_) + recover(ex,tokenSet_41_) else: raise return tr @@ -3079,8 +3090,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) else: - goto _loop172_breakloop - :_loop172_breakloop + goto _loop173_breakloop + :_loop173_breakloop elif ((_givenValue == RPAREN)): // 1831 pass // 947 else: // line 1969 @@ -3089,7 +3100,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_40_) + recover(ex,tokenSet_41_) else: raise @@ -3107,7 +3118,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -3122,7 +3133,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=term() while true: - if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_17_.member(cast(int, LA(2))))): + if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_18_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == ADD)): // 1831 add = LT(1) @@ -3144,12 +3155,12 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop247_breakloop - :_loop247_breakloop + goto _loop248_breakloop + :_loop248_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -3164,7 +3175,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -3174,18 +3185,18 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched184 as bool = false + synPredMatched185 as bool = false if ((LA(1)==NEW) and (LA(2)==ID)): - _m184 as int = mark() - synPredMatched184 = true + _m185 as int = mark() + synPredMatched185 = true ++inputState.guessing try: new_array_expression() except x as RecognitionException: - synPredMatched184 = false - rewind(_m184) + synPredMatched185 = false + rewind(_m185) --inputState.guessing - if synPredMatched184: + if synPredMatched185: e=new_array_expression() elif ((LA(1)==NEW) and (LA(2)==ID)): // line 2102 match(NEW) @@ -3201,7 +3212,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -3247,8 +3258,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ec.Add(e); else: - goto _loop213_breakloop - :_loop213_breakloop + goto _loop214_breakloop + :_loop214_breakloop elif ((_givenValue == RPAREN) or (_givenValue ==RBRACK) ): // 1827 @@ -3258,7 +3269,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_54_) + recover(ex,tokenSet_55_) else: raise @@ -3288,18 +3299,18 @@ class UnityScriptParser(antlr.LLkParser): else: // line 1969 if ((LA(1)==FUNCTION) and (LA(2)==LPAREN)): e=function_expression() - elif ((LA(1)==ID) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==ID) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 e=simple_reference_expression() - elif ((LA(1)==LPAREN) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==LPAREN) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 e=paren_expression() - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 e=typeof_expression() else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -3341,7 +3352,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -3400,9 +3411,9 @@ class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((LA(1)==LBRACE) and (tokenSet_49_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_50_.member(cast(int, LA(2))))): block(body) - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 returnValue=expression() if 0 == inputState.guessing: body.Add(returnValue) @@ -3411,7 +3422,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -3429,7 +3440,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -3464,7 +3475,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -3605,7 +3616,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_55_) + recover(ex,tokenSet_56_) else: raise @@ -3622,7 +3633,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=atom() while true: - if ((LA(1)==LBRACK) and (tokenSet_56_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACK) and (tokenSet_57_.member(cast(int, LA(2))))): lbrack = LT(1) match(LBRACK) if 0 == inputState.guessing: @@ -3635,13 +3646,13 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) slice(se) else: - goto _loop229_breakloop - :_loop229_breakloop + goto _loop230_breakloop + :_loop230_breakloop match(RBRACK) - elif ((LA(1)==DOT) and (tokenSet_57_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DOT) and (tokenSet_58_.member(cast(int, LA(2))))): // line 2102 match(DOT) e=member_reference_expression(e) - elif ((LA(1)==LPAREN) and (tokenSet_58_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==LPAREN) and (tokenSet_59_.member(cast(int, LA(2))))): // line 2102 lparen = LT(1) match(LPAREN) if 0 == inputState.guessing: @@ -3652,12 +3663,12 @@ class UnityScriptParser(antlr.LLkParser): expression_list(args) match(RPAREN) else: - goto _loop232_breakloop - :_loop232_breakloop + goto _loop233_breakloop + :_loop233_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -3670,17 +3681,17 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=slicing_expression() - if ((LA(1)==INCREMENT) and (tokenSet_16_.member(cast(int, LA(2))))): + if ((LA(1)==INCREMENT) and (tokenSet_17_.member(cast(int, LA(2))))): postinc = LT(1) match(INCREMENT) if 0 == inputState.guessing: token = postinc; operator = UnaryOperatorType.PostIncrement; - elif ((LA(1)==DECREMENT) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DECREMENT) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 preinc = LT(1) match(DECREMENT) if 0 == inputState.guessing: token = preinc; operator= UnaryOperatorType.PostDecrement; - elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3689,7 +3700,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -3744,14 +3755,14 @@ class UnityScriptParser(antlr.LLkParser): tr=type_reference() if 0 == inputState.guessing: e = CastExpression(ToLexicalInfo(c), Target: e, Type: tr) - elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -3801,7 +3812,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -3817,7 +3828,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=unary_expression() while true: - if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_17_.member(cast(int, LA(2))))): + if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_18_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == MULTIPLY)): // 1831 m = LT(1) @@ -3844,12 +3855,12 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop243_breakloop - :_loop243_breakloop + goto _loop244_breakloop + :_loop244_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -3863,7 +3874,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=sum() while true: - if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_17_.member(cast(int, LA(2))))): + if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_18_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == SHIFT_LEFT)): // 1831 sl = LT(1) @@ -3881,12 +3892,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop251_breakloop - :_loop251_breakloop + goto _loop252_breakloop + :_loop252_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -3907,7 +3918,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=shift() while true: - if ((tokenSet_59_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): + if ((tokenSet_60_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == IN) or (_givenValue ==LESS_THAN) @@ -3961,12 +3972,12 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop263_breakloop - :_loop263_breakloop + goto _loop264_breakloop + :_loop264_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -3982,7 +3993,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=comparison() while true: - if ((tokenSet_60_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): + if ((tokenSet_61_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == EQUALITY)): // 1831 te = LT(1) @@ -4010,12 +4021,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), op, e, r) else: - goto _loop271_breakloop - :_loop271_breakloop + goto _loop272_breakloop + :_loop272_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -4028,7 +4039,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=equality() while true: - if ((LA(1)==BITWISE_AND) and (tokenSet_17_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_AND) and (tokenSet_18_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_AND) if 0 == inputState.guessing: @@ -4037,12 +4048,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop274_breakloop - :_loop274_breakloop + goto _loop275_breakloop + :_loop275_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -4055,7 +4066,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_and() while true: - if ((LA(1)==BITWISE_XOR) and (tokenSet_17_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_XOR) and (tokenSet_18_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_XOR) if 0 == inputState.guessing: @@ -4064,12 +4075,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop277_breakloop - :_loop277_breakloop + goto _loop278_breakloop + :_loop278_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -4082,7 +4093,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_xor() while true: - if ((LA(1)==BITWISE_OR) and (tokenSet_17_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_OR) and (tokenSet_18_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_OR) if 0 == inputState.guessing: @@ -4091,12 +4102,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop280_breakloop - :_loop280_breakloop + goto _loop281_breakloop + :_loop281_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -4109,7 +4120,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_or() while true: - if ((LA(1)==LOGICAL_AND) and (tokenSet_17_.member(cast(int, LA(2))))): + if ((LA(1)==LOGICAL_AND) and (tokenSet_18_.member(cast(int, LA(2))))): op = LT(1) match(LOGICAL_AND) rhs=bitwise_or() @@ -4119,12 +4130,12 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop283_breakloop - :_loop283_breakloop + goto _loop284_breakloop + :_loop284_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -4137,7 +4148,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=logical_and() while true: - if ((LA(1)==LOGICAL_OR) and (tokenSet_17_.member(cast(int, LA(2))))): + if ((LA(1)==LOGICAL_OR) and (tokenSet_18_.member(cast(int, LA(2))))): op = LT(1) match(LOGICAL_OR) rhs=logical_and() @@ -4147,12 +4158,12 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop286_breakloop - :_loop286_breakloop + goto _loop287_breakloop + :_loop287_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -4166,19 +4177,19 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling lbrack = LT(1) match(LBRACK) - synPredMatched294 as bool = false - if ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_61_.member(cast(int, LA(2))))): - _m294 as int = mark() - synPredMatched294 = true + synPredMatched295 as bool = false + if ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_62_.member(cast(int, LA(2))))): + _m295 as int = mark() + synPredMatched295 = true ++inputState.guessing try: expression() match(FOR) except x as RecognitionException: - synPredMatched294 = false - rewind(_m294) + synPredMatched295 = false + rewind(_m295) --inputState.guessing - if synPredMatched294: + if synPredMatched295: projection=expression() match(FOR) match(LPAREN) @@ -4204,7 +4215,7 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) - elif ((tokenSet_62_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_63_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)); items = ale.Items; expression_list(items) @@ -4214,7 +4225,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -4265,8 +4276,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dle.Items.Add(pair); else: - goto _loop302_breakloop - :_loop302_breakloop + goto _loop303_breakloop + :_loop303_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 @@ -4275,7 +4286,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return dle @@ -4293,7 +4304,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return re @@ -4311,7 +4322,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -4329,7 +4340,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -4349,7 +4360,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_46_) + recover(ex,tokenSet_47_) else: raise return ep @@ -4501,231 +4512,235 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) private static def mk_tokenSet_6_() as (long): - data = (18040881051486464L, 2147483648L, 0L, 0L, ) + data = (-7494834241385305230L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) private static def mk_tokenSet_7_() as (long): - data = (26476057477120L, 0L, ) + data = (18040881051486464L, 2147483648L, 0L, 0L, ) return data public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) private static def mk_tokenSet_8_() as (long): - data = (18040874566959104L, 0L, ) + data = (26476057477120L, 0L, ) return data public static final tokenSet_8_ = BitSet(mk_tokenSet_8_()) private static def mk_tokenSet_9_() as (long): - data = (17684267944192L, 0L, ) + data = (18040874566959104L, 0L, ) return data public static final tokenSet_9_ = BitSet(mk_tokenSet_9_()) private static def mk_tokenSet_10_() as (long): - data = (18032082777426176L, 0L, ) + data = (17684267944192L, 0L, ) return data public static final tokenSet_10_ = BitSet(mk_tokenSet_10_()) private static def mk_tokenSet_11_() as (long): - data = (-8808759441281553630L, 2150705409024L, 0L, 0L, ) + data = (18032082777426176L, 0L, ) return data public static final tokenSet_11_ = BitSet(mk_tokenSet_11_()) private static def mk_tokenSet_12_() as (long): - data = (6341068275337658368L, 2L, 0L, 0L, ) + data = (-8808759441281553630L, 2150705409024L, 0L, 0L, ) return data public static final tokenSet_12_ = BitSet(mk_tokenSet_12_()) private static def mk_tokenSet_13_() as (long): - data = (306249172707835904L, 0L, ) + data = (6341068275337658368L, 2L, 0L, 0L, ) return data public static final tokenSet_13_ = BitSet(mk_tokenSet_13_()) private static def mk_tokenSet_14_() as (long): - data = (-2467966685823229952L, 2147484183552L, 0L, 0L, ) + data = (306249172707835904L, 0L, ) return data public static final tokenSet_14_ = BitSet(mk_tokenSet_14_()) private static def mk_tokenSet_15_() as (long): - data = (5188146770730811392L, 0L, ) + data = (-2467966685823229952L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_15_ = BitSet(mk_tokenSet_15_()) private static def mk_tokenSet_16_() as (long): - data = (-42953084942L, 2194728288255L, 0L, 0L, ) + data = (5188146770730811392L, 0L, ) return data public static final tokenSet_16_ = BitSet(mk_tokenSet_16_()) private static def mk_tokenSet_17_() as (long): - data = (-8809034961160888320L, 2147484183552L, 0L, 0L, ) + data = (-42953084942L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_17_ = BitSet(mk_tokenSet_17_()) private static def mk_tokenSet_18_() as (long): - data = (5188146770730811392L, 2L, 0L, 0L, ) + data = (-8809034961160888320L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_18_ = BitSet(mk_tokenSet_18_()) private static def mk_tokenSet_19_() as (long): - data = (5476377146882523136L, 514L, 0L, 0L, ) + data = (5188146770730811392L, 2L, 0L, 0L, ) return data public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) private static def mk_tokenSet_20_() as (long): - data = (342279069305544704L, 2061584302080L, 0L, 0L, ) + data = (5476377146882523136L, 514L, 0L, 0L, ) return data public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) private static def mk_tokenSet_21_() as (long): - data = (-2467966685823229952L, 2147484183554L, 0L, 0L, ) + data = (342279069305544704L, 2061584302080L, 0L, 0L, ) return data public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) private static def mk_tokenSet_22_() as (long): - data = (18040881051486464L, 3221225472L, 0L, 0L, ) + data = (-2467966685823229952L, 2147484183554L, 0L, 0L, ) return data public static final tokenSet_22_ = BitSet(mk_tokenSet_22_()) private static def mk_tokenSet_23_() as (long): - data = (918739821608968192L, 2061584302080L, 0L, 0L, ) + data = (18040881051486464L, 3221225472L, 0L, 0L, ) return data public static final tokenSet_23_ = BitSet(mk_tokenSet_23_()) private static def mk_tokenSet_24_() as (long): - data = (-8808759439134069982L, 2150705409024L, 0L, 0L, ) + data = (918739821608968192L, 2061584302080L, 0L, 0L, ) return data public static final tokenSet_24_ = BitSet(mk_tokenSet_24_()) private static def mk_tokenSet_25_() as (long): - data = (-2883148195040367758L, 2194728288255L, 0L, 0L, ) + data = (-8808759439134069982L, 2150705409024L, 0L, 0L, ) return data public static final tokenSet_25_ = BitSet(mk_tokenSet_25_()) private static def mk_tokenSet_26_() as (long): - data = (-42949939214L, 2199023255551L, 0L, 0L, ) + data = (-2883148195040367758L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_26_ = BitSet(mk_tokenSet_26_()) private static def mk_tokenSet_27_() as (long): - data = (8800396511488L, 0L, ) + data = (-42949939214L, 2199023255551L, 0L, 0L, ) return data public static final tokenSet_27_ = BitSet(mk_tokenSet_27_()) private static def mk_tokenSet_28_() as (long): - data = (-8663799828275531870L, 2150705409280L, 0L, 0L, ) + data = (8800396511488L, 0L, ) return data public static final tokenSet_28_ = BitSet(mk_tokenSet_28_()) private static def mk_tokenSet_29_() as (long): - data = (-8663799826126999646L, 2155000376576L, 0L, 0L, ) + data = (-8663799828275531870L, 2150705409280L, 0L, 0L, ) return data public static final tokenSet_29_ = BitSet(mk_tokenSet_29_()) private static def mk_tokenSet_30_() as (long): - data = (-3149838L, 2194728288255L, 0L, 0L, ) + data = (-8663799826126999646L, 2155000376576L, 0L, 0L, ) return data public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) private static def mk_tokenSet_31_() as (long): - data = (26482542004480L, 1073741824L, 0L, 0L, ) + data = (-3149838L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) private static def mk_tokenSet_32_() as (long): - data = (26482542004480L, 0L, ) + data = (26482542004480L, 1073741824L, 0L, 0L, ) return data public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) private static def mk_tokenSet_33_() as (long): - data = (18040915411486976L, 0L, ) + data = (26482542004480L, 0L, ) return data public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) private static def mk_tokenSet_34_() as (long): - data = (18014432869499136L, 0L, ) + data = (18040915411486976L, 0L, ) return data public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) private static def mk_tokenSet_35_() as (long): - data = (-8664644251058214110L, 2150705409024L, 0L, 0L, ) + data = (18014432869499136L, 0L, ) return data public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) private static def mk_tokenSet_36_() as (long): - data = (-8809026165067866112L, 2147484183808L, 0L, 0L, ) + data = (-8664644251058214110L, 2150705409024L, 0L, 0L, ) return data public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) private static def mk_tokenSet_37_() as (long): - data = (-7495109769854574512L, 2191507062783L, 0L, 0L, ) + data = (-8809026165067866112L, 2147484183808L, 0L, 0L, ) return data public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) private static def mk_tokenSet_38_() as (long): - data = (-8808777125549366752L, 2147484183808L, 0L, 0L, ) + data = (-7495109769854574512L, 2191507062783L, 0L, 0L, ) return data public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) private static def mk_tokenSet_39_() as (long): - data = (-7510878323647713294L, 2185567927771L, 0L, 0L, ) + data = (-8808777125549366752L, 2147484183808L, 0L, 0L, ) return data public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) private static def mk_tokenSet_40_() as (long): - data = (-42950987790L, 2194728288255L, 0L, 0L, ) + data = (-7510878323647713294L, 2185567927771L, 0L, 0L, ) return data public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) private static def mk_tokenSet_41_() as (long): - data = (-8590987278L, 2194728288255L, 0L, 0L, ) + data = (-42950987790L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) private static def mk_tokenSet_42_() as (long): - data = (72057594037927936L, 67108864L, 0L, 0L, ) + data = (-8590987278L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) private static def mk_tokenSet_43_() as (long): - data = (144141670617860352L, 1073741824L, 0L, 0L, ) + data = (72057594037927936L, 67108864L, 0L, 0L, ) return data public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) private static def mk_tokenSet_44_() as (long): - data = (144115188075986944L, 1073741824L, 0L, 0L, ) + data = (144141670617860352L, 1073741824L, 0L, 0L, ) return data public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) private static def mk_tokenSet_45_() as (long): - data = (576460752303423488L, 0L, ) + data = (144115188075986944L, 1073741824L, 0L, 0L, ) return data public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) private static def mk_tokenSet_46_() as (long): - data = (4755801206503243776L, 0L, ) + data = (576460752303423488L, 0L, ) return data public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) private static def mk_tokenSet_47_() as (long): - data = (-6358801241844520158L, 2150705409792L, 0L, 0L, ) + data = (4755801206503243776L, 0L, ) return data public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) private static def mk_tokenSet_48_() as (long): - data = (-8663799826128048222L, 2150705409280L, 0L, 0L, ) + data = (-6358801241844520158L, 2150705409792L, 0L, 0L, ) return data public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) private static def mk_tokenSet_49_() as (long): - data = (-8664661937473510880L, 2147484183808L, 0L, 0L, ) + data = (-8663799826128048222L, 2150705409280L, 0L, 0L, ) return data public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) private static def mk_tokenSet_50_() as (long): - data = (-7493989825045073934L, 2194728288255L, 0L, 0L, ) + data = (-8664661937473510880L, 2147484183808L, 0L, 0L, ) return data public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) private static def mk_tokenSet_51_() as (long): - data = (-8663799828271337566L, 2150705409792L, 0L, 0L, ) + data = (-7493989825045073934L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) private static def mk_tokenSet_52_() as (long): - data = (-8087339075972108382L, 2150705409280L, 0L, 0L, ) + data = (-8663799828271337566L, 2150705409792L, 0L, 0L, ) return data public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) private static def mk_tokenSet_53_() as (long): - data = (-8593084430L, 2194728288255L, 0L, 0L, ) + data = (-8087339075972108382L, 2150705409280L, 0L, 0L, ) return data public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) private static def mk_tokenSet_54_() as (long): - data = (576460752303423488L, 1L, 0L, 0L, ) + data = (-8593084430L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) private static def mk_tokenSet_55_() as (long): - data = (4611686018427387904L, 1L, 0L, 0L, ) + data = (576460752303423488L, 1L, 0L, 0L, ) return data public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) private static def mk_tokenSet_56_() as (long): - data = (-6503191951947194368L, 2147484183552L, 0L, 0L, ) + data = (4611686018427387904L, 1L, 0L, 0L, ) return data public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) private static def mk_tokenSet_57_() as (long): - data = (18014432869482496L, 4194304L, 0L, 0L, ) + data = (-6503191951947194368L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) private static def mk_tokenSet_58_() as (long): - data = (-8232574208857464832L, 2147484183552L, 0L, 0L, ) + data = (18014432869482496L, 4194304L, 0L, 0L, ) return data public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) private static def mk_tokenSet_59_() as (long): - data = (20971520L, 213909504L, 0L, 0L, ) + data = (-8232574208857464832L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_59_ = BitSet(mk_tokenSet_59_()) private static def mk_tokenSet_60_() as (long): - data = (0L, 3342336L, 0L, 0L, ) + data = (20971520L, 213909504L, 0L, 0L, ) return data public static final tokenSet_60_ = BitSet(mk_tokenSet_60_()) private static def mk_tokenSet_61_() as (long): - data = (-7511998268457148336L, 2182346702043L, 0L, 0L, ) + data = (0L, 3342336L, 0L, 0L, ) return data public static final tokenSet_61_ = BitSet(mk_tokenSet_61_()) private static def mk_tokenSet_62_() as (long): - data = (-8809034961160888320L, 2147484183553L, 0L, 0L, ) + data = (-7511998268457148336L, 2182346702043L, 0L, 0L, ) return data public static final tokenSet_62_ = BitSet(mk_tokenSet_62_()) + private static def mk_tokenSet_63_() as (long): + data = (-8809034961160888320L, 2147484183553L, 0L, 0L, ) + return data + public static final tokenSet_63_ = BitSet(mk_tokenSet_63_()) diff --git a/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo b/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo index 5fe6aac..91cc419 100755 --- a/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo +++ b/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo @@ -1,5 +1,7 @@ namespace UnityScript.Steps +import UnityScript.Core + import Boo.Lang.Compiler import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.TypeSystem @@ -17,7 +19,7 @@ class ExpandUnityDuckTypedExpressions(ExpandDuckTypedExpressions): UnityRuntimeServices_GetProperty = ResolveUnityRuntimeMethod("GetProperty") override def EnterModule(module as Module): - _expando = UnityScriptParameters.Expando or module.ContainsAnnotation("expando") + _expando = UnityScriptParameters.Expando or Pragmas.IsEnabledOn(module, Pragmas.Expando) return super(module) override def GetSetPropertyMethod(): diff --git a/src/UnityScript/Steps/IntroducePragmas.boo b/src/UnityScript/Steps/IntroducePragmas.boo index a135294..c597a24 100755 --- a/src/UnityScript/Steps/IntroducePragmas.boo +++ b/src/UnityScript/Steps/IntroducePragmas.boo @@ -1,5 +1,7 @@ namespace UnityScript.Steps +import UnityScript.Core + import Boo.Lang.Compiler.Steps class IntroducePragmas(AbstractCompilerStep): @@ -12,5 +14,5 @@ class IntroducePragmas(AbstractCompilerStep): override def Run(): for module in CompileUnit.Modules: for pragma in _pragmas: - module.Annotate(pragma) unless module.ContainsAnnotation(pragma) - + Pragmas.TryToEnableOn(module, pragma) + diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index b53a3f4..a1fef1f 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -81,10 +81,10 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): return super(d) override def OnModule(module as Module): - Parameters.Strict = _strict = module.ContainsAnnotation("strict") + Parameters.Strict = _strict = Pragmas.IsEnabledOn(module, Pragmas.Strict) Parameters.Ducky = not _strict - _implicit = module.ContainsAnnotation("implicit") - my(UnityDowncastPermissions).Enabled = module.ContainsAnnotation("downcast") + _implicit = Pragmas.IsEnabledOn(module, Pragmas.Implicit) + my(UnityDowncastPermissions).Enabled = Pragmas.IsEnabledOn(module, Pragmas.Downcast) super(module) override def OnMethod(node as Method): diff --git a/src/UnityScript/UnityScript.booproj b/src/UnityScript/UnityScript.booproj index bffd04f..2bae74c 100755 --- a/src/UnityScript/UnityScript.booproj +++ b/src/UnityScript/UnityScript.booproj @@ -83,6 +83,7 @@ + diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 8d28f23..a1f2f97 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -222,8 +222,6 @@ tokens static def CreateModuleName(fname as string): return System.IO.Path.GetFileNameWithoutExtension(fname) - - static final ValidPragmas = ("strict", "expando", "implicit", "downcast") } @@ -438,12 +436,17 @@ qname returns [Token id] pragma_directive[Module container] { }: - HASH PRAGMA id:ID + HASH PRAGMA id:ID (option:ID)? { pragma = id.getText() - if pragma not in ValidPragmas: + pragmaOption = (option.getText() if option is not null else "on") + if Pragmas.IsValid(pragma): + if pragmaOption == "on": + Pragmas.TryToEnableOn(container, pragma) + else: + Pragmas.DisableOn(container, pragma) + else: ReportError(UnityScriptCompilerErrors.UnknownPragma(ToLexicalInfo(id), pragma)) - container.Annotate(pragma) } ; From 52f8a3d9f6c5174f66a1e957c4b5e6f35bd1c13a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 9 Nov 2010 23:40:16 -0200 Subject: [PATCH 105/276] attributes for parameters --- src/UnityScript/UnityScript.g | 42 ++++------------------------------- tests/parser/attributes-1.js | 10 +++++++-- 2 files changed, 12 insertions(+), 40 deletions(-) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index a1f2f97..f053440 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -249,52 +249,17 @@ start[CompileUnit cu] } ; -attribute_parameter_value returns [Expression e] -{ -}: - e=integer_literal - | e=string_literal - //| e=array_literal - | e=bool_literal - | e=null_literal - | e=double_literal - | e=attribute_parameter_value_bitwise_expression - | e=typeof_expression -; - -attribute_parameter_value_bitwise_expression returns [Expression e] -{ -}: - e=attribute_parameter_value_reference_expression - ( - op:BITWISE_OR - rhs=attribute_parameter_value_reference_expression - { - e = BinaryExpression(ToLexicalInfo(op), - Operator: BinaryOperatorType.BitwiseOr, - Left: e, - Right: rhs) - } - )* -; - -attribute_parameter_value_reference_expression returns [Expression e] -{ -}: - e=reference_expression -; - attribute_parameter[Ast.Attribute attr] { }: (ID ASSIGN)=>( - name=reference_expression ASSIGN value=attribute_parameter_value + name=reference_expression ASSIGN value=expression { attr.NamedArguments.Add(ExpressionPair(name, value)) } ) | ( - value=attribute_parameter_value + value=expression { attr.Arguments.Add(value) } @@ -699,10 +664,11 @@ parameter_declaration_list[INodeWithParameters m] parameter_declaration[INodeWithParameters m] { }: - id:ID (COLON tr=type_reference)? + (attributes)? id:ID (COLON tr=type_reference)? { parameter = ParameterDeclaration(ToLexicalInfo(id), Name: id.getText(), Type: tr) m.Parameters.Add(parameter) + FlushAttributes(parameter) } ; diff --git a/tests/parser/attributes-1.js b/tests/parser/attributes-1.js index 047b9ca..1500e09 100644 --- a/tests/parser/attributes-1.js +++ b/tests/parser/attributes-1.js @@ -4,7 +4,10 @@ class Foo: [AnotherOne(true, Name: 'foo')] - def bar(): + def bar([NotNull] arg1): + pass + + def baz(arg1, [Required((arg2 > 0))] arg2 as int): pass [AttributeForField(Foo.Bar)] @@ -15,7 +18,10 @@ class Foo: class Foo { @AnotherOne(true, Name="foo") - function bar() { + function bar(@NotNull arg1) { + } + + function baz(arg1, @Required(arg2 > 0) arg2: int) { } @AttributeForField(Foo.Bar) From ec1fb9e074edb927aab3ba8e6108d121bb3ec74f Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 9 Nov 2010 23:41:23 -0200 Subject: [PATCH 106/276] antlr generated files updated after grammar changes to support attributes on parameters --- src/UnityScript/Parser/UnityScriptLexer.boo | 102 +- src/UnityScript/Parser/UnityScriptParser.boo | 1062 ++++++++---------- 2 files changed, 545 insertions(+), 619 deletions(-) diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index 568dd43..fce5a4a 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -584,8 +584,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mDIGIT(false) else: // line 1969 - goto _loop316_breakloop - :_loop316_breakloop + goto _loop312_breakloop + :_loop312_breakloop _ttype = testLiteralsTable(_ttype) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -678,17 +678,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): match("0x") - _cnt320 as int = 0 + _cnt316 as int = 0 while true: if ((tokenSet_0_.member(cast(int, cached_LA1)))): mHEXDIGIT(false) else: - if (_cnt320 >= 1): - goto _loop320_breakloop + if (_cnt316 >= 1): + goto _loop316_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt320 - :_loop320_breakloop + ++_cnt316 + :_loop316_breakloop if ((cached_LA1==char('L') or cached_LA1==char('l'))): _givenValue = cached_LA1 if ((_givenValue == char('l'))): // 1831 @@ -702,17 +702,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): else: // line 2053 pass // 947 elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt324 as int = 0 + _cnt320 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt324 >= 1): - goto _loop324_breakloop + if (_cnt320 >= 1): + goto _loop320_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt324 - :_loop324_breakloop + ++_cnt320 + :_loop320_breakloop _givenValue = cached_LA1 if ((_givenValue == char('L')) or (_givenValue ==char('l')) @@ -808,17 +808,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_SUFFIX - _cnt333 as int = 0 + _cnt329 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt333 >= 1): - goto _loop333_breakloop + if (_cnt329 >= 1): + goto _loop329_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt333 - :_loop333_breakloop + ++_cnt329 + :_loop329_breakloop if ((cached_LA1==char('E') or cached_LA1==char('e'))): mEXPONENT(false) else: // line 2053 @@ -869,17 +869,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt340 as int = 0 + _cnt336 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt340 >= 1): - goto _loop340_breakloop + if (_cnt336 >= 1): + goto _loop336_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt340 - :_loop340_breakloop + ++_cnt336 + :_loop336_breakloop if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1351,18 +1351,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched388 as bool = false + synPredMatched384 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m388 as int = mark() - synPredMatched388 = true + _m384 as int = mark() + synPredMatched384 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched388 = false - rewind(_m388) + synPredMatched384 = false + rewind(_m384) --inputState.guessing - if synPredMatched388: + if synPredMatched384: mML_COMMENT(false) if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1375,8 +1375,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop393_breakloop - :_loop393_breakloop + goto _loop389_breakloop + :_loop389_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; elif ((_givenValue == char('='))): // 1831 @@ -1405,8 +1405,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop422_breakloop - :_loop422_breakloop + goto _loop418_breakloop + :_loop418_breakloop match("*/") if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1419,7 +1419,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt397 as int = 0 + _cnt393 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1433,12 +1433,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt397 >= 1): - goto _loop397_breakloop + if (_cnt393 >= 1): + goto _loop393_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt397 - :_loop397_breakloop + ++_cnt393 + :_loop393_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1481,8 +1481,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop401_breakloop - :_loop401_breakloop + goto _loop397_breakloop + :_loop397_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1531,8 +1531,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_4_) else: - goto _loop405_breakloop - :_loop405_breakloop + goto _loop401_breakloop + :_loop401_breakloop _saveIndex = text.Length match('\'') text.Length = _saveIndex @@ -1633,17 +1633,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt425 as int = 0 + _cnt421 as int = 0 while true: if ((tokenSet_5_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt425 >= 1): - goto _loop425_breakloop + if (_cnt421 >= 1): + goto _loop421_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt425 - :_loop425_breakloop + ++_cnt421 + :_loop421_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1701,17 +1701,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt431 as int = 0 + _cnt427 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt431 >= 1): - goto _loop431_breakloop + if (_cnt427 >= 1): + goto _loop427_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt431 - :_loop431_breakloop + ++_cnt427 + :_loop427_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index ba54aa9..ebaa1b6 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -371,17 +371,17 @@ class UnityScriptParser(antlr.LLkParser): _attributes.Clear() try: // for error handling - _cnt19 as int = 0 + _cnt14 as int = 0 while true: if ((LA(1)==AT)): attribute() else: - if (_cnt19 >= 1): - goto _loop19_breakloop + if (_cnt14 >= 1): + goto _loop14_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt19 - :_loop19_breakloop + ++_cnt14 + :_loop14_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -396,19 +396,19 @@ class UnityScriptParser(antlr.LLkParser): globals = module.Globals try: // for error handling - synPredMatched28 as bool = false + synPredMatched23 as bool = false if (((tokenSet_8_.member(cast(int, LA(1)))) and (tokenSet_9_.member(cast(int, LA(2))))) and (GlobalVariablesBecomeFields())): - _m28 as int = mark() - synPredMatched28 = true + _m23 as int = mark() + synPredMatched23 = true ++inputState.guessing try: module_member_modifiers() match(VAR) except x as RecognitionException: - synPredMatched28 = false - rewind(_m28) + synPredMatched23 = false + rewind(_m23) --inputState.guessing - if synPredMatched28: + if synPredMatched23: module_field(module) elif ((LA(1)==VAR) and (LA(2)==ID)): // line 2102 declaration_statement(globals) @@ -548,257 +548,42 @@ class UnityScriptParser(antlr.LLkParser): else: raise - public def attribute_parameter_value() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == INT) - or (_givenValue ==LONG) - ): // 1827 - e=integer_literal() - elif ((_givenValue == DOUBLE_QUOTED_STRING) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - e=string_literal() - elif ((_givenValue == FALSE) - or (_givenValue ==TRUE) - ): // 1827 - e=bool_literal() - elif ((_givenValue == NULL)): // 1831 - e=null_literal() - elif ((_givenValue == DOUBLE)): // 1831 - e=double_literal() - else: // line 1969 - if ((LA(1)==ID) and (tokenSet_13_.member(cast(int, LA(2))))): - e=attribute_parameter_value_bitwise_expression() - elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_15_.member(cast(int, LA(2))))): // line 2102 - e=typeof_expression() - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_16_) - else: - raise - return e - - public def integer_literal() as IntegerLiteralExpression : //throws RecognitionException, TokenStreamException - e as IntegerLiteralExpression - - i as IToken = null - l as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == INT)): // 1831 - i = LT(1) - match(INT) - if 0 == inputState.guessing: - e = ParseIntegerLiteralExpression(i, i.getText(), false); - elif ((_givenValue == LONG)): // 1831 - l = LT(1) - match(LONG) - if 0 == inputState.guessing: - s = l.getText() - e = ParseIntegerLiteralExpression(l, s[:-1], true) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_17_) - else: - raise - return e - - public def string_literal() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - dqs as IToken = null - sqs as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == DOUBLE_QUOTED_STRING)): // 1831 - dqs = LT(1) - match(DOUBLE_QUOTED_STRING) - if 0 == inputState.guessing: - s = dqs; - elif ((_givenValue == SINGLE_QUOTED_STRING)): // 1831 - sqs = LT(1) - match(SINGLE_QUOTED_STRING) - if 0 == inputState.guessing: - s = sqs; - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - e = StringLiteralExpression(ToLexicalInfo(s), s.getText()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_17_) - else: - raise - return e - - public def bool_literal() as BoolLiteralExpression : //throws RecognitionException, TokenStreamException - e as BoolLiteralExpression - - t as IToken = null - f as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == TRUE)): // 1831 - t = LT(1) - match(TRUE) - if 0 == inputState.guessing: - e = BoolLiteralExpression(ToLexicalInfo(t), Value: true) - elif ((_givenValue == FALSE)): // 1831 - f = LT(1) - match(FALSE) - if 0 == inputState.guessing: - e = BoolLiteralExpression(ToLexicalInfo(f), Value: false) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_17_) - else: - raise - return e - - public def null_literal() as NullLiteralExpression : //throws RecognitionException, TokenStreamException - e as NullLiteralExpression - - t as IToken = null - - try: // for error handling - t = LT(1) - match(NULL) - if 0 == inputState.guessing: - e = NullLiteralExpression(ToLexicalInfo(t)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_17_) - else: - raise - return e - - public def double_literal() as DoubleLiteralExpression : //throws RecognitionException, TokenStreamException - rle as DoubleLiteralExpression - - value as IToken = null - - try: // for error handling - value = LT(1) - match(DOUBLE) - if 0 == inputState.guessing: - rle = CodeFactory.NewDoubleLiteralExpression(ToLexicalInfo(value), value.getText()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_17_) - else: - raise - return rle - - public def attribute_parameter_value_bitwise_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - op as IToken = null - - try: // for error handling - e=attribute_parameter_value_reference_expression() - while true: - if ((LA(1)==BITWISE_OR)): - op = LT(1) - match(BITWISE_OR) - rhs=attribute_parameter_value_reference_expression() - if 0 == inputState.guessing: - e = BinaryExpression(ToLexicalInfo(op), - Operator: BinaryOperatorType.BitwiseOr, - Left: e, - Right: rhs) - else: - goto _loop10_breakloop - :_loop10_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_16_) - else: - raise - return e - - public def typeof_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression + public def attribute_parameter( + attr as Ast.Attribute + ) as void: //throws RecognitionException, TokenStreamException - t as IToken = null try: // for error handling - _givenValue = LA(1) - if ((_givenValue == TYPEOF)): // 1831 - t = LT(1) - match(TYPEOF) - if ((LA(1)==LPAREN) and (tokenSet_18_.member(cast(int, LA(2))))): - match(LPAREN) - arg=expression() - match(RPAREN) - elif ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 - arg=expression() - else: - raise NoViableAltException(LT(1), getFilename()) + synPredMatched9 as bool = false + if ((LA(1)==ID) and (LA(2)==DOT or LA(2)==ASSIGN)): + _m9 as int = mark() + synPredMatched9 = true + ++inputState.guessing + try: + match(ID) + match(ASSIGN) + except x as RecognitionException: + synPredMatched9 = false + rewind(_m9) + --inputState.guessing + if synPredMatched9: + name=reference_expression() + match(ASSIGN) + value=expression() if 0 == inputState.guessing: - mie = MethodInvocationExpression(ToLexicalInfo(t)); - mie.Target = ReferenceExpression(ToLexicalInfo(t), Name: t.getText()) - mie.Arguments.Add(arg) - e = mie - elif ((_givenValue == FUNCTION) - or (_givenValue ==ID) - or (_givenValue ==LPAREN) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == LPAREN)): // 1831 - match(LPAREN) - tr=type_reference() - match(RPAREN) - elif ((_givenValue == FUNCTION) - or (_givenValue ==ID) - ): // 1827 - tr=type_reference() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) + attr.NamedArguments.Add(ExpressionPair(name, value)) + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + value=expression() if 0 == inputState.guessing: - e = TypeofExpression(ToLexicalInfo(t), tr); - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_17_) + attr.Arguments.Add(value) else: - raise - return e - - public def attribute_parameter_value_reference_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - e=reference_expression() + raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_15_) else: raise - return e public def reference_expression() as Expression : //throws RecognitionException, TokenStreamException e as Expression @@ -811,52 +596,29 @@ class UnityScriptParser(antlr.LLkParser): match(DOT) e=member_reference_expression(e) else: - goto _loop196_breakloop - :_loop196_breakloop + goto _loop192_breakloop + :_loop192_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_20_) + recover(ex,tokenSet_16_) else: raise return e - public def attribute_parameter( - attr as Ast.Attribute - ) as void: //throws RecognitionException, TokenStreamException + public def expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression try: // for error handling - synPredMatched14 as bool = false - if ((LA(1)==ID) and (LA(2)==DOT or LA(2)==ASSIGN)): - _m14 as int = mark() - synPredMatched14 = true - ++inputState.guessing - try: - match(ID) - match(ASSIGN) - except x as RecognitionException: - synPredMatched14 = false - rewind(_m14) - --inputState.guessing - if synPredMatched14: - name=reference_expression() - match(ASSIGN) - value=attribute_parameter_value() - if 0 == inputState.guessing: - attr.NamedArguments.Add(ExpressionPair(name, value)) - elif ((tokenSet_21_.member(cast(int, LA(1)))) and (tokenSet_22_.member(cast(int, LA(2))))): // line 2102 - value=attribute_parameter_value() - if 0 == inputState.guessing: - attr.Arguments.Add(value) - else: - raise NoViableAltException(LT(1), getFilename()) + e=conditional_expression() except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise + return e public def attribute() as void: //throws RecognitionException, TokenStreamException @@ -869,7 +631,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_23_) + recover(ex,tokenSet_18_) else: raise @@ -881,17 +643,28 @@ class UnityScriptParser(antlr.LLkParser): name=qname() if 0 == inputState.guessing: attr = Ast.Attribute(ToLexicalInfo(name), name.getText()) - if ((LA(1)==LPAREN) and (tokenSet_24_.member(cast(int, LA(2))))): + if ((LA(1)==LPAREN) and (tokenSet_19_.member(cast(int, LA(2))))): match(LPAREN) _givenValue = LA(1) if ((_givenValue == FALSE) or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) or (_givenValue ==TRUE) or (_givenValue ==TYPEOF) or (_givenValue ==ID) or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) or (_givenValue ==INT) or (_givenValue ==LONG) @@ -903,21 +676,21 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) attribute_parameter(attr) else: - goto _loop25_breakloop - :_loop25_breakloop + goto _loop20_breakloop + :_loop20_breakloop elif ((_givenValue == RPAREN)): // 1831 pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) match(RPAREN) - elif ((tokenSet_25_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_20_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_25_) + recover(ex,tokenSet_20_) else: raise return attr @@ -944,14 +717,14 @@ class UnityScriptParser(antlr.LLkParser): buffer.Append(".") buffer.Append(other.getText()) else: - goto _loop41_breakloop - :_loop41_breakloop + goto _loop36_breakloop + :_loop36_breakloop if 0 == inputState.guessing: id.setText(buffer.ToString()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_27_) + recover(ex,tokenSet_22_) else: raise return id @@ -995,12 +768,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: VirtualKeywordHasNoEffect(v) else: // line 1969 - goto _loop51_breakloop - :_loop51_breakloop + goto _loop46_breakloop + :_loop46_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_23_) else: raise return m @@ -1098,7 +871,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_24_) else: raise @@ -1106,19 +879,19 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - if ((LA(1)==EOS) and (tokenSet_30_.member(cast(int, LA(2))))): - _cnt48 as int = 0 + if ((LA(1)==EOS) and (tokenSet_25_.member(cast(int, LA(2))))): + _cnt43 as int = 0 while true: - if ((LA(1)==EOS) and (tokenSet_30_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_25_.member(cast(int, LA(2))))): match(EOS) else: - if (_cnt48 >= 1): - goto _loop48_breakloop + if (_cnt43 >= 1): + goto _loop43_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt48 - :_loop48_breakloop - elif ((tokenSet_30_.member(cast(int, LA(1)))) and (tokenSet_31_.member(cast(int, LA(2))))): // line 2102 + ++_cnt43 + :_loop43_breakloop + elif ((tokenSet_25_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: SemicolonExpected() else: @@ -1126,7 +899,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_30_) + recover(ex,tokenSet_25_) else: raise @@ -1202,7 +975,7 @@ class UnityScriptParser(antlr.LLkParser): BaseTypeAnnotations.AnnotateImplements(typeRef) match(LBRACE) while true: - if ((tokenSet_32_.member(cast(int, LA(1))))): + if ((tokenSet_27_.member(cast(int, LA(1))))): if 0 == inputState.guessing: mod = TypeMemberModifiers.None _givenValue = LA(1) @@ -1227,9 +1000,9 @@ class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((tokenSet_33_.member(cast(int, LA(1)))) and (tokenSet_34_.member(cast(int, LA(2))))): + if ((tokenSet_28_.member(cast(int, LA(1)))) and (tokenSet_29_.member(cast(int, LA(2))))): mod=member_modifiers() - elif ((tokenSet_28_.member(cast(int, LA(1)))) and (tokenSet_35_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_23_.member(cast(int, LA(1)))) and (tokenSet_30_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1251,8 +1024,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: m.Modifiers |= mod if m is not null else: - goto _loop63_breakloop - :_loop63_breakloop + goto _loop58_breakloop + :_loop58_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: @@ -1261,12 +1034,12 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS)): match(EOS) else: - goto _loop65_breakloop - :_loop65_breakloop + goto _loop60_breakloop + :_loop60_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_31_) else: raise return member @@ -1308,8 +1081,8 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) interface_member(td) else: - goto _loop70_breakloop - :_loop70_breakloop + goto _loop65_breakloop + :_loop65_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: @@ -1318,12 +1091,12 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS)): match(EOS) else: - goto _loop72_breakloop - :_loop72_breakloop + goto _loop67_breakloop + :_loop67_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_31_) else: raise return member @@ -1355,8 +1128,8 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) enum_member(ed) else: - goto _loop81_breakloop - :_loop81_breakloop + goto _loop76_breakloop + :_loop76_breakloop _givenValue = LA(1) if ((_givenValue == COMMA)): // 1831 match(COMMA) @@ -1376,12 +1149,12 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS)): match(EOS) else: - goto _loop84_breakloop - :_loop84_breakloop + goto _loop79_breakloop + :_loop79_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_31_) else: raise return member @@ -1418,7 +1191,9 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling match(LPAREN) _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 + if ((_givenValue == ID) + or (_givenValue ==AT) + ): // 1827 parameter_declaration_list(method) elif ((_givenValue == RPAREN)): // 1831 pass // 947 @@ -1441,7 +1216,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_31_) else: raise @@ -1584,7 +1359,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_31_) else: raise return member @@ -1610,7 +1385,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_24_) else: raise @@ -1624,10 +1399,10 @@ class UnityScriptParser(antlr.LLkParser): f = LT(1) match(FOR) match(LPAREN) - synPredMatched131 as bool = false + synPredMatched127 as bool = false if ((LA(1)==VAR or LA(1)==ID) and (LA(2)==IN or LA(2)==ID)): - _m131 as int = mark() - synPredMatched131 = true + _m127 as int = mark() + synPredMatched127 = true ++inputState.guessing try: _givenValue = LA(1) @@ -1639,12 +1414,12 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) match(IN) except x as RecognitionException: - synPredMatched131 = false - rewind(_m131) + synPredMatched127 = false + rewind(_m127) --inputState.guessing - if synPredMatched131: + if synPredMatched127: stmt=for_in(container) - elif ((tokenSet_37_.member(cast(int, LA(1)))) and (tokenSet_38_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_33_.member(cast(int, LA(2))))): // line 2102 stmt=for_c(container) else: raise NoViableAltException(LT(1), getFilename()) @@ -1653,7 +1428,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_24_) else: raise @@ -1673,20 +1448,20 @@ class UnityScriptParser(antlr.LLkParser): b = s.TrueBlock = Block() container.Add(s) compound_or_single_stmt(b) - if ((LA(1)==ELSE) and (tokenSet_39_.member(cast(int, LA(2))))): + if ((LA(1)==ELSE) and (tokenSet_34_.member(cast(int, LA(2))))): et = LT(1) match(ELSE) if 0 == inputState.guessing: b = s.FalseBlock = Block(ToLexicalInfo(et)) compound_or_single_stmt(b) - elif ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_24_) else: raise @@ -1732,18 +1507,18 @@ class UnityScriptParser(antlr.LLkParser): tr = null compound_or_single_stmt(b) else: - goto _loop157_breakloop - :_loop157_breakloop - if ((LA(1)==FINALLY) and (tokenSet_39_.member(cast(int, LA(2))))): + goto _loop153_breakloop + :_loop153_breakloop + if ((LA(1)==FINALLY) and (tokenSet_34_.member(cast(int, LA(2))))): finally_block(s) - elif ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_24_) else: raise @@ -1786,22 +1561,22 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: item.Arguments.Add(e); else: - goto _loop145_breakloop - :_loop145_breakloop - _cnt147 as int = 0 + goto _loop141_breakloop + :_loop141_breakloop + _cnt143 as int = 0 while true: - if ((tokenSet_39_.member(cast(int, LA(1))))): + if ((tokenSet_34_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt147 >= 1): - goto _loop147_breakloop + if (_cnt143 >= 1): + goto _loop143_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt147 - :_loop147_breakloop + ++_cnt143 + :_loop143_breakloop else: - goto _loop148_breakloop - :_loop148_breakloop + goto _loop144_breakloop + :_loop144_breakloop _givenValue = LA(1) if ((_givenValue == DEFAULT)): // 1831 d = LT(1) @@ -1811,32 +1586,32 @@ class UnityScriptParser(antlr.LLkParser): item = MacroStatement(ToLexicalInfo(d), Name: d.getText()) itemBlock = item.Body switchBlock.Add(item) - _cnt151 as int = 0 + _cnt147 as int = 0 while true: - if ((tokenSet_39_.member(cast(int, LA(1))))): + if ((tokenSet_34_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt151 >= 1): - goto _loop151_breakloop + if (_cnt147 >= 1): + goto _loop147_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt151 - :_loop151_breakloop + ++_cnt147 + :_loop147_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) match(RBRACE) while true: - if ((LA(1)==EOS) and (tokenSet_29_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_24_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop153_breakloop - :_loop153_breakloop + goto _loop149_breakloop + :_loop149_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_24_) else: raise @@ -1852,7 +1627,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_24_) else: raise @@ -1865,9 +1640,9 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling yt = LT(1) match(YIELD) - if ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_40_.member(cast(int, LA(2))))): + if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_35_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1876,7 +1651,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_24_) else: raise @@ -1889,9 +1664,9 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling ret = LT(1) match(RETURN) - if ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_40_.member(cast(int, LA(2))))): + if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_35_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1900,7 +1675,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_24_) else: raise @@ -1918,7 +1693,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_24_) else: raise @@ -1941,7 +1716,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_24_) else: raise @@ -1954,9 +1729,9 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling t = LT(1) match(THROW) - if ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_40_.member(cast(int, LA(2))))): + if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_35_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1965,7 +1740,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_24_) else: raise @@ -2016,12 +1791,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: VirtualKeywordHasNoEffect(v) else: // line 1969 - goto _loop54_breakloop - :_loop54_breakloop + goto _loop49_breakloop + :_loop49_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_23_) else: raise return m @@ -2043,14 +1818,14 @@ class UnityScriptParser(antlr.LLkParser): match(RBRACK) if 0 == inputState.guessing: tr = ArrayTypeReference(tr.LexicalInfo, tr); - elif ((tokenSet_41_.member(cast(int, LA(1)))) and (tokenSet_42_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_36_.member(cast(int, LA(1)))) and (tokenSet_37_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_41_) + recover(ex,tokenSet_36_) else: raise return tr @@ -2071,12 +1846,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: typeReferences.Add(tr) else: - goto _loop181_breakloop - :_loop181_breakloop + goto _loop177_breakloop + :_loop177_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_43_) + recover(ex,tokenSet_38_) else: raise @@ -2138,7 +1913,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_44_) + recover(ex,tokenSet_39_) else: raise return member @@ -2159,7 +1934,9 @@ class UnityScriptParser(antlr.LLkParser): parent.Members.Add(method) match(LPAREN) _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 + if ((_givenValue == ID) + or (_givenValue ==AT) + ): // 1827 parameter_declaration_list(method) elif ((_givenValue == RPAREN)): // 1831 pass // 947 @@ -2184,12 +1961,12 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS)): match(EOS) else: - goto _loop77_breakloop - :_loop77_breakloop + goto _loop72_breakloop + :_loop72_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_45_) + recover(ex,tokenSet_40_) else: raise @@ -2205,12 +1982,12 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) parameter_declaration(m) else: - goto _loop99_breakloop - :_loop99_breakloop + goto _loop94_breakloop + :_loop94_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_46_) + recover(ex,tokenSet_41_) else: raise @@ -2247,10 +2024,39 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_47_) + recover(ex,tokenSet_42_) else: raise + public def integer_literal() as IntegerLiteralExpression : //throws RecognitionException, TokenStreamException + e as IntegerLiteralExpression + + i as IToken = null + l as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == INT)): // 1831 + i = LT(1) + match(INT) + if 0 == inputState.guessing: + e = ParseIntegerLiteralExpression(i, i.getText(), false); + elif ((_givenValue == LONG)): // 1831 + l = LT(1) + match(LONG) + if 0 == inputState.guessing: + s = l.getText() + e = ParseIntegerLiteralExpression(l, s[:-1], true) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_17_) + else: + raise + return e + public def member_name() as antlr.IToken : //throws RecognitionException, TokenStreamException token as antlr.IToken @@ -2274,25 +2080,11 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_48_) + recover(ex,tokenSet_43_) else: raise return token - public def expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - e=conditional_expression() - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_17_) - else: - raise - return e - public def compound_statement( b as Block ) as void: //throws RecognitionException, TokenStreamException @@ -2301,15 +2093,15 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling block(b) while true: - if ((LA(1)==EOS) and (tokenSet_49_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_44_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop105_breakloop - :_loop105_breakloop + goto _loop101_breakloop + :_loop101_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_49_) + recover(ex,tokenSet_44_) else: raise @@ -2320,6 +2112,13 @@ class UnityScriptParser(antlr.LLkParser): id as IToken = null try: // for error handling + _givenValue = LA(1) + if ((_givenValue == AT)): // 1831 + attributes() + elif ((_givenValue == ID)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) id = LT(1) match(ID) _givenValue = LA(1) @@ -2335,10 +2134,11 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: parameter = ParameterDeclaration(ToLexicalInfo(id), Name: id.getText(), Type: tr) m.Parameters.Add(parameter) + FlushAttributes(parameter) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_15_) else: raise @@ -2348,16 +2148,16 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - if ((LA(1)==LBRACE) and (tokenSet_50_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_45_.member(cast(int, LA(2))))): compound_statement(b) - elif ((tokenSet_39_.member(cast(int, LA(1)))) and (tokenSet_51_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_34_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): // line 2102 statement(b) else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_24_) else: raise @@ -2459,23 +2259,23 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) eos() elif ((_givenValue == EOS)): // 1831 - _cnt115 as int = 0 + _cnt111 as int = 0 while true: - if ((LA(1)==EOS) and (tokenSet_29_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_24_.member(cast(int, LA(2))))): match(EOS) else: - if (_cnt115 >= 1): - goto _loop115_breakloop + if (_cnt111 >= 1): + goto _loop111_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt115 - :_loop115_breakloop + ++_cnt111 + :_loop111_breakloop else: // line 1969 raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_24_) else: raise @@ -2488,11 +2288,11 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling match(LBRACE) while true: - if ((tokenSet_39_.member(cast(int, LA(1))))): + if ((tokenSet_34_.member(cast(int, LA(1))))): statement(b) else: - goto _loop108_breakloop - :_loop108_breakloop + goto _loop104_breakloop + :_loop104_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: @@ -2583,7 +2383,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_52_) + recover(ex,tokenSet_47_) else: raise return d @@ -2739,7 +2539,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_53_) + recover(ex,tokenSet_48_) else: raise return e @@ -2780,7 +2580,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_24_) else: raise return stmt @@ -2909,7 +2709,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_24_) else: raise return stmt @@ -2945,7 +2745,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_29_) + recover(ex,tokenSet_24_) else: raise @@ -2956,7 +2756,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=logical_or() - if ((LA(1)==QUESTION_MARK) and (tokenSet_18_.member(cast(int, LA(2))))): + if ((LA(1)==QUESTION_MARK) and (tokenSet_13_.member(cast(int, LA(2))))): qm = LT(1) match(QUESTION_MARK) trueValue=logical_or() @@ -2967,7 +2767,7 @@ class UnityScriptParser(antlr.LLkParser): Condition: e, TrueValue: trueValue, FalseValue: falseValue) - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3027,7 +2827,7 @@ class UnityScriptParser(antlr.LLkParser): arguments = gtr.GenericArguments type_reference_list(arguments) match(GREATER_THAN) - elif ((tokenSet_41_.member(cast(int, LA(1)))) and (tokenSet_42_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_36_.member(cast(int, LA(1)))) and (tokenSet_37_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: tr = SimpleTypeReference(ToLexicalInfo(typeName), Name: typeName.getText()) else: @@ -3035,7 +2835,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_41_) + recover(ex,tokenSet_36_) else: raise return tr @@ -3057,14 +2857,14 @@ class UnityScriptParser(antlr.LLkParser): returnType=type_reference() if 0 == inputState.guessing: callableTypeRef.ReturnType = returnType - elif ((tokenSet_41_.member(cast(int, LA(1)))) and (tokenSet_42_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_36_.member(cast(int, LA(1)))) and (tokenSet_37_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_41_) + recover(ex,tokenSet_36_) else: raise return tr @@ -3090,8 +2890,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) else: - goto _loop173_breakloop - :_loop173_breakloop + goto _loop169_breakloop + :_loop169_breakloop elif ((_givenValue == RPAREN)): // 1831 pass // 947 else: // line 1969 @@ -3100,7 +2900,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_41_) + recover(ex,tokenSet_36_) else: raise @@ -3133,7 +2933,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=term() while true: - if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_18_.member(cast(int, LA(2))))): + if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_13_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == ADD)): // 1831 add = LT(1) @@ -3155,8 +2955,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop248_breakloop - :_loop248_breakloop + goto _loop244_breakloop + :_loop244_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3185,18 +2985,18 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched185 as bool = false + synPredMatched181 as bool = false if ((LA(1)==NEW) and (LA(2)==ID)): - _m185 as int = mark() - synPredMatched185 = true + _m181 as int = mark() + synPredMatched181 = true ++inputState.guessing try: new_array_expression() except x as RecognitionException: - synPredMatched185 = false - rewind(_m185) + synPredMatched181 = false + rewind(_m181) --inputState.guessing - if synPredMatched185: + if synPredMatched181: e=new_array_expression() elif ((LA(1)==NEW) and (LA(2)==ID)): // line 2102 match(NEW) @@ -3258,8 +3058,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ec.Add(e); else: - goto _loop214_breakloop - :_loop214_breakloop + goto _loop210_breakloop + :_loop210_breakloop elif ((_givenValue == RPAREN) or (_givenValue ==RBRACK) ): // 1827 @@ -3269,7 +3069,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_55_) + recover(ex,tokenSet_50_) else: raise @@ -3301,9 +3101,9 @@ class UnityScriptParser(antlr.LLkParser): e=function_expression() elif ((LA(1)==ID) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 e=simple_reference_expression() - elif ((LA(1)==LPAREN) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==LPAREN) and (tokenSet_13_.member(cast(int, LA(2))))): // line 2102 e=paren_expression() - elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_51_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 e=typeof_expression() else: raise NoViableAltException(LT(1), getFilename()) @@ -3371,7 +3171,9 @@ class UnityScriptParser(antlr.LLkParser): body = e.Body match(LPAREN) _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 + if ((_givenValue == ID) + or (_givenValue ==AT) + ): // 1827 parameter_declaration_list(e) elif ((_givenValue == RPAREN)): // 1831 pass // 947 @@ -3411,9 +3213,9 @@ class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((LA(1)==LBRACE) and (tokenSet_50_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_45_.member(cast(int, LA(2))))): block(body) - elif ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 returnValue=expression() if 0 == inputState.guessing: body.Add(returnValue) @@ -3445,6 +3247,56 @@ class UnityScriptParser(antlr.LLkParser): raise return e + public def typeof_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + t as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == TYPEOF)): // 1831 + t = LT(1) + match(TYPEOF) + if ((LA(1)==LPAREN) and (tokenSet_13_.member(cast(int, LA(2))))): + match(LPAREN) + arg=expression() + match(RPAREN) + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + arg=expression() + else: + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + mie = MethodInvocationExpression(ToLexicalInfo(t)); + mie.Target = ReferenceExpression(ToLexicalInfo(t), Name: t.getText()) + mie.Arguments.Add(arg) + e = mie + elif ((_givenValue == FUNCTION) + or (_givenValue ==ID) + or (_givenValue ==LPAREN) + ): // 1827 + _givenValue = LA(1) + if ((_givenValue == LPAREN)): // 1831 + match(LPAREN) + tr=type_reference() + match(RPAREN) + elif ((_givenValue == FUNCTION) + or (_givenValue ==ID) + ): // 1827 + tr=type_reference() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + e = TypeofExpression(ToLexicalInfo(t), tr); + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_17_) + else: + raise + return e + public def member_reference_expression( target as Expression ) as Expression : //throws RecognitionException, TokenStreamException @@ -3616,7 +3468,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_56_) + recover(ex,tokenSet_52_) else: raise @@ -3633,7 +3485,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=atom() while true: - if ((LA(1)==LBRACK) and (tokenSet_57_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACK) and (tokenSet_53_.member(cast(int, LA(2))))): lbrack = LT(1) match(LBRACK) if 0 == inputState.guessing: @@ -3646,13 +3498,13 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) slice(se) else: - goto _loop230_breakloop - :_loop230_breakloop + goto _loop226_breakloop + :_loop226_breakloop match(RBRACK) - elif ((LA(1)==DOT) and (tokenSet_58_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DOT) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 match(DOT) e=member_reference_expression(e) - elif ((LA(1)==LPAREN) and (tokenSet_59_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==LPAREN) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 lparen = LT(1) match(LPAREN) if 0 == inputState.guessing: @@ -3663,8 +3515,8 @@ class UnityScriptParser(antlr.LLkParser): expression_list(args) match(RPAREN) else: - goto _loop233_breakloop - :_loop233_breakloop + goto _loop229_breakloop + :_loop229_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3691,7 +3543,7 @@ class UnityScriptParser(antlr.LLkParser): match(DECREMENT) if 0 == inputState.guessing: token = preinc; operator= UnaryOperatorType.PostDecrement; - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3755,7 +3607,7 @@ class UnityScriptParser(antlr.LLkParser): tr=type_reference() if 0 == inputState.guessing: e = CastExpression(ToLexicalInfo(c), Target: e, Type: tr) - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3828,7 +3680,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=unary_expression() while true: - if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_18_.member(cast(int, LA(2))))): + if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_13_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == MULTIPLY)): // 1831 m = LT(1) @@ -3855,8 +3707,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop244_breakloop - :_loop244_breakloop + goto _loop240_breakloop + :_loop240_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3874,7 +3726,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=sum() while true: - if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_18_.member(cast(int, LA(2))))): + if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_13_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == SHIFT_LEFT)): // 1831 sl = LT(1) @@ -3892,8 +3744,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop252_breakloop - :_loop252_breakloop + goto _loop248_breakloop + :_loop248_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3918,7 +3770,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=shift() while true: - if ((tokenSet_60_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): + if ((tokenSet_55_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == IN) or (_givenValue ==LESS_THAN) @@ -3972,8 +3824,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop264_breakloop - :_loop264_breakloop + goto _loop260_breakloop + :_loop260_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3993,7 +3845,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=comparison() while true: - if ((tokenSet_61_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): + if ((tokenSet_56_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == EQUALITY)): // 1831 te = LT(1) @@ -4021,8 +3873,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), op, e, r) else: - goto _loop272_breakloop - :_loop272_breakloop + goto _loop268_breakloop + :_loop268_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4039,7 +3891,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=equality() while true: - if ((LA(1)==BITWISE_AND) and (tokenSet_18_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_AND) and (tokenSet_13_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_AND) if 0 == inputState.guessing: @@ -4048,8 +3900,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop275_breakloop - :_loop275_breakloop + goto _loop271_breakloop + :_loop271_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4066,7 +3918,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_and() while true: - if ((LA(1)==BITWISE_XOR) and (tokenSet_18_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_XOR) and (tokenSet_13_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_XOR) if 0 == inputState.guessing: @@ -4075,8 +3927,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop278_breakloop - :_loop278_breakloop + goto _loop274_breakloop + :_loop274_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4093,7 +3945,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_xor() while true: - if ((LA(1)==BITWISE_OR) and (tokenSet_18_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_OR) and (tokenSet_13_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_OR) if 0 == inputState.guessing: @@ -4102,8 +3954,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop281_breakloop - :_loop281_breakloop + goto _loop277_breakloop + :_loop277_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4120,7 +3972,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_or() while true: - if ((LA(1)==LOGICAL_AND) and (tokenSet_18_.member(cast(int, LA(2))))): + if ((LA(1)==LOGICAL_AND) and (tokenSet_13_.member(cast(int, LA(2))))): op = LT(1) match(LOGICAL_AND) rhs=bitwise_or() @@ -4130,8 +3982,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop284_breakloop - :_loop284_breakloop + goto _loop280_breakloop + :_loop280_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4148,7 +4000,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=logical_and() while true: - if ((LA(1)==LOGICAL_OR) and (tokenSet_18_.member(cast(int, LA(2))))): + if ((LA(1)==LOGICAL_OR) and (tokenSet_13_.member(cast(int, LA(2))))): op = LT(1) match(LOGICAL_OR) rhs=logical_and() @@ -4158,8 +4010,38 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop287_breakloop - :_loop287_breakloop + goto _loop283_breakloop + :_loop283_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_17_) + else: + raise + return e + + public def string_literal() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + dqs as IToken = null + sqs as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == DOUBLE_QUOTED_STRING)): // 1831 + dqs = LT(1) + match(DOUBLE_QUOTED_STRING) + if 0 == inputState.guessing: + s = dqs; + elif ((_givenValue == SINGLE_QUOTED_STRING)): // 1831 + sqs = LT(1) + match(SINGLE_QUOTED_STRING) + if 0 == inputState.guessing: + s = sqs; + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + e = StringLiteralExpression(ToLexicalInfo(s), s.getText()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4177,19 +4059,19 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling lbrack = LT(1) match(LBRACK) - synPredMatched295 as bool = false - if ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_62_.member(cast(int, LA(2))))): - _m295 as int = mark() - synPredMatched295 = true + synPredMatched291 as bool = false + if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_57_.member(cast(int, LA(2))))): + _m291 as int = mark() + synPredMatched291 = true ++inputState.guessing try: expression() match(FOR) except x as RecognitionException: - synPredMatched295 = false - rewind(_m295) + synPredMatched291 = false + rewind(_m291) --inputState.guessing - if synPredMatched295: + if synPredMatched291: projection=expression() match(FOR) match(LPAREN) @@ -4215,7 +4097,7 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) - elif ((tokenSet_63_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_58_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)); items = ale.Items; expression_list(items) @@ -4276,8 +4158,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dle.Items.Add(pair); else: - goto _loop303_breakloop - :_loop303_breakloop + goto _loop299_breakloop + :_loop299_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 @@ -4309,6 +4191,52 @@ class UnityScriptParser(antlr.LLkParser): raise return re + public def bool_literal() as BoolLiteralExpression : //throws RecognitionException, TokenStreamException + e as BoolLiteralExpression + + t as IToken = null + f as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == TRUE)): // 1831 + t = LT(1) + match(TRUE) + if 0 == inputState.guessing: + e = BoolLiteralExpression(ToLexicalInfo(t), Value: true) + elif ((_givenValue == FALSE)): // 1831 + f = LT(1) + match(FALSE) + if 0 == inputState.guessing: + e = BoolLiteralExpression(ToLexicalInfo(f), Value: false) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_17_) + else: + raise + return e + + public def null_literal() as NullLiteralExpression : //throws RecognitionException, TokenStreamException + e as NullLiteralExpression + + t as IToken = null + + try: // for error handling + t = LT(1) + match(NULL) + if 0 == inputState.guessing: + e = NullLiteralExpression(ToLexicalInfo(t)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_17_) + else: + raise + return e + public def self_literal() as SelfLiteralExpression : //throws RecognitionException, TokenStreamException e as SelfLiteralExpression @@ -4345,6 +4273,24 @@ class UnityScriptParser(antlr.LLkParser): raise return e + public def double_literal() as DoubleLiteralExpression : //throws RecognitionException, TokenStreamException + rle as DoubleLiteralExpression + + value as IToken = null + + try: // for error handling + value = LT(1) + match(DOUBLE) + if 0 == inputState.guessing: + rle = CodeFactory.NewDoubleLiteralExpression(ToLexicalInfo(value), value.getText()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_17_) + else: + raise + return rle + public def expression_pair() as ExpressionPair : //throws RecognitionException, TokenStreamException ep as ExpressionPair @@ -4360,7 +4306,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_47_) + recover(ex,tokenSet_42_) else: raise return ep @@ -4540,19 +4486,19 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_12_ = BitSet(mk_tokenSet_12_()) private static def mk_tokenSet_13_() as (long): - data = (6341068275337658368L, 2L, 0L, 0L, ) + data = (-8809034961160888320L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_13_ = BitSet(mk_tokenSet_13_()) private static def mk_tokenSet_14_() as (long): - data = (306249172707835904L, 0L, ) + data = (-2323851497726402480L, 2182346702043L, 0L, 0L, ) return data public static final tokenSet_14_ = BitSet(mk_tokenSet_14_()) private static def mk_tokenSet_15_() as (long): - data = (-2467966685823229952L, 2147484183552L, 0L, 0L, ) + data = (5188146770730811392L, 0L, ) return data public static final tokenSet_15_ = BitSet(mk_tokenSet_15_()) private static def mk_tokenSet_16_() as (long): - data = (5188146770730811392L, 0L, ) + data = (288230376151711744L, 512L, 0L, 0L, ) return data public static final tokenSet_16_ = BitSet(mk_tokenSet_16_()) private static def mk_tokenSet_17_() as (long): @@ -4560,187 +4506,167 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_17_ = BitSet(mk_tokenSet_17_()) private static def mk_tokenSet_18_() as (long): - data = (-8809034961160888320L, 2147484183552L, 0L, 0L, ) + data = (18040881051486464L, 3221225472L, 0L, 0L, ) return data public static final tokenSet_18_ = BitSet(mk_tokenSet_18_()) private static def mk_tokenSet_19_() as (long): - data = (5188146770730811392L, 2L, 0L, 0L, ) + data = (-8232574208857464832L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) private static def mk_tokenSet_20_() as (long): - data = (5476377146882523136L, 514L, 0L, 0L, ) + data = (-8808759439134069982L, 2150705409024L, 0L, 0L, ) return data public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) private static def mk_tokenSet_21_() as (long): - data = (342279069305544704L, 2061584302080L, 0L, 0L, ) + data = (-844433523250318L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) private static def mk_tokenSet_22_() as (long): - data = (-2467966685823229952L, 2147484183554L, 0L, 0L, ) + data = (-42949939214L, 2199023255551L, 0L, 0L, ) return data public static final tokenSet_22_ = BitSet(mk_tokenSet_22_()) private static def mk_tokenSet_23_() as (long): - data = (18040881051486464L, 3221225472L, 0L, 0L, ) + data = (8800396511488L, 0L, ) return data public static final tokenSet_23_ = BitSet(mk_tokenSet_23_()) private static def mk_tokenSet_24_() as (long): - data = (918739821608968192L, 2061584302080L, 0L, 0L, ) + data = (-8663799828275531870L, 2150705409280L, 0L, 0L, ) return data public static final tokenSet_24_ = BitSet(mk_tokenSet_24_()) private static def mk_tokenSet_25_() as (long): - data = (-8808759439134069982L, 2150705409024L, 0L, 0L, ) + data = (-8663799826126999646L, 2155000376576L, 0L, 0L, ) return data public static final tokenSet_25_ = BitSet(mk_tokenSet_25_()) private static def mk_tokenSet_26_() as (long): - data = (-2883148195040367758L, 2194728288255L, 0L, 0L, ) + data = (-3149838L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_26_ = BitSet(mk_tokenSet_26_()) private static def mk_tokenSet_27_() as (long): - data = (-42949939214L, 2199023255551L, 0L, 0L, ) + data = (26482542004480L, 1073741824L, 0L, 0L, ) return data public static final tokenSet_27_ = BitSet(mk_tokenSet_27_()) private static def mk_tokenSet_28_() as (long): - data = (8800396511488L, 0L, ) + data = (26482542004480L, 0L, ) return data public static final tokenSet_28_ = BitSet(mk_tokenSet_28_()) private static def mk_tokenSet_29_() as (long): - data = (-8663799828275531870L, 2150705409280L, 0L, 0L, ) + data = (18040915411486976L, 0L, ) return data public static final tokenSet_29_ = BitSet(mk_tokenSet_29_()) private static def mk_tokenSet_30_() as (long): - data = (-8663799826126999646L, 2155000376576L, 0L, 0L, ) + data = (18014432869499136L, 0L, ) return data public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) private static def mk_tokenSet_31_() as (long): - data = (-3149838L, 2194728288255L, 0L, 0L, ) + data = (-8664644251058214110L, 2150705409024L, 0L, 0L, ) return data public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) private static def mk_tokenSet_32_() as (long): - data = (26482542004480L, 1073741824L, 0L, 0L, ) + data = (-8809026165067866112L, 2147484183808L, 0L, 0L, ) return data public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) private static def mk_tokenSet_33_() as (long): - data = (26482542004480L, 0L, ) + data = (-7495109769854574512L, 2191507062783L, 0L, 0L, ) return data public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) private static def mk_tokenSet_34_() as (long): - data = (18040915411486976L, 0L, ) + data = (-8808777125549366752L, 2147484183808L, 0L, 0L, ) return data public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) private static def mk_tokenSet_35_() as (long): - data = (18014432869499136L, 0L, ) + data = (-7510878323647713294L, 2185567927771L, 0L, 0L, ) return data public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) private static def mk_tokenSet_36_() as (long): - data = (-8664644251058214110L, 2150705409024L, 0L, 0L, ) + data = (-42950987790L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) private static def mk_tokenSet_37_() as (long): - data = (-8809026165067866112L, 2147484183808L, 0L, 0L, ) + data = (-8590987278L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) private static def mk_tokenSet_38_() as (long): - data = (-7495109769854574512L, 2191507062783L, 0L, 0L, ) + data = (72057594037927936L, 67108864L, 0L, 0L, ) return data public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) private static def mk_tokenSet_39_() as (long): - data = (-8808777125549366752L, 2147484183808L, 0L, 0L, ) + data = (144141670617860352L, 1073741824L, 0L, 0L, ) return data public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) private static def mk_tokenSet_40_() as (long): - data = (-7510878323647713294L, 2185567927771L, 0L, 0L, ) + data = (144115188075986944L, 1073741824L, 0L, 0L, ) return data public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) private static def mk_tokenSet_41_() as (long): - data = (-42950987790L, 2194728288255L, 0L, 0L, ) + data = (576460752303423488L, 0L, ) return data public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) private static def mk_tokenSet_42_() as (long): - data = (-8590987278L, 2194728288255L, 0L, 0L, ) + data = (4755801206503243776L, 0L, ) return data public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) private static def mk_tokenSet_43_() as (long): - data = (72057594037927936L, 67108864L, 0L, 0L, ) + data = (-6358801241844520158L, 2150705409792L, 0L, 0L, ) return data public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) private static def mk_tokenSet_44_() as (long): - data = (144141670617860352L, 1073741824L, 0L, 0L, ) + data = (-8663799826128048222L, 2150705409280L, 0L, 0L, ) return data public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) private static def mk_tokenSet_45_() as (long): - data = (144115188075986944L, 1073741824L, 0L, 0L, ) + data = (-8664661937473510880L, 2147484183808L, 0L, 0L, ) return data public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) private static def mk_tokenSet_46_() as (long): - data = (576460752303423488L, 0L, ) + data = (-7493989825045073934L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) private static def mk_tokenSet_47_() as (long): - data = (4755801206503243776L, 0L, ) + data = (-8663799828271337566L, 2150705409792L, 0L, 0L, ) return data public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) private static def mk_tokenSet_48_() as (long): - data = (-6358801241844520158L, 2150705409792L, 0L, 0L, ) + data = (-8087339075972108382L, 2150705409280L, 0L, 0L, ) return data public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) private static def mk_tokenSet_49_() as (long): - data = (-8663799826128048222L, 2150705409280L, 0L, 0L, ) + data = (-8593084430L, 2194728288255L, 0L, 0L, ) return data public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) private static def mk_tokenSet_50_() as (long): - data = (-8664661937473510880L, 2147484183808L, 0L, 0L, ) + data = (576460752303423488L, 1L, 0L, 0L, ) return data public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) private static def mk_tokenSet_51_() as (long): - data = (-7493989825045073934L, 2194728288255L, 0L, 0L, ) + data = (306249172707835904L, 0L, ) return data public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) private static def mk_tokenSet_52_() as (long): - data = (-8663799828271337566L, 2150705409792L, 0L, 0L, ) + data = (4611686018427387904L, 1L, 0L, 0L, ) return data public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) private static def mk_tokenSet_53_() as (long): - data = (-8087339075972108382L, 2150705409280L, 0L, 0L, ) + data = (-6503191951947194368L, 2147484183552L, 0L, 0L, ) return data public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) private static def mk_tokenSet_54_() as (long): - data = (-8593084430L, 2194728288255L, 0L, 0L, ) + data = (18014432869482496L, 4194304L, 0L, 0L, ) return data public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) private static def mk_tokenSet_55_() as (long): - data = (576460752303423488L, 1L, 0L, 0L, ) + data = (20971520L, 213909504L, 0L, 0L, ) return data public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) private static def mk_tokenSet_56_() as (long): - data = (4611686018427387904L, 1L, 0L, 0L, ) + data = (0L, 3342336L, 0L, 0L, ) return data public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) private static def mk_tokenSet_57_() as (long): - data = (-6503191951947194368L, 2147484183552L, 0L, 0L, ) + data = (-7511998268457148336L, 2182346702043L, 0L, 0L, ) return data public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) private static def mk_tokenSet_58_() as (long): - data = (18014432869482496L, 4194304L, 0L, 0L, ) - return data - public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) - private static def mk_tokenSet_59_() as (long): - data = (-8232574208857464832L, 2147484183552L, 0L, 0L, ) - return data - public static final tokenSet_59_ = BitSet(mk_tokenSet_59_()) - private static def mk_tokenSet_60_() as (long): - data = (20971520L, 213909504L, 0L, 0L, ) - return data - public static final tokenSet_60_ = BitSet(mk_tokenSet_60_()) - private static def mk_tokenSet_61_() as (long): - data = (0L, 3342336L, 0L, 0L, ) - return data - public static final tokenSet_61_ = BitSet(mk_tokenSet_61_()) - private static def mk_tokenSet_62_() as (long): - data = (-7511998268457148336L, 2182346702043L, 0L, 0L, ) - return data - public static final tokenSet_62_ = BitSet(mk_tokenSet_62_()) - private static def mk_tokenSet_63_() as (long): data = (-8809034961160888320L, 2147484183553L, 0L, 0L, ) return data - public static final tokenSet_63_ = BitSet(mk_tokenSet_63_()) + public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) From ba173568bc45a0244991dbe35df42cdb463cf3da Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 10 Nov 2010 00:49:56 -0200 Subject: [PATCH 107/276] support for assembly attributes --- .../ErrorMessagesTestFixture.Generated.boo | 4 +++ .../ParserTestFixture.Generated.boo | 4 +++ src/UnityScript/UnityScript.g | 26 ++++++++++++++----- .../invalid-attribute-sequence.js | 4 +++ .../attributes-for-script-and-assembly.js | 10 +++++++ 5 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 tests/error-messages/invalid-attribute-sequence.js create mode 100644 tests/parser/attributes-for-script-and-assembly.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index d137939..eb946f3 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -62,6 +62,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/interface-errors.js") + [Test] def invalid_attribute_sequence(): + RunTestCase("tests/error-messages/invalid-attribute-sequence.js") + + [Test] def invalid_generator_return_type(): RunTestCase("tests/error-messages/invalid-generator-return-type.js") diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index 7b4fd06..c81a4a0 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -14,6 +14,10 @@ partial class ParserTestFixture: RunTestCase("tests/parser/attributes-1.js") + [Test] def attributes_for_script_and_assembly(): + RunTestCase("tests/parser/attributes-for-script-and-assembly.js") + + [Test] def class_1(): RunTestCase("tests/parser/class-1.js") diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index f053440..d0423db 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -120,6 +120,7 @@ tokens INPLACE_SHIFT_RIGHT=">>="; AT="@"; SCRIPT_ATTRIBUTE_MARKER="@script"; + ASSEMBLY_ATTRIBUTE_MARKER="@assembly"; } { [property(CompilerContext)] @@ -207,6 +208,9 @@ tokens protected def VirtualKeywordHasNoEffect(token as antlr.IToken): _context.Warnings.Add(UnityScriptWarnings.VirtualKeywordHasNoEffect(ToLexicalInfo(token))) + protected def UnexpectedToken(token as antlr.IToken): + ReportError(CompilerErrorFactory.UnexpectedToken(ToLexicalInfo(token), null, token.getText())) + protected def KeywordCannotBeUsedAsAnIdentifier(token as antlr.IToken): ReportError(UnityScriptCompilerErrors.KeywordCannotBeUsedAsAnIdentifier(ToLexicalInfo(token), token.getText())) @@ -236,6 +240,8 @@ start[CompileUnit cu] | pragma_directive[module] )* ( + (AT ID ID)=> script_or_assembly_attribute[module] + | ( attributes module_member[module] @@ -306,10 +312,9 @@ module_member[Module module] { globals = module.Globals }: - + {GlobalVariablesBecomeFields()}? (module_member_modifiers VAR) => module_field[module] | (declaration_statement[globals] eos) - | script_attribute[module] | ( mod=module_member_modifiers @@ -335,12 +340,19 @@ module_function[TypeDefinition parent] returns [TypeMember member] function_body[method] ; -script_attribute[Module m] +script_or_assembly_attribute[Module m] { }: - SCRIPT_ATTRIBUTE_MARKER - attr=attribute_constructor - { m.Attributes.Add(attr); } + AT attributeKindToken:ID attr=attribute_constructor + { + attributeKind = attributeKindToken.getText() + if attributeKind == "assembly": + m.AssemblyAttributes.Add(attr) + elif attributeKind == "script": + m.Attributes.Add(attr) + else: + UnexpectedToken(attributeKindToken) + } ; module_field[Module m] @@ -1853,7 +1865,7 @@ SHIFT_RIGHT: ">>"; INPLACE_SHIFT_RIGHT: ">>="; -AT: '@' ("script" { $setType(SCRIPT_ATTRIBUTE_MARKER); })?; +AT: '@'; DIVISION: ("/*")=> ML_COMMENT { $setType(Token.SKIP); } | diff --git a/tests/error-messages/invalid-attribute-sequence.js b/tests/error-messages/invalid-attribute-sequence.js new file mode 100644 index 0000000..3f09231 --- /dev/null +++ b/tests/error-messages/invalid-attribute-sequence.js @@ -0,0 +1,4 @@ +/* +invalid-attribute-sequence.js(4,2): BCE0043: Unexpected token: foo. +*/ +@foo bar() diff --git a/tests/parser/attributes-for-script-and-assembly.js b/tests/parser/attributes-for-script-and-assembly.js new file mode 100644 index 0000000..017a819 --- /dev/null +++ b/tests/parser/attributes-for-script-and-assembly.js @@ -0,0 +1,10 @@ +/* +[AttributeForField] +f as float + +[module: SomeScriptAttribute] +[assembly: SomeAssemblyAttribute] +*/ +@script SomeScriptAttribute() +@assembly SomeAssemblyAttribute() +@AttributeForField var f:float; From 2b4d13d6e22ebed12d8a3fa308d300c9d8e31dba Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 10 Nov 2010 00:50:21 -0200 Subject: [PATCH 108/276] antlr generated files for latest parser changes (support for assembly attributes) --- src/UnityScript/Parser/UnityScriptLexer.boo | 154 +++--- src/UnityScript/Parser/UnityScriptParser.boo | 462 +++++++++--------- .../Parser/UnityScriptTokenTypes.boo | 45 +- .../Parser/UnityScriptTokenTypes.txt | 45 +- 4 files changed, 363 insertions(+), 343 deletions(-) diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index fce5a4a..b1d0529 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -124,28 +124,29 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): public static final INPLACE_SHIFT_RIGHT = 93 public static final AT = 94 public static final SCRIPT_ATTRIBUTE_MARKER = 95 - public static final HASH = 96 - public static final INPLACE_BITWISE_XOR = 97 - public static final NOT = 98 - public static final DIVISION = 99 - public static final RE_LITERAL = 100 - public static final DOUBLE = 101 - public static final INT = 102 - public static final LONG = 103 - public static final SINGLE_QUOTED_STRING = 104 - public static final DOUBLE_SUFFIX = 105 - public static final EXPONENT = 106 - public static final WHITE_SPACE = 107 - public static final DQS_ESC = 108 - public static final SQS_ESC = 109 - public static final SESC = 110 - public static final ML_COMMENT = 111 - public static final RE_CHAR = 112 - public static final RE_ESC = 113 - public static final NEWLINE = 114 - public static final ID_LETTER = 115 - public static final DIGIT = 116 - public static final HEXDIGIT = 117 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 96 + public static final HASH = 97 + public static final INPLACE_BITWISE_XOR = 98 + public static final NOT = 99 + public static final DIVISION = 100 + public static final RE_LITERAL = 101 + public static final DOUBLE = 102 + public static final INT = 103 + public static final LONG = 104 + public static final SINGLE_QUOTED_STRING = 105 + public static final DOUBLE_SUFFIX = 106 + public static final EXPONENT = 107 + public static final WHITE_SPACE = 108 + public static final DQS_ESC = 109 + public static final SQS_ESC = 110 + public static final SESC = 111 + public static final ML_COMMENT = 112 + public static final RE_CHAR = 113 + public static final RE_ESC = 114 + public static final NEWLINE = 115 + public static final ID_LETTER = 116 + public static final DIGIT = 117 + public static final HEXDIGIT = 118 static def IsDigit(ch as char): @@ -183,6 +184,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): literals.Add("*", 79) literals.Add("|=", 66) literals.Add("typeof", 42) + literals.Add("@assembly", 96) literals.Add("[", 63) literals.Add(">>=", 93) literals.Add("return", 27) @@ -584,8 +586,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mDIGIT(false) else: // line 1969 - goto _loop312_breakloop - :_loop312_breakloop + goto _loop314_breakloop + :_loop314_breakloop _ttype = testLiteralsTable(_ttype) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -678,17 +680,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): match("0x") - _cnt316 as int = 0 + _cnt318 as int = 0 while true: if ((tokenSet_0_.member(cast(int, cached_LA1)))): mHEXDIGIT(false) else: - if (_cnt316 >= 1): - goto _loop316_breakloop + if (_cnt318 >= 1): + goto _loop318_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt316 - :_loop316_breakloop + ++_cnt318 + :_loop318_breakloop if ((cached_LA1==char('L') or cached_LA1==char('l'))): _givenValue = cached_LA1 if ((_givenValue == char('l'))): // 1831 @@ -702,17 +704,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): else: // line 2053 pass // 947 elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt320 as int = 0 + _cnt322 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt320 >= 1): - goto _loop320_breakloop + if (_cnt322 >= 1): + goto _loop322_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt320 - :_loop320_breakloop + ++_cnt322 + :_loop322_breakloop _givenValue = cached_LA1 if ((_givenValue == char('L')) or (_givenValue ==char('l')) @@ -808,17 +810,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_SUFFIX - _cnt329 as int = 0 + _cnt331 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt329 >= 1): - goto _loop329_breakloop + if (_cnt331 >= 1): + goto _loop331_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt329 - :_loop329_breakloop + ++_cnt331 + :_loop331_breakloop if ((cached_LA1==char('E') or cached_LA1==char('e'))): mEXPONENT(false) else: // line 2053 @@ -869,17 +871,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt336 as int = 0 + _cnt338 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt336 >= 1): - goto _loop336_breakloop + if (_cnt338 >= 1): + goto _loop338_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt336 - :_loop336_breakloop + ++_cnt338 + :_loop338_breakloop if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1336,12 +1338,6 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = AT match('@') - if ((cached_LA1==char('s'))): - match("script") - if 0 == inputState.guessing: - _ttype = SCRIPT_ATTRIBUTE_MARKER; - else: // line 2053 - pass // 947 if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1351,18 +1347,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched384 as bool = false + synPredMatched385 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m384 as int = mark() - synPredMatched384 = true + _m385 as int = mark() + synPredMatched385 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched384 = false - rewind(_m384) + synPredMatched385 = false + rewind(_m385) --inputState.guessing - if synPredMatched384: + if synPredMatched385: mML_COMMENT(false) if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1375,8 +1371,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop389_breakloop - :_loop389_breakloop + goto _loop390_breakloop + :_loop390_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; elif ((_givenValue == char('='))): // 1831 @@ -1405,8 +1401,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop418_breakloop - :_loop418_breakloop + goto _loop419_breakloop + :_loop419_breakloop match("*/") if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1419,7 +1415,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt393 as int = 0 + _cnt394 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1433,12 +1429,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt393 >= 1): - goto _loop393_breakloop + if (_cnt394 >= 1): + goto _loop394_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt393 - :_loop393_breakloop + ++_cnt394 + :_loop394_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1481,8 +1477,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop397_breakloop - :_loop397_breakloop + goto _loop398_breakloop + :_loop398_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1531,8 +1527,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_4_) else: - goto _loop401_breakloop - :_loop401_breakloop + goto _loop402_breakloop + :_loop402_breakloop _saveIndex = text.Length match('\'') text.Length = _saveIndex @@ -1633,17 +1629,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt421 as int = 0 + _cnt422 as int = 0 while true: if ((tokenSet_5_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt421 >= 1): - goto _loop421_breakloop + if (_cnt422 >= 1): + goto _loop422_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt421 - :_loop421_breakloop + ++_cnt422 + :_loop422_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1701,17 +1697,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt427 as int = 0 + _cnt428 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt427 >= 1): - goto _loop427_breakloop + if (_cnt428 >= 1): + goto _loop428_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt427 - :_loop427_breakloop + ++_cnt428 + :_loop428_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index ebaa1b6..2f67dc4 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -122,28 +122,29 @@ class UnityScriptParser(antlr.LLkParser): public static final INPLACE_SHIFT_RIGHT = 93 public static final AT = 94 public static final SCRIPT_ATTRIBUTE_MARKER = 95 - public static final HASH = 96 - public static final INPLACE_BITWISE_XOR = 97 - public static final NOT = 98 - public static final DIVISION = 99 - public static final RE_LITERAL = 100 - public static final DOUBLE = 101 - public static final INT = 102 - public static final LONG = 103 - public static final SINGLE_QUOTED_STRING = 104 - public static final DOUBLE_SUFFIX = 105 - public static final EXPONENT = 106 - public static final WHITE_SPACE = 107 - public static final DQS_ESC = 108 - public static final SQS_ESC = 109 - public static final SESC = 110 - public static final ML_COMMENT = 111 - public static final RE_CHAR = 112 - public static final RE_ESC = 113 - public static final NEWLINE = 114 - public static final ID_LETTER = 115 - public static final DIGIT = 116 - public static final HEXDIGIT = 117 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 96 + public static final HASH = 97 + public static final INPLACE_BITWISE_XOR = 98 + public static final NOT = 99 + public static final DIVISION = 100 + public static final RE_LITERAL = 101 + public static final DOUBLE = 102 + public static final INT = 103 + public static final LONG = 104 + public static final SINGLE_QUOTED_STRING = 105 + public static final DOUBLE_SUFFIX = 106 + public static final EXPONENT = 107 + public static final WHITE_SPACE = 108 + public static final DQS_ESC = 109 + public static final SQS_ESC = 110 + public static final SESC = 111 + public static final ML_COMMENT = 112 + public static final RE_CHAR = 113 + public static final RE_ESC = 114 + public static final NEWLINE = 115 + public static final ID_LETTER = 116 + public static final DIGIT = 117 + public static final HEXDIGIT = 118 [property(CompilerContext)] @@ -231,6 +232,9 @@ class UnityScriptParser(antlr.LLkParser): protected def VirtualKeywordHasNoEffect(token as antlr.IToken): _context.Warnings.Add(UnityScriptWarnings.VirtualKeywordHasNoEffect(ToLexicalInfo(token))) + protected def UnexpectedToken(token as antlr.IToken): + ReportError(CompilerErrorFactory.UnexpectedToken(ToLexicalInfo(token), null, token.getText())) + protected def KeywordCannotBeUsedAsAnIdentifier(token as antlr.IToken): ReportError(UnityScriptCompilerErrors.KeywordCannotBeUsedAsAnIdentifier(ToLexicalInfo(token), token.getText())) @@ -290,7 +294,22 @@ class UnityScriptParser(antlr.LLkParser): goto _loop3_breakloop :_loop3_breakloop while true: - if ((LA(1)==AT)): + synPredMatched6 as bool = false + if ((LA(1)==AT) and (LA(2)==ID)): + _m6 as int = mark() + synPredMatched6 = true + ++inputState.guessing + try: + match(AT) + match(ID) + match(ID) + except x as RecognitionException: + synPredMatched6 = false + rewind(_m6) + --inputState.guessing + if synPredMatched6: + script_or_assembly_attribute(module) + elif ((LA(1)==AT) and (LA(2)==ID)): // line 2102 attributes() module_member(module) elif ((tokenSet_0_.member(cast(int, LA(1)))) and (tokenSet_1_.member(cast(int, LA(2))))): // line 2102 @@ -298,8 +317,8 @@ class UnityScriptParser(antlr.LLkParser): elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_3_.member(cast(int, LA(2))))): // line 2102 global_statement(module) else: - goto _loop6_breakloop - :_loop6_breakloop + goto _loop8_breakloop + :_loop8_breakloop eof = LT(1) match(Token.EOF_TYPE) if 0 == inputState.guessing: @@ -366,26 +385,52 @@ class UnityScriptParser(antlr.LLkParser): else: raise + public def script_or_assembly_attribute( + m as Module + ) as void: //throws RecognitionException, TokenStreamException + + attributeKindToken as IToken = null + + try: // for error handling + match(AT) + attributeKindToken = LT(1) + match(ID) + attr=attribute_constructor() + if 0 == inputState.guessing: + attributeKind = attributeKindToken.getText() + if attributeKind == "assembly": + m.AssemblyAttributes.Add(attr) + elif attributeKind == "script": + m.Attributes.Add(attr) + else: + UnexpectedToken(attributeKindToken) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_7_) + else: + raise + public def attributes() as void: //throws RecognitionException, TokenStreamException _attributes.Clear() try: // for error handling - _cnt14 as int = 0 + _cnt16 as int = 0 while true: if ((LA(1)==AT)): attribute() else: - if (_cnt14 >= 1): - goto _loop14_breakloop + if (_cnt16 >= 1): + goto _loop16_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt14 - :_loop14_breakloop + ++_cnt16 + :_loop16_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_7_) + recover(ex,tokenSet_8_) else: raise @@ -396,26 +441,24 @@ class UnityScriptParser(antlr.LLkParser): globals = module.Globals try: // for error handling - synPredMatched23 as bool = false - if (((tokenSet_8_.member(cast(int, LA(1)))) and (tokenSet_9_.member(cast(int, LA(2))))) and (GlobalVariablesBecomeFields())): - _m23 as int = mark() - synPredMatched23 = true + synPredMatched25 as bool = false + if (((tokenSet_9_.member(cast(int, LA(1)))) and (tokenSet_10_.member(cast(int, LA(2))))) and (GlobalVariablesBecomeFields())): + _m25 as int = mark() + synPredMatched25 = true ++inputState.guessing try: module_member_modifiers() match(VAR) except x as RecognitionException: - synPredMatched23 = false - rewind(_m23) + synPredMatched25 = false + rewind(_m25) --inputState.guessing - if synPredMatched23: + if synPredMatched25: module_field(module) elif ((LA(1)==VAR) and (LA(2)==ID)): // line 2102 declaration_statement(globals) eos() - elif ((LA(1)==SCRIPT_ATTRIBUTE_MARKER)): // line 2102 - script_attribute(module) - elif ((tokenSet_10_.member(cast(int, LA(1)))) and (tokenSet_11_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_11_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 mod=module_member_modifiers() _givenValue = LA(1) if ((_givenValue == CLASS) @@ -437,7 +480,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_7_) else: raise @@ -544,7 +587,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_7_) else: raise @@ -554,19 +597,19 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched9 as bool = false + synPredMatched11 as bool = false if ((LA(1)==ID) and (LA(2)==DOT or LA(2)==ASSIGN)): - _m9 as int = mark() - synPredMatched9 = true + _m11 as int = mark() + synPredMatched11 = true ++inputState.guessing try: match(ID) match(ASSIGN) except x as RecognitionException: - synPredMatched9 = false - rewind(_m9) + synPredMatched11 = false + rewind(_m11) --inputState.guessing - if synPredMatched9: + if synPredMatched11: name=reference_expression() match(ASSIGN) value=expression() @@ -596,8 +639,8 @@ class UnityScriptParser(antlr.LLkParser): match(DOT) e=member_reference_expression(e) else: - goto _loop192_breakloop - :_loop192_breakloop + goto _loop194_breakloop + :_loop194_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -676,8 +719,8 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) attribute_parameter(attr) else: - goto _loop20_breakloop - :_loop20_breakloop + goto _loop22_breakloop + :_loop22_breakloop elif ((_givenValue == RPAREN)): // 1831 pass // 947 else: // line 1969 @@ -717,8 +760,8 @@ class UnityScriptParser(antlr.LLkParser): buffer.Append(".") buffer.Append(other.getText()) else: - goto _loop36_breakloop - :_loop36_breakloop + goto _loop38_breakloop + :_loop38_breakloop if 0 == inputState.guessing: id.setText(buffer.ToString()) except ex as RecognitionException: @@ -768,8 +811,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: VirtualKeywordHasNoEffect(v) else: // line 1969 - goto _loop46_breakloop - :_loop46_breakloop + goto _loop48_breakloop + :_loop48_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -791,7 +834,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_7_) else: raise @@ -854,7 +897,6 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) or (_givenValue ==AT) - or (_givenValue ==SCRIPT_ATTRIBUTE_MARKER) or (_givenValue ==NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) @@ -880,17 +922,17 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling if ((LA(1)==EOS) and (tokenSet_25_.member(cast(int, LA(2))))): - _cnt43 as int = 0 + _cnt45 as int = 0 while true: if ((LA(1)==EOS) and (tokenSet_25_.member(cast(int, LA(2))))): match(EOS) else: - if (_cnt43 >= 1): - goto _loop43_breakloop + if (_cnt45 >= 1): + goto _loop45_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt43 - :_loop43_breakloop + ++_cnt45 + :_loop45_breakloop elif ((tokenSet_25_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: SemicolonExpected() @@ -903,23 +945,6 @@ class UnityScriptParser(antlr.LLkParser): else: raise - public def script_attribute( - m as Module - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - match(SCRIPT_ATTRIBUTE_MARKER) - attr=attribute_constructor() - if 0 == inputState.guessing: - m.Attributes.Add(attr); - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_12_) - else: - raise - public def class_declaration( parent as TypeDefinition ) as TypeMember : //throws RecognitionException, TokenStreamException @@ -1024,8 +1049,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: m.Modifiers |= mod if m is not null else: - goto _loop58_breakloop - :_loop58_breakloop + goto _loop60_breakloop + :_loop60_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: @@ -1034,8 +1059,8 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS)): match(EOS) else: - goto _loop60_breakloop - :_loop60_breakloop + goto _loop62_breakloop + :_loop62_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1081,8 +1106,8 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) interface_member(td) else: - goto _loop65_breakloop - :_loop65_breakloop + goto _loop67_breakloop + :_loop67_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: @@ -1091,8 +1116,8 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS)): match(EOS) else: - goto _loop67_breakloop - :_loop67_breakloop + goto _loop69_breakloop + :_loop69_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1128,8 +1153,8 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) enum_member(ed) else: - goto _loop76_breakloop - :_loop76_breakloop + goto _loop78_breakloop + :_loop78_breakloop _givenValue = LA(1) if ((_givenValue == COMMA)): // 1831 match(COMMA) @@ -1149,8 +1174,8 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS)): match(EOS) else: - goto _loop79_breakloop - :_loop79_breakloop + goto _loop81_breakloop + :_loop81_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1178,7 +1203,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_7_) else: raise return member @@ -1278,7 +1303,6 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) or (_givenValue ==AT) - or (_givenValue ==SCRIPT_ATTRIBUTE_MARKER) or (_givenValue ==NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) @@ -1337,7 +1361,6 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) or (_givenValue ==AT) - or (_givenValue ==SCRIPT_ATTRIBUTE_MARKER) or (_givenValue ==NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) @@ -1399,10 +1422,10 @@ class UnityScriptParser(antlr.LLkParser): f = LT(1) match(FOR) match(LPAREN) - synPredMatched127 as bool = false + synPredMatched129 as bool = false if ((LA(1)==VAR or LA(1)==ID) and (LA(2)==IN or LA(2)==ID)): - _m127 as int = mark() - synPredMatched127 = true + _m129 as int = mark() + synPredMatched129 = true ++inputState.guessing try: _givenValue = LA(1) @@ -1414,10 +1437,10 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) match(IN) except x as RecognitionException: - synPredMatched127 = false - rewind(_m127) + synPredMatched129 = false + rewind(_m129) --inputState.guessing - if synPredMatched127: + if synPredMatched129: stmt=for_in(container) elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_33_.member(cast(int, LA(2))))): // line 2102 stmt=for_c(container) @@ -1507,8 +1530,8 @@ class UnityScriptParser(antlr.LLkParser): tr = null compound_or_single_stmt(b) else: - goto _loop153_breakloop - :_loop153_breakloop + goto _loop155_breakloop + :_loop155_breakloop if ((LA(1)==FINALLY) and (tokenSet_34_.member(cast(int, LA(2))))): finally_block(s) elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 @@ -1561,22 +1584,22 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: item.Arguments.Add(e); else: - goto _loop141_breakloop - :_loop141_breakloop - _cnt143 as int = 0 + goto _loop143_breakloop + :_loop143_breakloop + _cnt145 as int = 0 while true: if ((tokenSet_34_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt143 >= 1): - goto _loop143_breakloop + if (_cnt145 >= 1): + goto _loop145_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt143 - :_loop143_breakloop + ++_cnt145 + :_loop145_breakloop else: - goto _loop144_breakloop - :_loop144_breakloop + goto _loop146_breakloop + :_loop146_breakloop _givenValue = LA(1) if ((_givenValue == DEFAULT)): // 1831 d = LT(1) @@ -1586,17 +1609,17 @@ class UnityScriptParser(antlr.LLkParser): item = MacroStatement(ToLexicalInfo(d), Name: d.getText()) itemBlock = item.Body switchBlock.Add(item) - _cnt147 as int = 0 + _cnt149 as int = 0 while true: if ((tokenSet_34_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt147 >= 1): - goto _loop147_breakloop + if (_cnt149 >= 1): + goto _loop149_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt147 - :_loop147_breakloop + ++_cnt149 + :_loop149_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 @@ -1606,8 +1629,8 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS) and (tokenSet_24_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop149_breakloop - :_loop149_breakloop + goto _loop151_breakloop + :_loop151_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1791,8 +1814,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: VirtualKeywordHasNoEffect(v) else: // line 1969 - goto _loop49_breakloop - :_loop49_breakloop + goto _loop51_breakloop + :_loop51_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1846,8 +1869,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: typeReferences.Add(tr) else: - goto _loop177_breakloop - :_loop177_breakloop + goto _loop179_breakloop + :_loop179_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1961,8 +1984,8 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS)): match(EOS) else: - goto _loop72_breakloop - :_loop72_breakloop + goto _loop74_breakloop + :_loop74_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1982,8 +2005,8 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) parameter_declaration(m) else: - goto _loop94_breakloop - :_loop94_breakloop + goto _loop96_breakloop + :_loop96_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -2096,8 +2119,8 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS) and (tokenSet_44_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop101_breakloop - :_loop101_breakloop + goto _loop103_breakloop + :_loop103_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -2259,17 +2282,17 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) eos() elif ((_givenValue == EOS)): // 1831 - _cnt111 as int = 0 + _cnt113 as int = 0 while true: if ((LA(1)==EOS) and (tokenSet_24_.member(cast(int, LA(2))))): match(EOS) else: - if (_cnt111 >= 1): - goto _loop111_breakloop + if (_cnt113 >= 1): + goto _loop113_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt111 - :_loop111_breakloop + ++_cnt113 + :_loop113_breakloop else: // line 1969 raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: @@ -2291,8 +2314,8 @@ class UnityScriptParser(antlr.LLkParser): if ((tokenSet_34_.member(cast(int, LA(1))))): statement(b) else: - goto _loop104_breakloop - :_loop104_breakloop + goto _loop106_breakloop + :_loop106_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: @@ -2367,7 +2390,6 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) or (_givenValue ==AT) - or (_givenValue ==SCRIPT_ATTRIBUTE_MARKER) or (_givenValue ==NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) @@ -2525,7 +2547,6 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) or (_givenValue ==AT) - or (_givenValue ==SCRIPT_ATTRIBUTE_MARKER) or (_givenValue ==NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) @@ -2890,8 +2911,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) else: - goto _loop169_breakloop - :_loop169_breakloop + goto _loop171_breakloop + :_loop171_breakloop elif ((_givenValue == RPAREN)): // 1831 pass // 947 else: // line 1969 @@ -2955,8 +2976,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop244_breakloop - :_loop244_breakloop + goto _loop246_breakloop + :_loop246_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -2985,18 +3006,18 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched181 as bool = false + synPredMatched183 as bool = false if ((LA(1)==NEW) and (LA(2)==ID)): - _m181 as int = mark() - synPredMatched181 = true + _m183 as int = mark() + synPredMatched183 = true ++inputState.guessing try: new_array_expression() except x as RecognitionException: - synPredMatched181 = false - rewind(_m181) + synPredMatched183 = false + rewind(_m183) --inputState.guessing - if synPredMatched181: + if synPredMatched183: e=new_array_expression() elif ((LA(1)==NEW) and (LA(2)==ID)): // line 2102 match(NEW) @@ -3058,8 +3079,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ec.Add(e); else: - goto _loop210_breakloop - :_loop210_breakloop + goto _loop212_breakloop + :_loop212_breakloop elif ((_givenValue == RPAREN) or (_givenValue ==RBRACK) ): // 1827 @@ -3498,8 +3519,8 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) slice(se) else: - goto _loop226_breakloop - :_loop226_breakloop + goto _loop228_breakloop + :_loop228_breakloop match(RBRACK) elif ((LA(1)==DOT) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 match(DOT) @@ -3515,8 +3536,8 @@ class UnityScriptParser(antlr.LLkParser): expression_list(args) match(RPAREN) else: - goto _loop229_breakloop - :_loop229_breakloop + goto _loop231_breakloop + :_loop231_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3707,8 +3728,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop240_breakloop - :_loop240_breakloop + goto _loop242_breakloop + :_loop242_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3744,8 +3765,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop248_breakloop - :_loop248_breakloop + goto _loop250_breakloop + :_loop250_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3824,8 +3845,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop260_breakloop - :_loop260_breakloop + goto _loop262_breakloop + :_loop262_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3873,8 +3894,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), op, e, r) else: - goto _loop268_breakloop - :_loop268_breakloop + goto _loop270_breakloop + :_loop270_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3900,8 +3921,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop271_breakloop - :_loop271_breakloop + goto _loop273_breakloop + :_loop273_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3927,8 +3948,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop274_breakloop - :_loop274_breakloop + goto _loop276_breakloop + :_loop276_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3954,8 +3975,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop277_breakloop - :_loop277_breakloop + goto _loop279_breakloop + :_loop279_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3982,8 +4003,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop280_breakloop - :_loop280_breakloop + goto _loop282_breakloop + :_loop282_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4010,8 +4031,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop283_breakloop - :_loop283_breakloop + goto _loop285_breakloop + :_loop285_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4059,19 +4080,19 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling lbrack = LT(1) match(LBRACK) - synPredMatched291 as bool = false + synPredMatched293 as bool = false if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_57_.member(cast(int, LA(2))))): - _m291 as int = mark() - synPredMatched291 = true + _m293 as int = mark() + synPredMatched293 = true ++inputState.guessing try: expression() match(FOR) except x as RecognitionException: - synPredMatched291 = false - rewind(_m291) + synPredMatched293 = false + rewind(_m293) --inputState.guessing - if synPredMatched291: + if synPredMatched293: projection=expression() match(FOR) match(LPAREN) @@ -4158,8 +4179,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dle.Items.Add(pair); else: - goto _loop299_breakloop - :_loop299_breakloop + goto _loop301_breakloop + :_loop301_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 @@ -4409,6 +4430,7 @@ class UnityScriptParser(antlr.LLkParser): '>>=', '@', '@script', + '@assembly', 'HASH', 'INPLACE_BITWISE_XOR', 'NOT', @@ -4434,7 +4456,7 @@ class UnityScriptParser(antlr.LLkParser): ) private static def mk_tokenSet_0_() as (long): - data = (26480360966400L, 2147483648L, 0L, 0L, ) + data = (26480360966400L, 0L, ) return data public static final tokenSet_0_ = BitSet(mk_tokenSet_0_()) private static def mk_tokenSet_1_() as (long): @@ -4442,11 +4464,11 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) private static def mk_tokenSet_2_() as (long): - data = (-8808777125549366752L, 2147484183552L, 0L, 0L, ) + data = (-8808777125549366752L, 4294967831552L, 0L, 0L, ) return data public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) private static def mk_tokenSet_3_() as (long): - data = (-7494834249975239822L, 2194728288255L, 0L, 0L, ) + data = (-7494834249975239822L, 4383014125567L, 0L, 0L, ) return data public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) private static def mk_tokenSet_4_() as (long): @@ -4454,43 +4476,43 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) private static def mk_tokenSet_5_() as (long): - data = (-8808759441280505054L, 2155000376320L, 0L, 0L, ) + data = (-8808759441280505054L, 4304631507968L, 0L, 0L, ) return data public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) private static def mk_tokenSet_6_() as (long): - data = (-7494834241385305230L, 2194728288255L, 0L, 0L, ) + data = (-7494834241385305230L, 4383014125567L, 0L, 0L, ) return data public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) private static def mk_tokenSet_7_() as (long): - data = (18040881051486464L, 2147483648L, 0L, 0L, ) + data = (-8808759441281553630L, 4296041573376L, 0L, 0L, ) return data public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) private static def mk_tokenSet_8_() as (long): - data = (26476057477120L, 0L, ) + data = (18040881051486464L, 0L, ) return data public static final tokenSet_8_ = BitSet(mk_tokenSet_8_()) private static def mk_tokenSet_9_() as (long): - data = (18040874566959104L, 0L, ) + data = (26476057477120L, 0L, ) return data public static final tokenSet_9_ = BitSet(mk_tokenSet_9_()) private static def mk_tokenSet_10_() as (long): - data = (17684267944192L, 0L, ) + data = (18040874566959104L, 0L, ) return data public static final tokenSet_10_ = BitSet(mk_tokenSet_10_()) private static def mk_tokenSet_11_() as (long): - data = (18032082777426176L, 0L, ) + data = (17684267944192L, 0L, ) return data public static final tokenSet_11_ = BitSet(mk_tokenSet_11_()) private static def mk_tokenSet_12_() as (long): - data = (-8808759441281553630L, 2150705409024L, 0L, 0L, ) + data = (18032082777426176L, 0L, ) return data public static final tokenSet_12_ = BitSet(mk_tokenSet_12_()) private static def mk_tokenSet_13_() as (long): - data = (-8809034961160888320L, 2147484183552L, 0L, 0L, ) + data = (-8809034961160888320L, 4294967831552L, 0L, 0L, ) return data public static final tokenSet_13_ = BitSet(mk_tokenSet_13_()) private static def mk_tokenSet_14_() as (long): - data = (-2323851497726402480L, 2182346702043L, 0L, 0L, ) + data = (-2323851497726402480L, 4364190088411L, 0L, 0L, ) return data public static final tokenSet_14_ = BitSet(mk_tokenSet_14_()) private static def mk_tokenSet_15_() as (long): @@ -4502,27 +4524,27 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_16_ = BitSet(mk_tokenSet_16_()) private static def mk_tokenSet_17_() as (long): - data = (-42953084942L, 2194728288255L, 0L, 0L, ) + data = (-42953084942L, 4383014125567L, 0L, 0L, ) return data public static final tokenSet_17_ = BitSet(mk_tokenSet_17_()) private static def mk_tokenSet_18_() as (long): - data = (18040881051486464L, 3221225472L, 0L, 0L, ) + data = (18040881051486464L, 1073741824L, 0L, 0L, ) return data public static final tokenSet_18_ = BitSet(mk_tokenSet_18_()) private static def mk_tokenSet_19_() as (long): - data = (-8232574208857464832L, 2147484183552L, 0L, 0L, ) + data = (-8232574208857464832L, 4294967831552L, 0L, 0L, ) return data public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) private static def mk_tokenSet_20_() as (long): - data = (-8808759439134069982L, 2150705409024L, 0L, 0L, ) + data = (-8808759439134069982L, 4296041573376L, 0L, 0L, ) return data public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) private static def mk_tokenSet_21_() as (long): - data = (-844433523250318L, 2194728288255L, 0L, 0L, ) + data = (-844433523250318L, 4383014125567L, 0L, 0L, ) return data public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) private static def mk_tokenSet_22_() as (long): - data = (-42949939214L, 2199023255551L, 0L, 0L, ) + data = (-42949939214L, 4391604060159L, 0L, 0L, ) return data public static final tokenSet_22_ = BitSet(mk_tokenSet_22_()) private static def mk_tokenSet_23_() as (long): @@ -4530,15 +4552,15 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_23_ = BitSet(mk_tokenSet_23_()) private static def mk_tokenSet_24_() as (long): - data = (-8663799828275531870L, 2150705409280L, 0L, 0L, ) + data = (-8663799828275531870L, 4296041573632L, 0L, 0L, ) return data public static final tokenSet_24_ = BitSet(mk_tokenSet_24_()) private static def mk_tokenSet_25_() as (long): - data = (-8663799826126999646L, 2155000376576L, 0L, 0L, ) + data = (-8663799826126999646L, 4304631508224L, 0L, 0L, ) return data public static final tokenSet_25_ = BitSet(mk_tokenSet_25_()) private static def mk_tokenSet_26_() as (long): - data = (-3149838L, 2194728288255L, 0L, 0L, ) + data = (-3149838L, 4383014125567L, 0L, 0L, ) return data public static final tokenSet_26_ = BitSet(mk_tokenSet_26_()) private static def mk_tokenSet_27_() as (long): @@ -4558,31 +4580,31 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) private static def mk_tokenSet_31_() as (long): - data = (-8664644251058214110L, 2150705409024L, 0L, 0L, ) + data = (-8664644251058214110L, 4296041573376L, 0L, 0L, ) return data public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) private static def mk_tokenSet_32_() as (long): - data = (-8809026165067866112L, 2147484183808L, 0L, 0L, ) + data = (-8809026165067866112L, 4294967831808L, 0L, 0L, ) return data public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) private static def mk_tokenSet_33_() as (long): - data = (-7495109769854574512L, 2191507062783L, 0L, 0L, ) + data = (-7495109769854574512L, 4381940383743L, 0L, 0L, ) return data public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) private static def mk_tokenSet_34_() as (long): - data = (-8808777125549366752L, 2147484183808L, 0L, 0L, ) + data = (-8808777125549366752L, 4294967831808L, 0L, 0L, ) return data public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) private static def mk_tokenSet_35_() as (long): - data = (-7510878323647713294L, 2185567927771L, 0L, 0L, ) + data = (-7510878323647713294L, 4365263830491L, 0L, 0L, ) return data public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) private static def mk_tokenSet_36_() as (long): - data = (-42950987790L, 2194728288255L, 0L, 0L, ) + data = (-42950987790L, 4383014125567L, 0L, 0L, ) return data public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) private static def mk_tokenSet_37_() as (long): - data = (-8590987278L, 2194728288255L, 0L, 0L, ) + data = (-8590987278L, 4383014125567L, 0L, 0L, ) return data public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) private static def mk_tokenSet_38_() as (long): @@ -4606,31 +4628,31 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) private static def mk_tokenSet_43_() as (long): - data = (-6358801241844520158L, 2150705409792L, 0L, 0L, ) + data = (-6358801241844520158L, 4296041574144L, 0L, 0L, ) return data public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) private static def mk_tokenSet_44_() as (long): - data = (-8663799826128048222L, 2150705409280L, 0L, 0L, ) + data = (-8663799826128048222L, 4296041573632L, 0L, 0L, ) return data public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) private static def mk_tokenSet_45_() as (long): - data = (-8664661937473510880L, 2147484183808L, 0L, 0L, ) + data = (-8664661937473510880L, 4294967831808L, 0L, 0L, ) return data public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) private static def mk_tokenSet_46_() as (long): - data = (-7493989825045073934L, 2194728288255L, 0L, 0L, ) + data = (-7493989825045073934L, 4383014125567L, 0L, 0L, ) return data public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) private static def mk_tokenSet_47_() as (long): - data = (-8663799828271337566L, 2150705409792L, 0L, 0L, ) + data = (-8663799828271337566L, 4296041574144L, 0L, 0L, ) return data public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) private static def mk_tokenSet_48_() as (long): - data = (-8087339075972108382L, 2150705409280L, 0L, 0L, ) + data = (-8087339075972108382L, 4296041573632L, 0L, 0L, ) return data public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) private static def mk_tokenSet_49_() as (long): - data = (-8593084430L, 2194728288255L, 0L, 0L, ) + data = (-8593084430L, 4383014125567L, 0L, 0L, ) return data public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) private static def mk_tokenSet_50_() as (long): @@ -4646,7 +4668,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) private static def mk_tokenSet_53_() as (long): - data = (-6503191951947194368L, 2147484183552L, 0L, 0L, ) + data = (-6503191951947194368L, 4294967831552L, 0L, 0L, ) return data public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) private static def mk_tokenSet_54_() as (long): @@ -4662,11 +4684,11 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) private static def mk_tokenSet_57_() as (long): - data = (-7511998268457148336L, 2182346702043L, 0L, 0L, ) + data = (-7511998268457148336L, 4364190088411L, 0L, 0L, ) return data public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) private static def mk_tokenSet_58_() as (long): - data = (-8809034961160888320L, 2147484183553L, 0L, 0L, ) + data = (-8809034961160888320L, 4294967831553L, 0L, 0L, ) return data public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.boo b/src/UnityScript/Parser/UnityScriptTokenTypes.boo index 7bb2fb8..f48eadb 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.boo +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.boo @@ -96,26 +96,27 @@ class UnityScriptTokenTypes: public static final INPLACE_SHIFT_RIGHT = 93 public static final AT = 94 public static final SCRIPT_ATTRIBUTE_MARKER = 95 - public static final HASH = 96 - public static final INPLACE_BITWISE_XOR = 97 - public static final NOT = 98 - public static final DIVISION = 99 - public static final RE_LITERAL = 100 - public static final DOUBLE = 101 - public static final INT = 102 - public static final LONG = 103 - public static final SINGLE_QUOTED_STRING = 104 - public static final DOUBLE_SUFFIX = 105 - public static final EXPONENT = 106 - public static final WHITE_SPACE = 107 - public static final DQS_ESC = 108 - public static final SQS_ESC = 109 - public static final SESC = 110 - public static final ML_COMMENT = 111 - public static final RE_CHAR = 112 - public static final RE_ESC = 113 - public static final NEWLINE = 114 - public static final ID_LETTER = 115 - public static final DIGIT = 116 - public static final HEXDIGIT = 117 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 96 + public static final HASH = 97 + public static final INPLACE_BITWISE_XOR = 98 + public static final NOT = 99 + public static final DIVISION = 100 + public static final RE_LITERAL = 101 + public static final DOUBLE = 102 + public static final INT = 103 + public static final LONG = 104 + public static final SINGLE_QUOTED_STRING = 105 + public static final DOUBLE_SUFFIX = 106 + public static final EXPONENT = 107 + public static final WHITE_SPACE = 108 + public static final DQS_ESC = 109 + public static final SQS_ESC = 110 + public static final SESC = 111 + public static final ML_COMMENT = 112 + public static final RE_CHAR = 113 + public static final RE_ESC = 114 + public static final NEWLINE = 115 + public static final ID_LETTER = 116 + public static final DIGIT = 117 + public static final HEXDIGIT = 118 diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.txt b/src/UnityScript/Parser/UnityScriptTokenTypes.txt index 9851722..afcba27 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.txt +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.txt @@ -92,25 +92,26 @@ SHIFT_RIGHT=">>"=92 INPLACE_SHIFT_RIGHT=">>="=93 AT="@"=94 SCRIPT_ATTRIBUTE_MARKER="@script"=95 -HASH=96 -INPLACE_BITWISE_XOR=97 -NOT=98 -DIVISION=99 -RE_LITERAL=100 -DOUBLE=101 -INT=102 -LONG=103 -SINGLE_QUOTED_STRING=104 -DOUBLE_SUFFIX=105 -EXPONENT=106 -WHITE_SPACE=107 -DQS_ESC=108 -SQS_ESC=109 -SESC=110 -ML_COMMENT=111 -RE_CHAR=112 -RE_ESC=113 -NEWLINE=114 -ID_LETTER=115 -DIGIT=116 -HEXDIGIT=117 +ASSEMBLY_ATTRIBUTE_MARKER="@assembly"=96 +HASH=97 +INPLACE_BITWISE_XOR=98 +NOT=99 +DIVISION=100 +RE_LITERAL=101 +DOUBLE=102 +INT=103 +LONG=104 +SINGLE_QUOTED_STRING=105 +DOUBLE_SUFFIX=106 +EXPONENT=107 +WHITE_SPACE=108 +DQS_ESC=109 +SQS_ESC=110 +SESC=111 +ML_COMMENT=112 +RE_CHAR=113 +RE_ESC=114 +NEWLINE=115 +ID_LETTER=116 +DIGIT=117 +HEXDIGIT=118 From ca22d500468c4b992204e4ccb1242ec38e690955 Mon Sep 17 00:00:00 2001 From: Levi Bard Date: Fri, 26 Nov 2010 13:27:53 +0100 Subject: [PATCH 109/276] Allow nunit reference from relative path. --- default.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.build b/default.build index 34d4a8a..0494406 100755 --- a/default.build +++ b/default.build @@ -91,7 +91,7 @@ - + From 02d4fd3ffb3dda99c8d399acb6d7442418f15c24 Mon Sep 17 00:00:00 2001 From: Massimiliano Mantione Date: Tue, 7 Dec 2010 16:33:37 +0100 Subject: [PATCH 110/276] If present, Use the MONO_EXECUTABLE env var to pick the right mono runtime for launching us.exe inside tests. --- src/UnityScript.Tests/UsTestFixture.boo | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/UnityScript.Tests/UsTestFixture.boo b/src/UnityScript.Tests/UsTestFixture.boo index fe54357..5d8116c 100755 --- a/src/UnityScript.Tests/UsTestFixture.boo +++ b/src/UnityScript.Tests/UsTestFixture.boo @@ -89,8 +89,11 @@ class UsTestFixture: assert output.Trim().StartsWith("Successfully compiled") def ExecuteUs(argv as (string)): - if PlatformInformation.IsMono: - p = shellp("mono", UsExePath + " ${join(argv)}") + if PlatformInformation.IsMono: + monoexe = System.Environment.GetEnvironmentVariable ("MONO_EXECUTABLE") + if (monoexe == null): + monoexe = "mono" + p = shellp(monoexe, UsExePath + " ${join(argv)}") else: p = shellp(UsExePath, join(argv)) From 9346ee4a96855112cd5367d5cf01a6c115d09c08 Mon Sep 17 00:00:00 2001 From: Massimiliano Mantione Date: Tue, 7 Dec 2010 16:51:42 +0100 Subject: [PATCH 111/276] Made the fix more "booish" :-) --- src/UnityScript.Tests/UsTestFixture.boo | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/UnityScript.Tests/UsTestFixture.boo b/src/UnityScript.Tests/UsTestFixture.boo index 5d8116c..936c242 100755 --- a/src/UnityScript.Tests/UsTestFixture.boo +++ b/src/UnityScript.Tests/UsTestFixture.boo @@ -90,9 +90,7 @@ class UsTestFixture: def ExecuteUs(argv as (string)): if PlatformInformation.IsMono: - monoexe = System.Environment.GetEnvironmentVariable ("MONO_EXECUTABLE") - if (monoexe == null): - monoexe = "mono" + monoexe = System.Environment.GetEnvironmentVariable ("MONO_EXECUTABLE") or "mono" p = shellp(monoexe, UsExePath + " ${join(argv)}") else: p = shellp(UsExePath, join(argv)) From 764ce957485498d957a6cd644490f90bbc8f9211 Mon Sep 17 00:00:00 2001 From: Massimiliano Mantione Date: Tue, 7 Dec 2010 17:39:27 +0100 Subject: [PATCH 112/276] Made the fix even more "booish"... --- src/UnityScript.Tests/UsTestFixture.boo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UnityScript.Tests/UsTestFixture.boo b/src/UnityScript.Tests/UsTestFixture.boo index 936c242..18a98e0 100755 --- a/src/UnityScript.Tests/UsTestFixture.boo +++ b/src/UnityScript.Tests/UsTestFixture.boo @@ -90,7 +90,7 @@ class UsTestFixture: def ExecuteUs(argv as (string)): if PlatformInformation.IsMono: - monoexe = System.Environment.GetEnvironmentVariable ("MONO_EXECUTABLE") or "mono" + monoexe = System.Environment.GetEnvironmentVariable("MONO_EXECUTABLE") or "mono" p = shellp(monoexe, UsExePath + " ${join(argv)}") else: p = shellp(UsExePath, join(argv)) From 9c8695bcbf773dae87bf54f2753667314f1c1a0e Mon Sep 17 00:00:00 2001 From: Levi Bard Date: Fri, 26 Nov 2010 20:27:53 +0800 Subject: [PATCH 113/276] Allow nunit reference from relative path. --- default.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.build b/default.build index 34d4a8a..0494406 100755 --- a/default.build +++ b/default.build @@ -91,7 +91,7 @@ - + From 1a63fac34d00975dce3588af0f7536efc259ff18 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 21 Dec 2010 11:46:45 -0200 Subject: [PATCH 114/276] unused imports --- src/UnityScript/Macros/DeferredMacro.boo | 2 -- 1 file changed, 2 deletions(-) mode change 100644 => 100755 src/UnityScript/Macros/DeferredMacro.boo diff --git a/src/UnityScript/Macros/DeferredMacro.boo b/src/UnityScript/Macros/DeferredMacro.boo old mode 100644 new mode 100755 index 7aeed5d..e19f544 --- a/src/UnityScript/Macros/DeferredMacro.boo +++ b/src/UnityScript/Macros/DeferredMacro.boo @@ -1,8 +1,6 @@ namespace UnityScript.Macros -import Boo.Lang.Compiler import Boo.Lang.Compiler.Ast -import Boo.Lang.PatternMatching macro deferred: case [| deferred $(ReferenceExpression(Name: name)) = $initializer |]: From 8e5c440d8ff5e6b355086db89bae88eb79e8a811 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 29 Dec 2010 11:53:36 -0200 Subject: [PATCH 115/276] use newly introduce MONO_ENV_OPTIONS to force debugging symbols to be loaded during test execution --- default.build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/default.build b/default.build index 34d4a8a..11ed74a 100755 --- a/default.build +++ b/default.build @@ -22,6 +22,9 @@ + + + From fbaa30885cd70f51eba73bdc0b7f1a812b5679f7 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 4 Jan 2011 11:15:07 -0200 Subject: [PATCH 116/276] initial support for true multidimensionsal arrays --- .../DuckyIntegrationTestFixture.boo | 4 + .../ParserTestFixture.Generated.boo | 4 + .../StrictIntegrationTestFixture.boo | 4 + src/UnityScript/Parser/CodeFactory.boo | 9 +- src/UnityScript/Parser/UnityScriptLexer.boo | 102 +++++++-------- src/UnityScript/Parser/UnityScriptParser.boo | 123 +++++++++++------- src/UnityScript/UnityScript.g | 15 ++- .../integration/array-with-two-dimensions.js | 9 ++ tests/parser/array-types.js | 10 ++ 9 files changed, 173 insertions(+), 107 deletions(-) create mode 100644 tests/integration/array-with-two-dimensions.js create mode 100644 tests/parser/array-types.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 04d22f8..a4611f6 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -179,6 +179,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-with-initial-length.js") + [Test] def array_with_two_dimensions(): + RunTestCase("tests/integration/array-with-two-dimensions.js") + + [Test] def arrays_2(): RunTestCase("tests/integration/arrays-2.js") diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index c81a4a0..0d808d4 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -10,6 +10,10 @@ partial class ParserTestFixture: RunTestCase("tests/parser/OperationInsideAParam.js") + [Test] def array_types(): + RunTestCase("tests/parser/array-types.js") + + [Test] def attributes_1(): RunTestCase("tests/parser/attributes-1.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index c06401e..f0dfc0d 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -181,6 +181,10 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-with-initial-length.js") + [Test] def array_with_two_dimensions(): + RunTestCase("tests/integration/array-with-two-dimensions.js") + + [Test] def arrays_2(): RunTestCase("tests/integration/arrays-2.js") diff --git a/src/UnityScript/Parser/CodeFactory.boo b/src/UnityScript/Parser/CodeFactory.boo index 29e86f1..ad15300 100755 --- a/src/UnityScript/Parser/CodeFactory.boo +++ b/src/UnityScript/Parser/CodeFactory.boo @@ -12,8 +12,13 @@ static class CodeFactory: ge.Filter = StatementModifier(filter.LexicalInfo, Type: StatementModifierType.If, Condition: filter) return [| Boo.Lang.Builtins.array($ge) |].WithLocation(location) - def NewArrayInitializer(location as LexicalInfo, elementType as TypeReference, count as Expression): - return [| Boo.Lang.Builtins.array[of $elementType](cast(int, $count)) |].WithLocation(location) + def NewArrayInitializer(location as LexicalInfo, elementType as TypeReference, dimensions as List of Expression): + if len(dimensions) == 1: + size = dimensions[0] + return [| Boo.Lang.Builtins.array[of $elementType](cast(int, $size)) |].WithLocation(location) + initializer = [| Boo.Lang.Builtins.matrix[of $elementType]() |].WithLocation(location) + initializer.Arguments.Extend(dimensions) + return initializer def NewDoubleLiteralExpression(location as LexicalInfo, literal as string): if literal.EndsWith('d') or literal.EndsWith('D'): diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index b1d0529..a688bcf 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -586,8 +586,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mDIGIT(false) else: // line 1969 - goto _loop314_breakloop - :_loop314_breakloop + goto _loop318_breakloop + :_loop318_breakloop _ttype = testLiteralsTable(_ttype) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -680,17 +680,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): match("0x") - _cnt318 as int = 0 + _cnt322 as int = 0 while true: if ((tokenSet_0_.member(cast(int, cached_LA1)))): mHEXDIGIT(false) else: - if (_cnt318 >= 1): - goto _loop318_breakloop + if (_cnt322 >= 1): + goto _loop322_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt318 - :_loop318_breakloop + ++_cnt322 + :_loop322_breakloop if ((cached_LA1==char('L') or cached_LA1==char('l'))): _givenValue = cached_LA1 if ((_givenValue == char('l'))): // 1831 @@ -704,17 +704,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): else: // line 2053 pass // 947 elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt322 as int = 0 + _cnt326 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt322 >= 1): - goto _loop322_breakloop + if (_cnt326 >= 1): + goto _loop326_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt322 - :_loop322_breakloop + ++_cnt326 + :_loop326_breakloop _givenValue = cached_LA1 if ((_givenValue == char('L')) or (_givenValue ==char('l')) @@ -810,17 +810,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_SUFFIX - _cnt331 as int = 0 + _cnt335 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt331 >= 1): - goto _loop331_breakloop + if (_cnt335 >= 1): + goto _loop335_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt331 - :_loop331_breakloop + ++_cnt335 + :_loop335_breakloop if ((cached_LA1==char('E') or cached_LA1==char('e'))): mEXPONENT(false) else: // line 2053 @@ -871,17 +871,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt338 as int = 0 + _cnt342 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt338 >= 1): - goto _loop338_breakloop + if (_cnt342 >= 1): + goto _loop342_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt338 - :_loop338_breakloop + ++_cnt342 + :_loop342_breakloop if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1347,18 +1347,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched385 as bool = false + synPredMatched389 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m385 as int = mark() - synPredMatched385 = true + _m389 as int = mark() + synPredMatched389 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched385 = false - rewind(_m385) + synPredMatched389 = false + rewind(_m389) --inputState.guessing - if synPredMatched385: + if synPredMatched389: mML_COMMENT(false) if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1371,8 +1371,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop390_breakloop - :_loop390_breakloop + goto _loop394_breakloop + :_loop394_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; elif ((_givenValue == char('='))): // 1831 @@ -1401,8 +1401,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop419_breakloop - :_loop419_breakloop + goto _loop423_breakloop + :_loop423_breakloop match("*/") if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1415,7 +1415,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt394 as int = 0 + _cnt398 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1429,12 +1429,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt394 >= 1): - goto _loop394_breakloop + if (_cnt398 >= 1): + goto _loop398_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt394 - :_loop394_breakloop + ++_cnt398 + :_loop398_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1477,8 +1477,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop398_breakloop - :_loop398_breakloop + goto _loop402_breakloop + :_loop402_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1527,8 +1527,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_4_) else: - goto _loop402_breakloop - :_loop402_breakloop + goto _loop406_breakloop + :_loop406_breakloop _saveIndex = text.Length match('\'') text.Length = _saveIndex @@ -1629,17 +1629,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt422 as int = 0 + _cnt426 as int = 0 while true: if ((tokenSet_5_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt422 >= 1): - goto _loop422_breakloop + if (_cnt426 >= 1): + goto _loop426_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt422 - :_loop422_breakloop + ++_cnt426 + :_loop426_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1697,17 +1697,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt428 as int = 0 + _cnt432 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt428 >= 1): - goto _loop428_breakloop + if (_cnt432 >= 1): + goto _loop432_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt428 - :_loop428_breakloop + ++_cnt432 + :_loop432_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 2f67dc4..ae862bb 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -639,8 +639,8 @@ class UnityScriptParser(antlr.LLkParser): match(DOT) e=member_reference_expression(e) else: - goto _loop194_breakloop - :_loop194_breakloop + goto _loop198_breakloop + :_loop198_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1827,6 +1827,8 @@ class UnityScriptParser(antlr.LLkParser): public def type_reference() as TypeReference : //throws RecognitionException, TokenStreamException tr as TypeReference + lbrack as IToken = null + rank = 1 try: // for error handling _givenValue = LA(1) @@ -1836,11 +1838,20 @@ class UnityScriptParser(antlr.LLkParser): tr=anonymous_function_type() else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((LA(1)==LBRACK) and (LA(2)==RBRACK)): + if ((LA(1)==LBRACK) and (LA(2)==COMMA or LA(2)==RBRACK)): + lbrack = LT(1) match(LBRACK) + while true: + if ((LA(1)==COMMA)): + match(COMMA) + if 0 == inputState.guessing: + ++rank + else: + goto _loop167_breakloop + :_loop167_breakloop match(RBRACK) if 0 == inputState.guessing: - tr = ArrayTypeReference(tr.LexicalInfo, tr); + tr = ArrayTypeReference(tr.LexicalInfo, tr, IntegerLiteralExpression(ToLexicalInfo(lbrack), rank)) elif ((tokenSet_36_.member(cast(int, LA(1)))) and (tokenSet_37_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: @@ -1869,8 +1880,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: typeReferences.Add(tr) else: - goto _loop179_breakloop - :_loop179_breakloop + goto _loop183_breakloop + :_loop183_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -2911,8 +2922,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) else: - goto _loop171_breakloop - :_loop171_breakloop + goto _loop173_breakloop + :_loop173_breakloop elif ((_givenValue == RPAREN)): // 1831 pass // 947 else: // line 1969 @@ -2928,14 +2939,26 @@ class UnityScriptParser(antlr.LLkParser): public def array_initializer() as Expression : //throws RecognitionException, TokenStreamException e as Expression + dimensions = List of Expression(1) try: // for error handling tr=simple_type_reference() match(LBRACK) - count=sum() + size=sum() + if 0 == inputState.guessing: + dimensions.Add(size) + while true: + if ((LA(1)==COMMA)): + match(COMMA) + size=sum() + if 0 == inputState.guessing: + dimensions.Add(size) + else: + goto _loop176_breakloop + :_loop176_breakloop match(RBRACK) if 0 == inputState.guessing: - e = CodeFactory.NewArrayInitializer(tr.LexicalInfo, tr, count) + e = CodeFactory.NewArrayInitializer(tr.LexicalInfo, tr, dimensions) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -2976,8 +2999,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop246_breakloop - :_loop246_breakloop + goto _loop250_breakloop + :_loop250_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3006,18 +3029,18 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched183 as bool = false + synPredMatched187 as bool = false if ((LA(1)==NEW) and (LA(2)==ID)): - _m183 as int = mark() - synPredMatched183 = true + _m187 as int = mark() + synPredMatched187 = true ++inputState.guessing try: new_array_expression() except x as RecognitionException: - synPredMatched183 = false - rewind(_m183) + synPredMatched187 = false + rewind(_m187) --inputState.guessing - if synPredMatched183: + if synPredMatched187: e=new_array_expression() elif ((LA(1)==NEW) and (LA(2)==ID)): // line 2102 match(NEW) @@ -3079,8 +3102,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ec.Add(e); else: - goto _loop212_breakloop - :_loop212_breakloop + goto _loop216_breakloop + :_loop216_breakloop elif ((_givenValue == RPAREN) or (_givenValue ==RBRACK) ): // 1827 @@ -3519,8 +3542,8 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) slice(se) else: - goto _loop228_breakloop - :_loop228_breakloop + goto _loop232_breakloop + :_loop232_breakloop match(RBRACK) elif ((LA(1)==DOT) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 match(DOT) @@ -3536,8 +3559,8 @@ class UnityScriptParser(antlr.LLkParser): expression_list(args) match(RPAREN) else: - goto _loop231_breakloop - :_loop231_breakloop + goto _loop235_breakloop + :_loop235_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3728,8 +3751,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop242_breakloop - :_loop242_breakloop + goto _loop246_breakloop + :_loop246_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3765,8 +3788,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop250_breakloop - :_loop250_breakloop + goto _loop254_breakloop + :_loop254_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3845,8 +3868,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop262_breakloop - :_loop262_breakloop + goto _loop266_breakloop + :_loop266_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3894,8 +3917,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), op, e, r) else: - goto _loop270_breakloop - :_loop270_breakloop + goto _loop274_breakloop + :_loop274_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3921,8 +3944,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop273_breakloop - :_loop273_breakloop + goto _loop277_breakloop + :_loop277_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3948,8 +3971,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop276_breakloop - :_loop276_breakloop + goto _loop280_breakloop + :_loop280_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3975,8 +3998,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop279_breakloop - :_loop279_breakloop + goto _loop283_breakloop + :_loop283_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4003,8 +4026,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop282_breakloop - :_loop282_breakloop + goto _loop286_breakloop + :_loop286_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4031,8 +4054,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop285_breakloop - :_loop285_breakloop + goto _loop289_breakloop + :_loop289_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4080,19 +4103,19 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling lbrack = LT(1) match(LBRACK) - synPredMatched293 as bool = false + synPredMatched297 as bool = false if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_57_.member(cast(int, LA(2))))): - _m293 as int = mark() - synPredMatched293 = true + _m297 as int = mark() + synPredMatched297 = true ++inputState.guessing try: expression() match(FOR) except x as RecognitionException: - synPredMatched293 = false - rewind(_m293) + synPredMatched297 = false + rewind(_m297) --inputState.guessing - if synPredMatched293: + if synPredMatched297: projection=expression() match(FOR) match(LPAREN) @@ -4179,8 +4202,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dle.Items.Add(pair); else: - goto _loop301_breakloop - :_loop301_breakloop + goto _loop305_breakloop + :_loop305_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index d0423db..ee68337 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -1017,14 +1017,16 @@ member returns [Token name] type_reference returns [TypeReference tr] { + rank = 1 }: ( (tr=simple_type_reference | tr=anonymous_function_type) ( - LBRACK + lbrack:LBRACK + (COMMA { ++rank })* RBRACK { - tr = ArrayTypeReference(tr.LexicalInfo, tr); + tr = ArrayTypeReference(tr.LexicalInfo, tr, IntegerLiteralExpression(ToLexicalInfo(lbrack), rank)) } )? ) @@ -1061,10 +1063,15 @@ function_type_parameters[ParameterDeclarationCollection parameters] array_initializer returns [Expression e] { + dimensions = List of Expression(1) }: - tr=simple_type_reference LBRACK count=sum RBRACK + tr=simple_type_reference + LBRACK + size=sum { dimensions.Add(size) } + (COMMA size=sum { dimensions.Add(size) })* + RBRACK { - e = CodeFactory.NewArrayInitializer(tr.LexicalInfo, tr, count) + e = CodeFactory.NewArrayInitializer(tr.LexicalInfo, tr, dimensions) } ; diff --git a/tests/integration/array-with-two-dimensions.js b/tests/integration/array-with-two-dimensions.js new file mode 100644 index 0000000..84cb527 --- /dev/null +++ b/tests/integration/array-with-two-dimensions.js @@ -0,0 +1,9 @@ +/* +System.Int32[,] +2 +3 +*/ +var a:int[,] = new int[2, 3]; +print(a.GetType()); +for (var i=0; i Date: Thu, 6 Jan 2011 18:28:15 -0200 Subject: [PATCH 117/276] test case proving Boo.Lang.IQuackFu javascript implementations work just fine --- .../DuckyIntegrationTestFixture.boo | 4 +++ .../StrictIntegrationTestFixture.boo | 4 +++ tests/integration/quack-fu.js | 25 +++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 tests/integration/quack-fu.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index a4611f6..6f7f744 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -483,6 +483,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/properties.js") + [Test] def quack_fu(): + RunTestCase("tests/integration/quack-fu.js") + + [Test] def question_mark(): RunTestCase("tests/integration/question_mark.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index f0dfc0d..653de0e 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -485,6 +485,10 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/properties.js") + [Test] def quack_fu(): + RunTestCase("tests/integration/quack-fu.js") + + [Test] def question_mark(): RunTestCase("tests/integration/question_mark.js") diff --git a/tests/integration/quack-fu.js b/tests/integration/quack-fu.js new file mode 100644 index 0000000..7aaa861 --- /dev/null +++ b/tests/integration/quack-fu.js @@ -0,0 +1,25 @@ +/* +Eric Idle +*/ +class Expando implements Boo.Lang.IQuackFu { + + private var _attrs = {}; + + function QuackGet(name: String, parameters: Object[]) { + return _attrs[name]; + } + + function QuackSet(name: String, parameters: Object[], value) { + _attrs[name] = value; + return value; + } + + function QuackInvoke(name: String, args: Object[]) { + throw new System.NotImplementedException(); + } +} + +var e = new Expando(); +e.firstName = "Eric"; +e.lastName = "Idle"; +print(e.firstName + " " + e.lastName); From 75c57fc1b8a11231d4d875cec405850a1bff3780 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 11 Jan 2011 14:59:46 -0200 Subject: [PATCH 118/276] do-while support --- src/UnityScript.Lang/UnityScript.Lang.booproj | 2 + .../ErrorMessagesTestFixture.Generated.boo | 4 + .../ParserTestFixture.Generated.boo | 4 + src/UnityScript/Parser/UnityScriptLexer.boo | 496 ++++++++--------- src/UnityScript/Parser/UnityScriptParser.boo | 521 ++++++++++-------- .../Parser/UnityScriptTokenTypes.boo | 219 ++++---- .../Parser/UnityScriptTokenTypes.txt | 219 ++++---- src/UnityScript/UnityScript.booproj | 2 + src/UnityScript/UnityScript.g | 22 +- .../do-while-const-condition.js | 9 + tests/parser/do-while-1.js | 11 + 11 files changed, 804 insertions(+), 705 deletions(-) create mode 100644 tests/error-messages/do-while-const-condition.js create mode 100644 tests/parser/do-while-1.js diff --git a/src/UnityScript.Lang/UnityScript.Lang.booproj b/src/UnityScript.Lang/UnityScript.Lang.booproj index efcf4bf..b8554ef 100755 --- a/src/UnityScript.Lang/UnityScript.Lang.booproj +++ b/src/UnityScript.Lang/UnityScript.Lang.booproj @@ -20,6 +20,7 @@ false false + false none @@ -28,6 +29,7 @@ false false + false diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index eb946f3..8dcb962 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -26,6 +26,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/cannot-convert-error.js") + [Test] def do_while_const_condition(): + RunTestCase("tests/error-messages/do-while-const-condition.js") + + [Test] def double_array_in_float_array_var_initializer(): RunTestCase("tests/error-messages/double-array-in-float-array-var-initializer.js") diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index 0d808d4..385ff8a 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -38,6 +38,10 @@ partial class ParserTestFixture: RunTestCase("tests/parser/commentbug.js") + [Test] def do_while_1(): + RunTestCase("tests/parser/do-while-1.js") + + [Test] def enums(): RunTestCase("tests/parser/enums.js") diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index a688bcf..0f1b935 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -38,115 +38,116 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): public static final CATCH = 7 public static final CLASS = 8 public static final CONTINUE = 9 - public static final ELSE = 10 - public static final ENUM = 11 - public static final EXTENDS = 12 - public static final FALSE = 13 - public static final FINAL = 14 - public static final FINALLY = 15 - public static final FOR = 16 - public static final FUNCTION = 17 - public static final GET = 18 - public static final IF = 19 - public static final IMPORT = 20 - public static final IMPLEMENTS = 21 - public static final IN = 22 - public static final INTERFACE = 23 - public static final INSTANCEOF = 24 - public static final NEW = 25 - public static final NULL = 26 - public static final RETURN = 27 - public static final PUBLIC = 28 - public static final PROTECTED = 29 - public static final INTERNAL = 30 - public static final OVERRIDE = 31 - public static final PARTIAL = 32 - public static final PRAGMA = 33 - public static final PRIVATE = 34 - public static final SET = 35 - public static final STATIC = 36 - public static final SUPER = 37 - public static final THIS = 38 - public static final THROW = 39 - public static final TRUE = 40 - public static final TRY = 41 - public static final TYPEOF = 42 - public static final VAR = 43 - public static final VIRTUAL = 44 - public static final WHILE = 45 - public static final YIELD = 46 - public static final SWITCH = 47 - public static final CASE = 48 - public static final DEFAULT = 49 - public static final INPLACE_DIVISION = 50 - public static final INPLACE_ADD = 51 - public static final INPLACE_SUBTRACT = 52 - public static final INPLACE_MULTIPLY = 53 - public static final ID = 54 - public static final DOUBLE_QUOTED_STRING = 55 - public static final LBRACE = 56 - public static final RBRACE = 57 - public static final LPAREN = 58 - public static final RPAREN = 59 - public static final DOT = 60 - public static final COLON = 61 - public static final COMMA = 62 - public static final LBRACK = 63 - public static final RBRACK = 64 - public static final BITWISE_OR = 65 - public static final INPLACE_BITWISE_OR = 66 - public static final BITWISE_AND = 67 - public static final BITWISE_XOR = 68 - public static final INPLACE_BITWISE_AND = 69 - public static final LOGICAL_OR = 70 - public static final LOGICAL_AND = 71 - public static final EOS = 72 - public static final ASSIGN = 73 - public static final INCREMENT = 74 - public static final DECREMENT = 75 - public static final ADD = 76 - public static final SUBTRACT = 77 - public static final MODULUS = 78 - public static final MULTIPLY = 79 - public static final EQUALITY = 80 - public static final INEQUALITY = 81 - public static final QUESTION_MARK = 82 - public static final BITWISE_NOT = 83 - public static final REFERENCE_EQUALITY = 84 - public static final REFERENCE_INEQUALITY = 85 - public static final LESS_THAN = 86 - public static final LESS_THAN_OR_EQUAL = 87 - public static final SHIFT_LEFT = 88 - public static final INPLACE_SHIFT_LEFT = 89 - public static final GREATER_THAN = 90 - public static final GREATER_THAN_OR_EQUAL = 91 - public static final SHIFT_RIGHT = 92 - public static final INPLACE_SHIFT_RIGHT = 93 - public static final AT = 94 - public static final SCRIPT_ATTRIBUTE_MARKER = 95 - public static final ASSEMBLY_ATTRIBUTE_MARKER = 96 - public static final HASH = 97 - public static final INPLACE_BITWISE_XOR = 98 - public static final NOT = 99 - public static final DIVISION = 100 - public static final RE_LITERAL = 101 - public static final DOUBLE = 102 - public static final INT = 103 - public static final LONG = 104 - public static final SINGLE_QUOTED_STRING = 105 - public static final DOUBLE_SUFFIX = 106 - public static final EXPONENT = 107 - public static final WHITE_SPACE = 108 - public static final DQS_ESC = 109 - public static final SQS_ESC = 110 - public static final SESC = 111 - public static final ML_COMMENT = 112 - public static final RE_CHAR = 113 - public static final RE_ESC = 114 - public static final NEWLINE = 115 - public static final ID_LETTER = 116 - public static final DIGIT = 117 - public static final HEXDIGIT = 118 + public static final DO = 10 + public static final ELSE = 11 + public static final ENUM = 12 + public static final EXTENDS = 13 + public static final FALSE = 14 + public static final FINAL = 15 + public static final FINALLY = 16 + public static final FOR = 17 + public static final FUNCTION = 18 + public static final GET = 19 + public static final IF = 20 + public static final IMPORT = 21 + public static final IMPLEMENTS = 22 + public static final IN = 23 + public static final INTERFACE = 24 + public static final INSTANCEOF = 25 + public static final NEW = 26 + public static final NULL = 27 + public static final RETURN = 28 + public static final PUBLIC = 29 + public static final PROTECTED = 30 + public static final INTERNAL = 31 + public static final OVERRIDE = 32 + public static final PARTIAL = 33 + public static final PRAGMA = 34 + public static final PRIVATE = 35 + public static final SET = 36 + public static final STATIC = 37 + public static final SUPER = 38 + public static final THIS = 39 + public static final THROW = 40 + public static final TRUE = 41 + public static final TRY = 42 + public static final TYPEOF = 43 + public static final VAR = 44 + public static final VIRTUAL = 45 + public static final WHILE = 46 + public static final YIELD = 47 + public static final SWITCH = 48 + public static final CASE = 49 + public static final DEFAULT = 50 + public static final INPLACE_DIVISION = 51 + public static final INPLACE_ADD = 52 + public static final INPLACE_SUBTRACT = 53 + public static final INPLACE_MULTIPLY = 54 + public static final ID = 55 + public static final DOUBLE_QUOTED_STRING = 56 + public static final LBRACE = 57 + public static final RBRACE = 58 + public static final LPAREN = 59 + public static final RPAREN = 60 + public static final DOT = 61 + public static final COLON = 62 + public static final COMMA = 63 + public static final LBRACK = 64 + public static final RBRACK = 65 + public static final BITWISE_OR = 66 + public static final INPLACE_BITWISE_OR = 67 + public static final BITWISE_AND = 68 + public static final BITWISE_XOR = 69 + public static final INPLACE_BITWISE_AND = 70 + public static final LOGICAL_OR = 71 + public static final LOGICAL_AND = 72 + public static final EOS = 73 + public static final ASSIGN = 74 + public static final INCREMENT = 75 + public static final DECREMENT = 76 + public static final ADD = 77 + public static final SUBTRACT = 78 + public static final MODULUS = 79 + public static final MULTIPLY = 80 + public static final EQUALITY = 81 + public static final INEQUALITY = 82 + public static final QUESTION_MARK = 83 + public static final BITWISE_NOT = 84 + public static final REFERENCE_EQUALITY = 85 + public static final REFERENCE_INEQUALITY = 86 + public static final LESS_THAN = 87 + public static final LESS_THAN_OR_EQUAL = 88 + public static final SHIFT_LEFT = 89 + public static final INPLACE_SHIFT_LEFT = 90 + public static final GREATER_THAN = 91 + public static final GREATER_THAN_OR_EQUAL = 92 + public static final SHIFT_RIGHT = 93 + public static final INPLACE_SHIFT_RIGHT = 94 + public static final AT = 95 + public static final SCRIPT_ATTRIBUTE_MARKER = 96 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 97 + public static final HASH = 98 + public static final INPLACE_BITWISE_XOR = 99 + public static final NOT = 100 + public static final DIVISION = 101 + public static final RE_LITERAL = 102 + public static final DOUBLE = 103 + public static final INT = 104 + public static final LONG = 105 + public static final SINGLE_QUOTED_STRING = 106 + public static final DOUBLE_SUFFIX = 107 + public static final EXPONENT = 108 + public static final WHITE_SPACE = 109 + public static final DQS_ESC = 110 + public static final SQS_ESC = 111 + public static final SESC = 112 + public static final ML_COMMENT = 113 + public static final RE_CHAR = 114 + public static final RE_ESC = 115 + public static final NEWLINE = 116 + public static final ID_LETTER = 117 + public static final DIGIT = 118 + public static final HEXDIGIT = 119 static def IsDigit(ch as char): @@ -168,99 +169,100 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): caseSensitiveLiterals = true setCaseSensitive(true) literals = Hashtable(100, 0.4, null, Comparer.Default) - literals.Add(",", 62) - literals.Add("public", 28) - literals.Add("a string", 55) - literals.Add("an identifier", 54) - literals.Add("]", 64) - literals.Add("case", 48) + literals.Add(",", 63) + literals.Add("public", 29) + literals.Add("a string", 56) + literals.Add("an identifier", 55) + literals.Add("]", 65) + literals.Add("case", 49) literals.Add("break", 5) - literals.Add("while", 45) - literals.Add("new", 25) - literals.Add("||", 70) - literals.Add("+", 76) - literals.Add("instanceof", 24) - literals.Add("implements", 21) - literals.Add("*", 79) - literals.Add("|=", 66) - literals.Add("typeof", 42) - literals.Add("@assembly", 96) - literals.Add("[", 63) - literals.Add(">>=", 93) - literals.Add("return", 27) - literals.Add("throw", 39) - literals.Add("var", 43) - literals.Add(")", 59) - literals.Add("==", 80) - literals.Add("null", 26) - literals.Add("protected", 29) - literals.Add("@script", 95) + literals.Add("while", 46) + literals.Add("new", 26) + literals.Add("||", 71) + literals.Add("+", 77) + literals.Add("instanceof", 25) + literals.Add("implements", 22) + literals.Add("*", 80) + literals.Add("|=", 67) + literals.Add("typeof", 43) + literals.Add("@assembly", 97) + literals.Add("[", 64) + literals.Add(">>=", 94) + literals.Add("return", 28) + literals.Add("throw", 40) + literals.Add("var", 44) + literals.Add(")", 60) + literals.Add("==", 81) + literals.Add("null", 27) + literals.Add("protected", 30) + literals.Add("@script", 96) literals.Add("class", 8) - literals.Add("(", 58) - literals.Add("~", 83) - literals.Add("function", 17) - literals.Add("/=", 50) - literals.Add("super", 37) - literals.Add("@", 94) - literals.Add("-=", 52) - literals.Add("set", 35) - literals.Add("+=", 51) - literals.Add("!==", 85) - literals.Add("}", 57) - literals.Add("interface", 23) - literals.Add("?", 82) - literals.Add("&", 67) - literals.Add("internal", 30) - literals.Add("final", 14) - literals.Add("yield", 46) - literals.Add("!=", 81) - literals.Add("===", 84) - literals.Add("if", 19) - literals.Add("|", 65) - literals.Add("override", 31) - literals.Add(">", 90) + literals.Add("(", 59) + literals.Add("do", 10) + literals.Add("~", 84) + literals.Add("function", 18) + literals.Add("/=", 51) + literals.Add("super", 38) + literals.Add("@", 95) + literals.Add("-=", 53) + literals.Add("set", 36) + literals.Add("+=", 52) + literals.Add("!==", 86) + literals.Add("}", 58) + literals.Add("interface", 24) + literals.Add("?", 83) + literals.Add("&", 68) + literals.Add("internal", 31) + literals.Add("final", 15) + literals.Add("yield", 47) + literals.Add("!=", 82) + literals.Add("===", 85) + literals.Add("if", 20) + literals.Add("|", 66) + literals.Add("override", 32) + literals.Add(">", 91) literals.Add("as", 4) - literals.Add("%", 78) - literals.Add("pragma", 33) + literals.Add("%", 79) + literals.Add("pragma", 34) literals.Add("catch", 7) - literals.Add("try", 41) - literals.Add("{", 56) - literals.Add("=", 73) - literals.Add("enum", 11) - literals.Add("for", 16) - literals.Add(">>", 92) - literals.Add("extends", 12) - literals.Add("private", 34) - literals.Add("default", 49) - literals.Add("--", 75) - literals.Add("<", 86) - literals.Add("false", 13) - literals.Add("this", 38) - literals.Add("static", 36) - literals.Add(">=", 91) - literals.Add("<=", 87) - literals.Add("partial", 32) - literals.Add(";", 72) - literals.Add("get", 18) - literals.Add("<<=", 89) + literals.Add("try", 42) + literals.Add("{", 57) + literals.Add("=", 74) + literals.Add("enum", 12) + literals.Add("for", 17) + literals.Add(">>", 93) + literals.Add("extends", 13) + literals.Add("private", 35) + literals.Add("default", 50) + literals.Add("--", 76) + literals.Add("<", 87) + literals.Add("false", 14) + literals.Add("this", 39) + literals.Add("static", 37) + literals.Add(">=", 92) + literals.Add("<=", 88) + literals.Add("partial", 33) + literals.Add(";", 73) + literals.Add("get", 19) + literals.Add("<<=", 90) literals.Add("continue", 9) - literals.Add("&&", 71) + literals.Add("&&", 72) literals.Add("cast", 6) - literals.Add("<<", 88) - literals.Add(".", 60) - literals.Add("finally", 15) - literals.Add("else", 10) - literals.Add("import", 20) - literals.Add("++", 74) - literals.Add(":", 61) - literals.Add("in", 22) - literals.Add("switch", 47) - literals.Add("true", 40) - literals.Add("-", 77) - literals.Add("*=", 53) - literals.Add("virtual", 44) - literals.Add("^", 68) - literals.Add("&=", 69) + literals.Add("<<", 89) + literals.Add(".", 61) + literals.Add("finally", 16) + literals.Add("else", 11) + literals.Add("import", 21) + literals.Add("++", 75) + literals.Add(":", 62) + literals.Add("in", 23) + literals.Add("switch", 48) + literals.Add("true", 41) + literals.Add("-", 78) + literals.Add("*=", 54) + literals.Add("virtual", 45) + literals.Add("^", 69) + literals.Add("&=", 70) override def nextToken() as IToken: theRetToken as IToken @@ -586,8 +588,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mDIGIT(false) else: // line 1969 - goto _loop318_breakloop - :_loop318_breakloop + goto _loop319_breakloop + :_loop319_breakloop _ttype = testLiteralsTable(_ttype) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -680,17 +682,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): match("0x") - _cnt322 as int = 0 + _cnt323 as int = 0 while true: if ((tokenSet_0_.member(cast(int, cached_LA1)))): mHEXDIGIT(false) else: - if (_cnt322 >= 1): - goto _loop322_breakloop + if (_cnt323 >= 1): + goto _loop323_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt322 - :_loop322_breakloop + ++_cnt323 + :_loop323_breakloop if ((cached_LA1==char('L') or cached_LA1==char('l'))): _givenValue = cached_LA1 if ((_givenValue == char('l'))): // 1831 @@ -704,17 +706,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): else: // line 2053 pass // 947 elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt326 as int = 0 + _cnt327 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt326 >= 1): - goto _loop326_breakloop + if (_cnt327 >= 1): + goto _loop327_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt326 - :_loop326_breakloop + ++_cnt327 + :_loop327_breakloop _givenValue = cached_LA1 if ((_givenValue == char('L')) or (_givenValue ==char('l')) @@ -810,17 +812,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_SUFFIX - _cnt335 as int = 0 + _cnt336 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt335 >= 1): - goto _loop335_breakloop + if (_cnt336 >= 1): + goto _loop336_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt335 - :_loop335_breakloop + ++_cnt336 + :_loop336_breakloop if ((cached_LA1==char('E') or cached_LA1==char('e'))): mEXPONENT(false) else: // line 2053 @@ -871,17 +873,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt342 as int = 0 + _cnt343 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt342 >= 1): - goto _loop342_breakloop + if (_cnt343 >= 1): + goto _loop343_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt342 - :_loop342_breakloop + ++_cnt343 + :_loop343_breakloop if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1347,18 +1349,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched389 as bool = false + synPredMatched390 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m389 as int = mark() - synPredMatched389 = true + _m390 as int = mark() + synPredMatched390 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched389 = false - rewind(_m389) + synPredMatched390 = false + rewind(_m390) --inputState.guessing - if synPredMatched389: + if synPredMatched390: mML_COMMENT(false) if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1371,8 +1373,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop394_breakloop - :_loop394_breakloop + goto _loop395_breakloop + :_loop395_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; elif ((_givenValue == char('='))): // 1831 @@ -1401,8 +1403,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop423_breakloop - :_loop423_breakloop + goto _loop424_breakloop + :_loop424_breakloop match("*/") if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1415,7 +1417,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt398 as int = 0 + _cnt399 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1429,12 +1431,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt398 >= 1): - goto _loop398_breakloop + if (_cnt399 >= 1): + goto _loop399_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt398 - :_loop398_breakloop + ++_cnt399 + :_loop399_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1477,8 +1479,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop402_breakloop - :_loop402_breakloop + goto _loop403_breakloop + :_loop403_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1527,8 +1529,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_4_) else: - goto _loop406_breakloop - :_loop406_breakloop + goto _loop407_breakloop + :_loop407_breakloop _saveIndex = text.Length match('\'') text.Length = _saveIndex @@ -1629,17 +1631,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt426 as int = 0 + _cnt427 as int = 0 while true: if ((tokenSet_5_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt426 >= 1): - goto _loop426_breakloop + if (_cnt427 >= 1): + goto _loop427_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt426 - :_loop426_breakloop + ++_cnt427 + :_loop427_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1697,17 +1699,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt432 as int = 0 + _cnt433 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt432 >= 1): - goto _loop432_breakloop + if (_cnt433 >= 1): + goto _loop433_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt432 - :_loop432_breakloop + ++_cnt433 + :_loop433_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index ae862bb..1ddae16 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -36,115 +36,116 @@ class UnityScriptParser(antlr.LLkParser): public static final CATCH = 7 public static final CLASS = 8 public static final CONTINUE = 9 - public static final ELSE = 10 - public static final ENUM = 11 - public static final EXTENDS = 12 - public static final FALSE = 13 - public static final FINAL = 14 - public static final FINALLY = 15 - public static final FOR = 16 - public static final FUNCTION = 17 - public static final GET = 18 - public static final IF = 19 - public static final IMPORT = 20 - public static final IMPLEMENTS = 21 - public static final IN = 22 - public static final INTERFACE = 23 - public static final INSTANCEOF = 24 - public static final NEW = 25 - public static final NULL = 26 - public static final RETURN = 27 - public static final PUBLIC = 28 - public static final PROTECTED = 29 - public static final INTERNAL = 30 - public static final OVERRIDE = 31 - public static final PARTIAL = 32 - public static final PRAGMA = 33 - public static final PRIVATE = 34 - public static final SET = 35 - public static final STATIC = 36 - public static final SUPER = 37 - public static final THIS = 38 - public static final THROW = 39 - public static final TRUE = 40 - public static final TRY = 41 - public static final TYPEOF = 42 - public static final VAR = 43 - public static final VIRTUAL = 44 - public static final WHILE = 45 - public static final YIELD = 46 - public static final SWITCH = 47 - public static final CASE = 48 - public static final DEFAULT = 49 - public static final INPLACE_DIVISION = 50 - public static final INPLACE_ADD = 51 - public static final INPLACE_SUBTRACT = 52 - public static final INPLACE_MULTIPLY = 53 - public static final ID = 54 - public static final DOUBLE_QUOTED_STRING = 55 - public static final LBRACE = 56 - public static final RBRACE = 57 - public static final LPAREN = 58 - public static final RPAREN = 59 - public static final DOT = 60 - public static final COLON = 61 - public static final COMMA = 62 - public static final LBRACK = 63 - public static final RBRACK = 64 - public static final BITWISE_OR = 65 - public static final INPLACE_BITWISE_OR = 66 - public static final BITWISE_AND = 67 - public static final BITWISE_XOR = 68 - public static final INPLACE_BITWISE_AND = 69 - public static final LOGICAL_OR = 70 - public static final LOGICAL_AND = 71 - public static final EOS = 72 - public static final ASSIGN = 73 - public static final INCREMENT = 74 - public static final DECREMENT = 75 - public static final ADD = 76 - public static final SUBTRACT = 77 - public static final MODULUS = 78 - public static final MULTIPLY = 79 - public static final EQUALITY = 80 - public static final INEQUALITY = 81 - public static final QUESTION_MARK = 82 - public static final BITWISE_NOT = 83 - public static final REFERENCE_EQUALITY = 84 - public static final REFERENCE_INEQUALITY = 85 - public static final LESS_THAN = 86 - public static final LESS_THAN_OR_EQUAL = 87 - public static final SHIFT_LEFT = 88 - public static final INPLACE_SHIFT_LEFT = 89 - public static final GREATER_THAN = 90 - public static final GREATER_THAN_OR_EQUAL = 91 - public static final SHIFT_RIGHT = 92 - public static final INPLACE_SHIFT_RIGHT = 93 - public static final AT = 94 - public static final SCRIPT_ATTRIBUTE_MARKER = 95 - public static final ASSEMBLY_ATTRIBUTE_MARKER = 96 - public static final HASH = 97 - public static final INPLACE_BITWISE_XOR = 98 - public static final NOT = 99 - public static final DIVISION = 100 - public static final RE_LITERAL = 101 - public static final DOUBLE = 102 - public static final INT = 103 - public static final LONG = 104 - public static final SINGLE_QUOTED_STRING = 105 - public static final DOUBLE_SUFFIX = 106 - public static final EXPONENT = 107 - public static final WHITE_SPACE = 108 - public static final DQS_ESC = 109 - public static final SQS_ESC = 110 - public static final SESC = 111 - public static final ML_COMMENT = 112 - public static final RE_CHAR = 113 - public static final RE_ESC = 114 - public static final NEWLINE = 115 - public static final ID_LETTER = 116 - public static final DIGIT = 117 - public static final HEXDIGIT = 118 + public static final DO = 10 + public static final ELSE = 11 + public static final ENUM = 12 + public static final EXTENDS = 13 + public static final FALSE = 14 + public static final FINAL = 15 + public static final FINALLY = 16 + public static final FOR = 17 + public static final FUNCTION = 18 + public static final GET = 19 + public static final IF = 20 + public static final IMPORT = 21 + public static final IMPLEMENTS = 22 + public static final IN = 23 + public static final INTERFACE = 24 + public static final INSTANCEOF = 25 + public static final NEW = 26 + public static final NULL = 27 + public static final RETURN = 28 + public static final PUBLIC = 29 + public static final PROTECTED = 30 + public static final INTERNAL = 31 + public static final OVERRIDE = 32 + public static final PARTIAL = 33 + public static final PRAGMA = 34 + public static final PRIVATE = 35 + public static final SET = 36 + public static final STATIC = 37 + public static final SUPER = 38 + public static final THIS = 39 + public static final THROW = 40 + public static final TRUE = 41 + public static final TRY = 42 + public static final TYPEOF = 43 + public static final VAR = 44 + public static final VIRTUAL = 45 + public static final WHILE = 46 + public static final YIELD = 47 + public static final SWITCH = 48 + public static final CASE = 49 + public static final DEFAULT = 50 + public static final INPLACE_DIVISION = 51 + public static final INPLACE_ADD = 52 + public static final INPLACE_SUBTRACT = 53 + public static final INPLACE_MULTIPLY = 54 + public static final ID = 55 + public static final DOUBLE_QUOTED_STRING = 56 + public static final LBRACE = 57 + public static final RBRACE = 58 + public static final LPAREN = 59 + public static final RPAREN = 60 + public static final DOT = 61 + public static final COLON = 62 + public static final COMMA = 63 + public static final LBRACK = 64 + public static final RBRACK = 65 + public static final BITWISE_OR = 66 + public static final INPLACE_BITWISE_OR = 67 + public static final BITWISE_AND = 68 + public static final BITWISE_XOR = 69 + public static final INPLACE_BITWISE_AND = 70 + public static final LOGICAL_OR = 71 + public static final LOGICAL_AND = 72 + public static final EOS = 73 + public static final ASSIGN = 74 + public static final INCREMENT = 75 + public static final DECREMENT = 76 + public static final ADD = 77 + public static final SUBTRACT = 78 + public static final MODULUS = 79 + public static final MULTIPLY = 80 + public static final EQUALITY = 81 + public static final INEQUALITY = 82 + public static final QUESTION_MARK = 83 + public static final BITWISE_NOT = 84 + public static final REFERENCE_EQUALITY = 85 + public static final REFERENCE_INEQUALITY = 86 + public static final LESS_THAN = 87 + public static final LESS_THAN_OR_EQUAL = 88 + public static final SHIFT_LEFT = 89 + public static final INPLACE_SHIFT_LEFT = 90 + public static final GREATER_THAN = 91 + public static final GREATER_THAN_OR_EQUAL = 92 + public static final SHIFT_RIGHT = 93 + public static final INPLACE_SHIFT_RIGHT = 94 + public static final AT = 95 + public static final SCRIPT_ATTRIBUTE_MARKER = 96 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 97 + public static final HASH = 98 + public static final INPLACE_BITWISE_XOR = 99 + public static final NOT = 100 + public static final DIVISION = 101 + public static final RE_LITERAL = 102 + public static final DOUBLE = 103 + public static final INT = 104 + public static final LONG = 105 + public static final SINGLE_QUOTED_STRING = 106 + public static final DOUBLE_SUFFIX = 107 + public static final EXPONENT = 108 + public static final WHITE_SPACE = 109 + public static final DQS_ESC = 110 + public static final SQS_ESC = 111 + public static final SESC = 112 + public static final ML_COMMENT = 113 + public static final RE_CHAR = 114 + public static final RE_ESC = 115 + public static final NEWLINE = 116 + public static final ID_LETTER = 117 + public static final DIGIT = 118 + public static final HEXDIGIT = 119 [property(CompilerContext)] @@ -492,14 +493,17 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling _givenValue = LA(1) - if ((_givenValue == FOR) + if ((_givenValue == DO) + or (_givenValue ==FOR) or (_givenValue ==IF) or (_givenValue ==TRY) or (_givenValue ==WHILE) or (_givenValue ==SWITCH) ): // 1827 _givenValue = LA(1) - if ((_givenValue == WHILE)): // 1831 + if ((_givenValue == DO)): // 1831 + do_while_statement(b) + elif ((_givenValue == WHILE)): // 1831 while_statement(b) elif ((_givenValue == FOR)): // 1831 for_statement(b) @@ -639,8 +643,8 @@ class UnityScriptParser(antlr.LLkParser): match(DOT) e=member_reference_expression(e) else: - goto _loop198_breakloop - :_loop198_breakloop + goto _loop199_breakloop + :_loop199_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -854,6 +858,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==CATCH) or (_givenValue ==CLASS) or (_givenValue ==CONTINUE) + or (_givenValue ==DO) or (_givenValue ==ELSE) or (_givenValue ==ENUM) or (_givenValue ==FALSE) @@ -1262,6 +1267,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==BREAK) or (_givenValue ==CLASS) or (_givenValue ==CONTINUE) + or (_givenValue ==DO) or (_givenValue ==ENUM) or (_givenValue ==FALSE) or (_givenValue ==FINAL) @@ -1321,6 +1327,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==BREAK) or (_givenValue ==CLASS) or (_givenValue ==CONTINUE) + or (_givenValue ==DO) or (_givenValue ==ENUM) or (_givenValue ==FALSE) or (_givenValue ==FINAL) @@ -1387,6 +1394,36 @@ class UnityScriptParser(antlr.LLkParser): raise return member + public def do_while_statement( + container as Block + ) as void: //throws RecognitionException, TokenStreamException + + d as IToken = null + w as IToken = null + + try: // for error handling + d = LT(1) + match(DO) + if 0 == inputState.guessing: + ws = WhileStatement(ToLexicalInfo(d), Condition: BoolLiteralExpression(true)) + b = ws.Block + container.Add(ws) + EnterLoop(ws) + block(b) + w = LT(1) + match(WHILE) + e=paren_expression() + eos() + if 0 == inputState.guessing: + b.Add(BreakStatement(ToLexicalInfo(w), Modifier: StatementModifier(StatementModifierType.If, e))) + LeaveLoop(ws) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_24_) + else: + raise + public def while_statement( container as Block ) as void: //throws RecognitionException, TokenStreamException @@ -1530,8 +1567,8 @@ class UnityScriptParser(antlr.LLkParser): tr = null compound_or_single_stmt(b) else: - goto _loop155_breakloop - :_loop155_breakloop + goto _loop156_breakloop + :_loop156_breakloop if ((LA(1)==FINALLY) and (tokenSet_34_.member(cast(int, LA(2))))): finally_block(s) elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 @@ -1584,22 +1621,22 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: item.Arguments.Add(e); else: - goto _loop143_breakloop - :_loop143_breakloop - _cnt145 as int = 0 + goto _loop144_breakloop + :_loop144_breakloop + _cnt146 as int = 0 while true: if ((tokenSet_34_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt145 >= 1): - goto _loop145_breakloop + if (_cnt146 >= 1): + goto _loop146_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt145 - :_loop145_breakloop + ++_cnt146 + :_loop146_breakloop else: - goto _loop146_breakloop - :_loop146_breakloop + goto _loop147_breakloop + :_loop147_breakloop _givenValue = LA(1) if ((_givenValue == DEFAULT)): // 1831 d = LT(1) @@ -1609,17 +1646,17 @@ class UnityScriptParser(antlr.LLkParser): item = MacroStatement(ToLexicalInfo(d), Name: d.getText()) itemBlock = item.Body switchBlock.Add(item) - _cnt149 as int = 0 + _cnt150 as int = 0 while true: if ((tokenSet_34_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt149 >= 1): - goto _loop149_breakloop + if (_cnt150 >= 1): + goto _loop150_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt149 - :_loop149_breakloop + ++_cnt150 + :_loop150_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 @@ -1629,8 +1666,8 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS) and (tokenSet_24_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop151_breakloop - :_loop151_breakloop + goto _loop152_breakloop + :_loop152_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1847,8 +1884,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ++rank else: - goto _loop167_breakloop - :_loop167_breakloop + goto _loop168_breakloop + :_loop168_breakloop match(RBRACK) if 0 == inputState.guessing: tr = ArrayTypeReference(tr.LexicalInfo, tr, IntegerLiteralExpression(ToLexicalInfo(lbrack), rank)) @@ -1880,8 +1917,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: typeReferences.Add(tr) else: - goto _loop183_breakloop - :_loop183_breakloop + goto _loop184_breakloop + :_loop184_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -2202,14 +2239,17 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling _givenValue = LA(1) - if ((_givenValue == FOR) + if ((_givenValue == DO) + or (_givenValue ==FOR) or (_givenValue ==IF) or (_givenValue ==TRY) or (_givenValue ==WHILE) or (_givenValue ==SWITCH) ): // 1827 _givenValue = LA(1) - if ((_givenValue == WHILE)): // 1831 + if ((_givenValue == DO)): // 1831 + do_while_statement(b) + elif ((_givenValue == WHILE)): // 1831 while_statement(b) elif ((_givenValue == FOR)): // 1831 for_statement(b) @@ -2356,6 +2396,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==CATCH) or (_givenValue ==CLASS) or (_givenValue ==CONTINUE) + or (_givenValue ==DO) or (_givenValue ==ELSE) or (_givenValue ==ENUM) or (_givenValue ==FALSE) @@ -2514,6 +2555,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==CATCH) or (_givenValue ==CLASS) or (_givenValue ==CONTINUE) + or (_givenValue ==DO) or (_givenValue ==ELSE) or (_givenValue ==ENUM) or (_givenValue ==FALSE) @@ -2922,8 +2964,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) else: - goto _loop173_breakloop - :_loop173_breakloop + goto _loop174_breakloop + :_loop174_breakloop elif ((_givenValue == RPAREN)): // 1831 pass // 947 else: // line 1969 @@ -2954,8 +2996,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dimensions.Add(size) else: - goto _loop176_breakloop - :_loop176_breakloop + goto _loop177_breakloop + :_loop177_breakloop match(RBRACK) if 0 == inputState.guessing: e = CodeFactory.NewArrayInitializer(tr.LexicalInfo, tr, dimensions) @@ -2999,8 +3041,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop250_breakloop - :_loop250_breakloop + goto _loop251_breakloop + :_loop251_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3029,18 +3071,18 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched187 as bool = false + synPredMatched188 as bool = false if ((LA(1)==NEW) and (LA(2)==ID)): - _m187 as int = mark() - synPredMatched187 = true + _m188 as int = mark() + synPredMatched188 = true ++inputState.guessing try: new_array_expression() except x as RecognitionException: - synPredMatched187 = false - rewind(_m187) + synPredMatched188 = false + rewind(_m188) --inputState.guessing - if synPredMatched187: + if synPredMatched188: e=new_array_expression() elif ((LA(1)==NEW) and (LA(2)==ID)): // line 2102 match(NEW) @@ -3102,8 +3144,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ec.Add(e); else: - goto _loop216_breakloop - :_loop216_breakloop + goto _loop217_breakloop + :_loop217_breakloop elif ((_givenValue == RPAREN) or (_givenValue ==RBRACK) ): // 1827 @@ -3542,8 +3584,8 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) slice(se) else: - goto _loop232_breakloop - :_loop232_breakloop + goto _loop233_breakloop + :_loop233_breakloop match(RBRACK) elif ((LA(1)==DOT) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 match(DOT) @@ -3559,8 +3601,8 @@ class UnityScriptParser(antlr.LLkParser): expression_list(args) match(RPAREN) else: - goto _loop235_breakloop - :_loop235_breakloop + goto _loop236_breakloop + :_loop236_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3751,8 +3793,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop246_breakloop - :_loop246_breakloop + goto _loop247_breakloop + :_loop247_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3788,8 +3830,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop254_breakloop - :_loop254_breakloop + goto _loop255_breakloop + :_loop255_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3868,8 +3910,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop266_breakloop - :_loop266_breakloop + goto _loop267_breakloop + :_loop267_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3917,8 +3959,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), op, e, r) else: - goto _loop274_breakloop - :_loop274_breakloop + goto _loop275_breakloop + :_loop275_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3944,8 +3986,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop277_breakloop - :_loop277_breakloop + goto _loop278_breakloop + :_loop278_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3971,8 +4013,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop280_breakloop - :_loop280_breakloop + goto _loop281_breakloop + :_loop281_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3998,8 +4040,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop283_breakloop - :_loop283_breakloop + goto _loop284_breakloop + :_loop284_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4026,8 +4068,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop286_breakloop - :_loop286_breakloop + goto _loop287_breakloop + :_loop287_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4054,8 +4096,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop289_breakloop - :_loop289_breakloop + goto _loop290_breakloop + :_loop290_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4103,19 +4145,19 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling lbrack = LT(1) match(LBRACK) - synPredMatched297 as bool = false + synPredMatched298 as bool = false if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_57_.member(cast(int, LA(2))))): - _m297 as int = mark() - synPredMatched297 = true + _m298 as int = mark() + synPredMatched298 = true ++inputState.guessing try: expression() match(FOR) except x as RecognitionException: - synPredMatched297 = false - rewind(_m297) + synPredMatched298 = false + rewind(_m298) --inputState.guessing - if synPredMatched297: + if synPredMatched298: projection=expression() match(FOR) match(LPAREN) @@ -4202,8 +4244,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dle.Items.Add(pair); else: - goto _loop305_breakloop - :_loop305_breakloop + goto _loop306_breakloop + :_loop306_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 @@ -4367,6 +4409,7 @@ class UnityScriptParser(antlr.LLkParser): 'catch', 'class', 'continue', + 'do', 'else', 'enum', 'extends', @@ -4479,19 +4522,19 @@ class UnityScriptParser(antlr.LLkParser): ) private static def mk_tokenSet_0_() as (long): - data = (26480360966400L, 0L, ) + data = (52960721932544L, 0L, ) return data public static final tokenSet_0_ = BitSet(mk_tokenSet_0_()) private static def mk_tokenSet_1_() as (long): - data = (18040878870448384L, 0L, ) + data = (36081757740896512L, 0L, ) return data public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) private static def mk_tokenSet_2_() as (long): - data = (-8808777125549366752L, 4294967831552L, 0L, 0L, ) + data = (829189822610818592L, 8589935663105L, 0L, 0L, ) return data public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) private static def mk_tokenSet_3_() as (long): - data = (-7494834249975239822L, 4383014125567L, 0L, 0L, ) + data = (3457075573759072114L, 8766028251135L, 0L, 0L, ) return data public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) private static def mk_tokenSet_4_() as (long): @@ -4499,219 +4542,219 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) private static def mk_tokenSet_5_() as (long): - data = (-8808759441280505054L, 4304631507968L, 0L, 0L, ) + data = (829225191148541730L, 8609263015937L, 0L, 0L, ) return data public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) private static def mk_tokenSet_6_() as (long): - data = (-7494834241385305230L, 4383014125567L, 0L, 0L, ) + data = (3457075590938941298L, 8766028251135L, 0L, 0L, ) return data public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) private static def mk_tokenSet_7_() as (long): - data = (-8808759441281553630L, 4296041573376L, 0L, 0L, ) + data = (829225191146444578L, 8592083146753L, 0L, 0L, ) return data public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) private static def mk_tokenSet_8_() as (long): - data = (18040881051486464L, 0L, ) + data = (36081762102972672L, 0L, ) return data public static final tokenSet_8_ = BitSet(mk_tokenSet_8_()) private static def mk_tokenSet_9_() as (long): - data = (26476057477120L, 0L, ) + data = (52952114954240L, 0L, ) return data public static final tokenSet_9_ = BitSet(mk_tokenSet_9_()) private static def mk_tokenSet_10_() as (long): - data = (18040874566959104L, 0L, ) + data = (36081749133918208L, 0L, ) return data public static final tokenSet_10_ = BitSet(mk_tokenSet_10_()) private static def mk_tokenSet_11_() as (long): - data = (17684267944192L, 0L, ) + data = (35368535888128L, 0L, ) return data public static final tokenSet_11_ = BitSet(mk_tokenSet_11_()) private static def mk_tokenSet_12_() as (long): - data = (18032082777426176L, 0L, ) + data = (36064165554852096L, 0L, ) return data public static final tokenSet_12_ = BitSet(mk_tokenSet_12_()) private static def mk_tokenSet_13_() as (long): - data = (-8809034961160888320L, 4294967831552L, 0L, 0L, ) + data = (828674151387774976L, 8589935663105L, 0L, 0L, ) return data public static final tokenSet_13_ = BitSet(mk_tokenSet_13_()) private static def mk_tokenSet_14_() as (long): - data = (-2323851497726402480L, 4364190088411L, 0L, 0L, ) + data = (-4647702995452805040L, 8728380176823L, 0L, 0L, ) return data public static final tokenSet_14_ = BitSet(mk_tokenSet_14_()) private static def mk_tokenSet_15_() as (long): - data = (5188146770730811392L, 0L, ) + data = (-8070450532247928832L, 0L, ) return data public static final tokenSet_15_ = BitSet(mk_tokenSet_15_()) private static def mk_tokenSet_16_() as (long): - data = (288230376151711744L, 512L, 0L, 0L, ) + data = (576460752303423488L, 1024L, 0L, 0L, ) return data public static final tokenSet_16_ = BitSet(mk_tokenSet_16_()) private static def mk_tokenSet_17_() as (long): - data = (-42953084942L, 4383014125567L, 0L, 0L, ) + data = (-85906169870L, 8766028251135L, 0L, 0L, ) return data public static final tokenSet_17_ = BitSet(mk_tokenSet_17_()) private static def mk_tokenSet_18_() as (long): - data = (18040881051486464L, 1073741824L, 0L, 0L, ) + data = (36081762102972672L, 2147483648L, 0L, 0L, ) return data public static final tokenSet_18_ = BitSet(mk_tokenSet_18_()) private static def mk_tokenSet_19_() as (long): - data = (-8232574208857464832L, 4294967831552L, 0L, 0L, ) + data = (1981595655994621952L, 8589935663105L, 0L, 0L, ) return data public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) private static def mk_tokenSet_20_() as (long): - data = (-8808759439134069982L, 4296041573376L, 0L, 0L, ) + data = (829225195441411874L, 8592083146753L, 0L, 0L, ) return data public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) private static def mk_tokenSet_21_() as (long): - data = (-844433523250318L, 4383014125567L, 0L, 0L, ) + data = (-1688867046500494L, 8766028251135L, 0L, 0L, ) return data public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) private static def mk_tokenSet_22_() as (long): - data = (-42949939214L, 4391604060159L, 0L, 0L, ) + data = (-85899878414L, 8783208120319L, 0L, 0L, ) return data public static final tokenSet_22_ = BitSet(mk_tokenSet_22_()) private static def mk_tokenSet_23_() as (long): - data = (8800396511488L, 0L, ) + data = (17600793022720L, 0L, ) return data public static final tokenSet_23_ = BitSet(mk_tokenSet_23_()) private static def mk_tokenSet_24_() as (long): - data = (-8663799828275531870L, 4296041573632L, 0L, 0L, ) + data = (1119144417158487970L, 8592083147265L, 0L, 0L, ) return data public static final tokenSet_24_ = BitSet(mk_tokenSet_24_()) private static def mk_tokenSet_25_() as (long): - data = (-8663799826126999646L, 4304631508224L, 0L, 0L, ) + data = (1119144421455552418L, 8609263016449L, 0L, 0L, ) return data public static final tokenSet_25_ = BitSet(mk_tokenSet_25_()) private static def mk_tokenSet_26_() as (long): - data = (-3149838L, 4383014125567L, 0L, 0L, ) + data = (-6299662L, 8766028251135L, 0L, 0L, ) return data public static final tokenSet_26_ = BitSet(mk_tokenSet_26_()) private static def mk_tokenSet_27_() as (long): - data = (26482542004480L, 1073741824L, 0L, 0L, ) + data = (52965084008704L, 2147483648L, 0L, 0L, ) return data public static final tokenSet_27_ = BitSet(mk_tokenSet_27_()) private static def mk_tokenSet_28_() as (long): - data = (26482542004480L, 0L, ) + data = (52965084008704L, 0L, ) return data public static final tokenSet_28_ = BitSet(mk_tokenSet_28_()) private static def mk_tokenSet_29_() as (long): - data = (18040915411486976L, 0L, ) + data = (36081830822973696L, 0L, ) return data public static final tokenSet_29_ = BitSet(mk_tokenSet_29_()) private static def mk_tokenSet_30_() as (long): - data = (18014432869499136L, 0L, ) + data = (36028865738998016L, 0L, ) return data public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) private static def mk_tokenSet_31_() as (long): - data = (-8664644251058214110L, 4296041573376L, 0L, 0L, ) + data = (1117455571593123618L, 8592083146753L, 0L, 0L, ) return data public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) private static def mk_tokenSet_32_() as (long): - data = (-8809026165067866112L, 4294967831808L, 0L, 0L, ) + data = (828691743573819392L, 8589935663617L, 0L, 0L, ) return data public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) private static def mk_tokenSet_33_() as (long): - data = (-7495109769854574512L, 4381940383743L, 0L, 0L, ) + data = (3456524534000402512L, 8763880767487L, 0L, 0L, ) return data public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) private static def mk_tokenSet_34_() as (long): - data = (-8808777125549366752L, 4294967831808L, 0L, 0L, ) + data = (829189822610818592L, 8589935663617L, 0L, 0L, ) return data public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) private static def mk_tokenSet_35_() as (long): - data = (-7510878323647713294L, 4365263830491L, 0L, 0L, ) + data = (3424987426414125042L, 8730527660983L, 0L, 0L, ) return data public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) private static def mk_tokenSet_36_() as (long): - data = (-42950987790L, 4383014125567L, 0L, 0L, ) + data = (-85901975566L, 8766028251135L, 0L, 0L, ) return data public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) private static def mk_tokenSet_37_() as (long): - data = (-8590987278L, 4383014125567L, 0L, 0L, ) + data = (-17181974542L, 8766028251135L, 0L, 0L, ) return data public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) private static def mk_tokenSet_38_() as (long): - data = (72057594037927936L, 67108864L, 0L, 0L, ) + data = (144115188075855872L, 134217728L, 0L, 0L, ) return data public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) private static def mk_tokenSet_39_() as (long): - data = (144141670617860352L, 1073741824L, 0L, 0L, ) + data = (288283341235720448L, 2147483648L, 0L, 0L, ) return data public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) private static def mk_tokenSet_40_() as (long): - data = (144115188075986944L, 1073741824L, 0L, 0L, ) + data = (288230376151973888L, 2147483648L, 0L, 0L, ) return data public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) private static def mk_tokenSet_41_() as (long): - data = (576460752303423488L, 0L, ) + data = (1152921504606846976L, 0L, ) return data public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) private static def mk_tokenSet_42_() as (long): - data = (4755801206503243776L, 0L, ) + data = (-8935141660703064064L, 0L, ) return data public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) private static def mk_tokenSet_43_() as (long): - data = (-6358801241844520158L, 4296041574144L, 0L, 0L, ) + data = (5729141590020511522L, 8592083148289L, 0L, 0L, ) return data public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) private static def mk_tokenSet_44_() as (long): - data = (-8663799826128048222L, 4296041573632L, 0L, 0L, ) + data = (1119144421453455266L, 8592083147265L, 0L, 0L, ) return data public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) private static def mk_tokenSet_45_() as (long): - data = (-8664661937473510880L, 4294967831808L, 0L, 0L, ) + data = (1117420198762530336L, 8589935663617L, 0L, 0L, ) return data public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) private static def mk_tokenSet_46_() as (long): - data = (-7493989825045073934L, 4383014125567L, 0L, 0L, ) + data = (3458764423619403762L, 8766028251135L, 0L, 0L, ) return data public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) private static def mk_tokenSet_47_() as (long): - data = (-8663799828271337566L, 4296041574144L, 0L, 0L, ) + data = (1119144417166876578L, 8592083148289L, 0L, 0L, ) return data public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) private static def mk_tokenSet_48_() as (long): - data = (-8087339075972108382L, 4296041573632L, 0L, 0L, ) + data = (2272065921765334946L, 8592083147265L, 0L, 0L, ) return data public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) private static def mk_tokenSet_49_() as (long): - data = (-8593084430L, 4383014125567L, 0L, 0L, ) + data = (-17186168846L, 8766028251135L, 0L, 0L, ) return data public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) private static def mk_tokenSet_50_() as (long): - data = (576460752303423488L, 1L, 0L, 0L, ) + data = (1152921504606846976L, 2L, 0L, 0L, ) return data public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) private static def mk_tokenSet_51_() as (long): - data = (306249172707835904L, 0L, ) + data = (612498345415671808L, 0L, ) return data public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) private static def mk_tokenSet_52_() as (long): - data = (4611686018427387904L, 1L, 0L, 0L, ) + data = (-9223372036854775808L, 2L, 0L, 0L, ) return data public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) private static def mk_tokenSet_53_() as (long): - data = (-6503191951947194368L, 4294967831552L, 0L, 0L, ) + data = (5440360169815162880L, 8589935663105L, 0L, 0L, ) return data public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) private static def mk_tokenSet_54_() as (long): - data = (18014432869482496L, 4194304L, 0L, 0L, ) + data = (36028865738964992L, 8388608L, 0L, 0L, ) return data public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) private static def mk_tokenSet_55_() as (long): - data = (20971520L, 213909504L, 0L, 0L, ) + data = (41943040L, 427819008L, 0L, 0L, ) return data public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) private static def mk_tokenSet_56_() as (long): - data = (0L, 3342336L, 0L, 0L, ) + data = (0L, 6684672L, 0L, 0L, ) return data public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) private static def mk_tokenSet_57_() as (long): - data = (-7511998268457148336L, 4364190088411L, 0L, 0L, ) + data = (3422747536795254864L, 8728380176823L, 0L, 0L, ) return data public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) private static def mk_tokenSet_58_() as (long): - data = (-8809034961160888320L, 4294967831553L, 0L, 0L, ) + data = (828674151387774976L, 8589935663107L, 0L, 0L, ) return data public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.boo b/src/UnityScript/Parser/UnityScriptTokenTypes.boo index f48eadb..73d15cf 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.boo +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.boo @@ -10,113 +10,114 @@ class UnityScriptTokenTypes: public static final CATCH = 7 public static final CLASS = 8 public static final CONTINUE = 9 - public static final ELSE = 10 - public static final ENUM = 11 - public static final EXTENDS = 12 - public static final FALSE = 13 - public static final FINAL = 14 - public static final FINALLY = 15 - public static final FOR = 16 - public static final FUNCTION = 17 - public static final GET = 18 - public static final IF = 19 - public static final IMPORT = 20 - public static final IMPLEMENTS = 21 - public static final IN = 22 - public static final INTERFACE = 23 - public static final INSTANCEOF = 24 - public static final NEW = 25 - public static final NULL = 26 - public static final RETURN = 27 - public static final PUBLIC = 28 - public static final PROTECTED = 29 - public static final INTERNAL = 30 - public static final OVERRIDE = 31 - public static final PARTIAL = 32 - public static final PRAGMA = 33 - public static final PRIVATE = 34 - public static final SET = 35 - public static final STATIC = 36 - public static final SUPER = 37 - public static final THIS = 38 - public static final THROW = 39 - public static final TRUE = 40 - public static final TRY = 41 - public static final TYPEOF = 42 - public static final VAR = 43 - public static final VIRTUAL = 44 - public static final WHILE = 45 - public static final YIELD = 46 - public static final SWITCH = 47 - public static final CASE = 48 - public static final DEFAULT = 49 - public static final INPLACE_DIVISION = 50 - public static final INPLACE_ADD = 51 - public static final INPLACE_SUBTRACT = 52 - public static final INPLACE_MULTIPLY = 53 - public static final ID = 54 - public static final DOUBLE_QUOTED_STRING = 55 - public static final LBRACE = 56 - public static final RBRACE = 57 - public static final LPAREN = 58 - public static final RPAREN = 59 - public static final DOT = 60 - public static final COLON = 61 - public static final COMMA = 62 - public static final LBRACK = 63 - public static final RBRACK = 64 - public static final BITWISE_OR = 65 - public static final INPLACE_BITWISE_OR = 66 - public static final BITWISE_AND = 67 - public static final BITWISE_XOR = 68 - public static final INPLACE_BITWISE_AND = 69 - public static final LOGICAL_OR = 70 - public static final LOGICAL_AND = 71 - public static final EOS = 72 - public static final ASSIGN = 73 - public static final INCREMENT = 74 - public static final DECREMENT = 75 - public static final ADD = 76 - public static final SUBTRACT = 77 - public static final MODULUS = 78 - public static final MULTIPLY = 79 - public static final EQUALITY = 80 - public static final INEQUALITY = 81 - public static final QUESTION_MARK = 82 - public static final BITWISE_NOT = 83 - public static final REFERENCE_EQUALITY = 84 - public static final REFERENCE_INEQUALITY = 85 - public static final LESS_THAN = 86 - public static final LESS_THAN_OR_EQUAL = 87 - public static final SHIFT_LEFT = 88 - public static final INPLACE_SHIFT_LEFT = 89 - public static final GREATER_THAN = 90 - public static final GREATER_THAN_OR_EQUAL = 91 - public static final SHIFT_RIGHT = 92 - public static final INPLACE_SHIFT_RIGHT = 93 - public static final AT = 94 - public static final SCRIPT_ATTRIBUTE_MARKER = 95 - public static final ASSEMBLY_ATTRIBUTE_MARKER = 96 - public static final HASH = 97 - public static final INPLACE_BITWISE_XOR = 98 - public static final NOT = 99 - public static final DIVISION = 100 - public static final RE_LITERAL = 101 - public static final DOUBLE = 102 - public static final INT = 103 - public static final LONG = 104 - public static final SINGLE_QUOTED_STRING = 105 - public static final DOUBLE_SUFFIX = 106 - public static final EXPONENT = 107 - public static final WHITE_SPACE = 108 - public static final DQS_ESC = 109 - public static final SQS_ESC = 110 - public static final SESC = 111 - public static final ML_COMMENT = 112 - public static final RE_CHAR = 113 - public static final RE_ESC = 114 - public static final NEWLINE = 115 - public static final ID_LETTER = 116 - public static final DIGIT = 117 - public static final HEXDIGIT = 118 + public static final DO = 10 + public static final ELSE = 11 + public static final ENUM = 12 + public static final EXTENDS = 13 + public static final FALSE = 14 + public static final FINAL = 15 + public static final FINALLY = 16 + public static final FOR = 17 + public static final FUNCTION = 18 + public static final GET = 19 + public static final IF = 20 + public static final IMPORT = 21 + public static final IMPLEMENTS = 22 + public static final IN = 23 + public static final INTERFACE = 24 + public static final INSTANCEOF = 25 + public static final NEW = 26 + public static final NULL = 27 + public static final RETURN = 28 + public static final PUBLIC = 29 + public static final PROTECTED = 30 + public static final INTERNAL = 31 + public static final OVERRIDE = 32 + public static final PARTIAL = 33 + public static final PRAGMA = 34 + public static final PRIVATE = 35 + public static final SET = 36 + public static final STATIC = 37 + public static final SUPER = 38 + public static final THIS = 39 + public static final THROW = 40 + public static final TRUE = 41 + public static final TRY = 42 + public static final TYPEOF = 43 + public static final VAR = 44 + public static final VIRTUAL = 45 + public static final WHILE = 46 + public static final YIELD = 47 + public static final SWITCH = 48 + public static final CASE = 49 + public static final DEFAULT = 50 + public static final INPLACE_DIVISION = 51 + public static final INPLACE_ADD = 52 + public static final INPLACE_SUBTRACT = 53 + public static final INPLACE_MULTIPLY = 54 + public static final ID = 55 + public static final DOUBLE_QUOTED_STRING = 56 + public static final LBRACE = 57 + public static final RBRACE = 58 + public static final LPAREN = 59 + public static final RPAREN = 60 + public static final DOT = 61 + public static final COLON = 62 + public static final COMMA = 63 + public static final LBRACK = 64 + public static final RBRACK = 65 + public static final BITWISE_OR = 66 + public static final INPLACE_BITWISE_OR = 67 + public static final BITWISE_AND = 68 + public static final BITWISE_XOR = 69 + public static final INPLACE_BITWISE_AND = 70 + public static final LOGICAL_OR = 71 + public static final LOGICAL_AND = 72 + public static final EOS = 73 + public static final ASSIGN = 74 + public static final INCREMENT = 75 + public static final DECREMENT = 76 + public static final ADD = 77 + public static final SUBTRACT = 78 + public static final MODULUS = 79 + public static final MULTIPLY = 80 + public static final EQUALITY = 81 + public static final INEQUALITY = 82 + public static final QUESTION_MARK = 83 + public static final BITWISE_NOT = 84 + public static final REFERENCE_EQUALITY = 85 + public static final REFERENCE_INEQUALITY = 86 + public static final LESS_THAN = 87 + public static final LESS_THAN_OR_EQUAL = 88 + public static final SHIFT_LEFT = 89 + public static final INPLACE_SHIFT_LEFT = 90 + public static final GREATER_THAN = 91 + public static final GREATER_THAN_OR_EQUAL = 92 + public static final SHIFT_RIGHT = 93 + public static final INPLACE_SHIFT_RIGHT = 94 + public static final AT = 95 + public static final SCRIPT_ATTRIBUTE_MARKER = 96 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 97 + public static final HASH = 98 + public static final INPLACE_BITWISE_XOR = 99 + public static final NOT = 100 + public static final DIVISION = 101 + public static final RE_LITERAL = 102 + public static final DOUBLE = 103 + public static final INT = 104 + public static final LONG = 105 + public static final SINGLE_QUOTED_STRING = 106 + public static final DOUBLE_SUFFIX = 107 + public static final EXPONENT = 108 + public static final WHITE_SPACE = 109 + public static final DQS_ESC = 110 + public static final SQS_ESC = 111 + public static final SESC = 112 + public static final ML_COMMENT = 113 + public static final RE_CHAR = 114 + public static final RE_ESC = 115 + public static final NEWLINE = 116 + public static final ID_LETTER = 117 + public static final DIGIT = 118 + public static final HEXDIGIT = 119 diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.txt b/src/UnityScript/Parser/UnityScriptTokenTypes.txt index afcba27..873e15f 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.txt +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.txt @@ -6,112 +6,113 @@ CAST="cast"=6 CATCH="catch"=7 CLASS="class"=8 CONTINUE="continue"=9 -ELSE="else"=10 -ENUM="enum"=11 -EXTENDS="extends"=12 -FALSE="false"=13 -FINAL="final"=14 -FINALLY="finally"=15 -FOR="for"=16 -FUNCTION="function"=17 -GET="get"=18 -IF="if"=19 -IMPORT="import"=20 -IMPLEMENTS="implements"=21 -IN="in"=22 -INTERFACE="interface"=23 -INSTANCEOF="instanceof"=24 -NEW="new"=25 -NULL="null"=26 -RETURN="return"=27 -PUBLIC="public"=28 -PROTECTED="protected"=29 -INTERNAL="internal"=30 -OVERRIDE="override"=31 -PARTIAL="partial"=32 -PRAGMA="pragma"=33 -PRIVATE="private"=34 -SET="set"=35 -STATIC="static"=36 -SUPER="super"=37 -THIS="this"=38 -THROW="throw"=39 -TRUE="true"=40 -TRY="try"=41 -TYPEOF="typeof"=42 -VAR="var"=43 -VIRTUAL="virtual"=44 -WHILE="while"=45 -YIELD="yield"=46 -SWITCH="switch"=47 -CASE="case"=48 -DEFAULT="default"=49 -INPLACE_DIVISION="/="=50 -INPLACE_ADD="+="=51 -INPLACE_SUBTRACT="-="=52 -INPLACE_MULTIPLY="*="=53 -ID="an identifier"=54 -DOUBLE_QUOTED_STRING="a string"=55 -LBRACE="{"=56 -RBRACE="}"=57 -LPAREN="("=58 -RPAREN=")"=59 -DOT="."=60 -COLON=":"=61 -COMMA=","=62 -LBRACK="["=63 -RBRACK="]"=64 -BITWISE_OR="|"=65 -INPLACE_BITWISE_OR="|="=66 -BITWISE_AND="&"=67 -BITWISE_XOR="^"=68 -INPLACE_BITWISE_AND="&="=69 -LOGICAL_OR="||"=70 -LOGICAL_AND="&&"=71 -EOS=";"=72 -ASSIGN="="=73 -INCREMENT="++"=74 -DECREMENT="--"=75 -ADD="+"=76 -SUBTRACT="-"=77 -MODULUS="%"=78 -MULTIPLY="*"=79 -EQUALITY="=="=80 -INEQUALITY="!="=81 -QUESTION_MARK="?"=82 -BITWISE_NOT="~"=83 -REFERENCE_EQUALITY="==="=84 -REFERENCE_INEQUALITY="!=="=85 -LESS_THAN="<"=86 -LESS_THAN_OR_EQUAL="<="=87 -SHIFT_LEFT="<<"=88 -INPLACE_SHIFT_LEFT="<<="=89 -GREATER_THAN=">"=90 -GREATER_THAN_OR_EQUAL=">="=91 -SHIFT_RIGHT=">>"=92 -INPLACE_SHIFT_RIGHT=">>="=93 -AT="@"=94 -SCRIPT_ATTRIBUTE_MARKER="@script"=95 -ASSEMBLY_ATTRIBUTE_MARKER="@assembly"=96 -HASH=97 -INPLACE_BITWISE_XOR=98 -NOT=99 -DIVISION=100 -RE_LITERAL=101 -DOUBLE=102 -INT=103 -LONG=104 -SINGLE_QUOTED_STRING=105 -DOUBLE_SUFFIX=106 -EXPONENT=107 -WHITE_SPACE=108 -DQS_ESC=109 -SQS_ESC=110 -SESC=111 -ML_COMMENT=112 -RE_CHAR=113 -RE_ESC=114 -NEWLINE=115 -ID_LETTER=116 -DIGIT=117 -HEXDIGIT=118 +DO="do"=10 +ELSE="else"=11 +ENUM="enum"=12 +EXTENDS="extends"=13 +FALSE="false"=14 +FINAL="final"=15 +FINALLY="finally"=16 +FOR="for"=17 +FUNCTION="function"=18 +GET="get"=19 +IF="if"=20 +IMPORT="import"=21 +IMPLEMENTS="implements"=22 +IN="in"=23 +INTERFACE="interface"=24 +INSTANCEOF="instanceof"=25 +NEW="new"=26 +NULL="null"=27 +RETURN="return"=28 +PUBLIC="public"=29 +PROTECTED="protected"=30 +INTERNAL="internal"=31 +OVERRIDE="override"=32 +PARTIAL="partial"=33 +PRAGMA="pragma"=34 +PRIVATE="private"=35 +SET="set"=36 +STATIC="static"=37 +SUPER="super"=38 +THIS="this"=39 +THROW="throw"=40 +TRUE="true"=41 +TRY="try"=42 +TYPEOF="typeof"=43 +VAR="var"=44 +VIRTUAL="virtual"=45 +WHILE="while"=46 +YIELD="yield"=47 +SWITCH="switch"=48 +CASE="case"=49 +DEFAULT="default"=50 +INPLACE_DIVISION="/="=51 +INPLACE_ADD="+="=52 +INPLACE_SUBTRACT="-="=53 +INPLACE_MULTIPLY="*="=54 +ID="an identifier"=55 +DOUBLE_QUOTED_STRING="a string"=56 +LBRACE="{"=57 +RBRACE="}"=58 +LPAREN="("=59 +RPAREN=")"=60 +DOT="."=61 +COLON=":"=62 +COMMA=","=63 +LBRACK="["=64 +RBRACK="]"=65 +BITWISE_OR="|"=66 +INPLACE_BITWISE_OR="|="=67 +BITWISE_AND="&"=68 +BITWISE_XOR="^"=69 +INPLACE_BITWISE_AND="&="=70 +LOGICAL_OR="||"=71 +LOGICAL_AND="&&"=72 +EOS=";"=73 +ASSIGN="="=74 +INCREMENT="++"=75 +DECREMENT="--"=76 +ADD="+"=77 +SUBTRACT="-"=78 +MODULUS="%"=79 +MULTIPLY="*"=80 +EQUALITY="=="=81 +INEQUALITY="!="=82 +QUESTION_MARK="?"=83 +BITWISE_NOT="~"=84 +REFERENCE_EQUALITY="==="=85 +REFERENCE_INEQUALITY="!=="=86 +LESS_THAN="<"=87 +LESS_THAN_OR_EQUAL="<="=88 +SHIFT_LEFT="<<"=89 +INPLACE_SHIFT_LEFT="<<="=90 +GREATER_THAN=">"=91 +GREATER_THAN_OR_EQUAL=">="=92 +SHIFT_RIGHT=">>"=93 +INPLACE_SHIFT_RIGHT=">>="=94 +AT="@"=95 +SCRIPT_ATTRIBUTE_MARKER="@script"=96 +ASSEMBLY_ATTRIBUTE_MARKER="@assembly"=97 +HASH=98 +INPLACE_BITWISE_XOR=99 +NOT=100 +DIVISION=101 +RE_LITERAL=102 +DOUBLE=103 +INT=104 +LONG=105 +SINGLE_QUOTED_STRING=106 +DOUBLE_SUFFIX=107 +EXPONENT=108 +WHITE_SPACE=109 +DQS_ESC=110 +SQS_ESC=111 +SESC=112 +ML_COMMENT=113 +RE_CHAR=114 +RE_ESC=115 +NEWLINE=116 +ID_LETTER=117 +DIGIT=118 +HEXDIGIT=119 diff --git a/src/UnityScript/UnityScript.booproj b/src/UnityScript/UnityScript.booproj index 2bae74c..0161e94 100755 --- a/src/UnityScript/UnityScript.booproj +++ b/src/UnityScript/UnityScript.booproj @@ -20,6 +20,7 @@ false false + false none @@ -28,6 +29,7 @@ false false + false diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index ee68337..b20011c 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -29,6 +29,7 @@ tokens CATCH="catch"; CLASS="class"; CONTINUE="continue"; + DO="do"; ELSE="else"; ENUM="enum"; EXTENDS="extends"; @@ -368,6 +369,7 @@ global_statement[Module m] b = m.Globals }: ( + do_while_statement[b] | while_statement[b] | for_statement[b] | if_statement[b] | @@ -710,7 +712,7 @@ statement[Block b] { }: ( - + do_while_statement[b] | while_statement[b] | for_statement[b] | if_statement[b] | @@ -908,6 +910,24 @@ while_statement[Block container] } ; +do_while_statement[Block container] +{ +}: + d:DO + { + ws = WhileStatement(ToLexicalInfo(d), Condition: BoolLiteralExpression(true)) + b = ws.Block + container.Add(ws) + EnterLoop(ws) + } + block[b] + w:WHILE e=paren_expression eos + { + b.Add(BreakStatement(ToLexicalInfo(w), Modifier: StatementModifier(StatementModifierType.If, e))) + LeaveLoop(ws) + } +; + switch_statement[Block container] { }: diff --git a/tests/error-messages/do-while-const-condition.js b/tests/error-messages/do-while-const-condition.js new file mode 100644 index 0000000..4b00ddd --- /dev/null +++ b/tests/error-messages/do-while-const-condition.js @@ -0,0 +1,9 @@ +/* +do-while-const-condition.js(9,10): BCW0022: WARNING: Boolean expression will always have the same value. +*/ +var i = 0; +do { + print(i); +} while (++i < 2); +do { +} while (true); diff --git a/tests/parser/do-while-1.js b/tests/parser/do-while-1.js new file mode 100644 index 0000000..ef4a34e --- /dev/null +++ b/tests/parser/do-while-1.js @@ -0,0 +1,11 @@ +/* +i = 0 + +while true: + print(i) + break if ((++i) < 2) +*/ +var i = 0; +do { + print(i); +} while (++i < 2); From 4d7fe18a91a7d3fa9de39e3e1e8c811aa36cea63 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 11 Jan 2011 15:04:15 -0200 Subject: [PATCH 119/276] global_statement rule no longer needed --- src/UnityScript/Parser/UnityScriptLexer.boo | 102 +- src/UnityScript/Parser/UnityScriptParser.boo | 1775 ++++++++---------- src/UnityScript/UnityScript.g | 29 +- 3 files changed, 884 insertions(+), 1022 deletions(-) diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index 0f1b935..880582d 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -588,8 +588,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mDIGIT(false) else: // line 1969 - goto _loop319_breakloop - :_loop319_breakloop + goto _loop315_breakloop + :_loop315_breakloop _ttype = testLiteralsTable(_ttype) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -682,17 +682,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): match("0x") - _cnt323 as int = 0 + _cnt319 as int = 0 while true: if ((tokenSet_0_.member(cast(int, cached_LA1)))): mHEXDIGIT(false) else: - if (_cnt323 >= 1): - goto _loop323_breakloop + if (_cnt319 >= 1): + goto _loop319_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt323 - :_loop323_breakloop + ++_cnt319 + :_loop319_breakloop if ((cached_LA1==char('L') or cached_LA1==char('l'))): _givenValue = cached_LA1 if ((_givenValue == char('l'))): // 1831 @@ -706,17 +706,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): else: // line 2053 pass // 947 elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt327 as int = 0 + _cnt323 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt327 >= 1): - goto _loop327_breakloop + if (_cnt323 >= 1): + goto _loop323_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt327 - :_loop327_breakloop + ++_cnt323 + :_loop323_breakloop _givenValue = cached_LA1 if ((_givenValue == char('L')) or (_givenValue ==char('l')) @@ -812,17 +812,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_SUFFIX - _cnt336 as int = 0 + _cnt332 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt336 >= 1): - goto _loop336_breakloop + if (_cnt332 >= 1): + goto _loop332_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt336 - :_loop336_breakloop + ++_cnt332 + :_loop332_breakloop if ((cached_LA1==char('E') or cached_LA1==char('e'))): mEXPONENT(false) else: // line 2053 @@ -873,17 +873,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt343 as int = 0 + _cnt339 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt343 >= 1): - goto _loop343_breakloop + if (_cnt339 >= 1): + goto _loop339_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt343 - :_loop343_breakloop + ++_cnt339 + :_loop339_breakloop if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1349,18 +1349,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched390 as bool = false + synPredMatched386 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m390 as int = mark() - synPredMatched390 = true + _m386 as int = mark() + synPredMatched386 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched390 = false - rewind(_m390) + synPredMatched386 = false + rewind(_m386) --inputState.guessing - if synPredMatched390: + if synPredMatched386: mML_COMMENT(false) if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1373,8 +1373,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop395_breakloop - :_loop395_breakloop + goto _loop391_breakloop + :_loop391_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; elif ((_givenValue == char('='))): // 1831 @@ -1403,8 +1403,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop424_breakloop - :_loop424_breakloop + goto _loop420_breakloop + :_loop420_breakloop match("*/") if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1417,7 +1417,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt399 as int = 0 + _cnt395 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1431,12 +1431,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt399 >= 1): - goto _loop399_breakloop + if (_cnt395 >= 1): + goto _loop395_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt399 - :_loop399_breakloop + ++_cnt395 + :_loop395_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1479,8 +1479,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop403_breakloop - :_loop403_breakloop + goto _loop399_breakloop + :_loop399_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1529,8 +1529,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_4_) else: - goto _loop407_breakloop - :_loop407_breakloop + goto _loop403_breakloop + :_loop403_breakloop _saveIndex = text.Length match('\'') text.Length = _saveIndex @@ -1631,17 +1631,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt427 as int = 0 + _cnt423 as int = 0 while true: if ((tokenSet_5_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt427 >= 1): - goto _loop427_breakloop + if (_cnt423 >= 1): + goto _loop423_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt427 - :_loop427_breakloop + ++_cnt423 + :_loop423_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1699,17 +1699,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt433 as int = 0 + _cnt429 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt433 >= 1): - goto _loop433_breakloop + if (_cnt429 >= 1): + goto _loop429_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt433 - :_loop433_breakloop + ++_cnt429 + :_loop429_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 1ddae16..289200f 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -283,6 +283,7 @@ class UnityScriptParser(antlr.LLkParser): module = Module(LexicalInfo(getFilename(), 1, 1)) module.Name = CreateModuleName(getFilename()) cu.Modules.Add(module) + globals = module.Globals try: // for error handling while true: @@ -316,7 +317,7 @@ class UnityScriptParser(antlr.LLkParser): elif ((tokenSet_0_.member(cast(int, LA(1)))) and (tokenSet_1_.member(cast(int, LA(2))))): // line 2102 module_member(module) elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_3_.member(cast(int, LA(2))))): // line 2102 - global_statement(module) + statement(globals) else: goto _loop8_breakloop :_loop8_breakloop @@ -485,11 +486,10 @@ class UnityScriptParser(antlr.LLkParser): else: raise - public def global_statement( - m as Module + public def statement( + b as Block ) as void: //throws RecognitionException, TokenStreamException - b = m.Globals try: // for error handling _givenValue = LA(1) @@ -586,12 +586,24 @@ class UnityScriptParser(antlr.LLkParser): else: // line 1969 raise NoViableAltException(LT(1), getFilename()) eos() + elif ((_givenValue == EOS)): // 1831 + _cnt109 as int = 0 + while true: + if ((LA(1)==EOS) and (tokenSet_13_.member(cast(int, LA(2))))): + match(EOS) + else: + if (_cnt109 >= 1): + goto _loop109_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) + ++_cnt109 + :_loop109_breakloop else: // line 1969 raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_7_) + recover(ex,tokenSet_13_) else: raise @@ -619,7 +631,7 @@ class UnityScriptParser(antlr.LLkParser): value=expression() if 0 == inputState.guessing: attr.NamedArguments.Add(ExpressionPair(name, value)) - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_15_.member(cast(int, LA(2))))): // line 2102 value=expression() if 0 == inputState.guessing: attr.Arguments.Add(value) @@ -628,7 +640,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_16_) else: raise @@ -643,12 +655,12 @@ class UnityScriptParser(antlr.LLkParser): match(DOT) e=member_reference_expression(e) else: - goto _loop199_breakloop - :_loop199_breakloop + goto _loop195_breakloop + :_loop195_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_17_) else: raise return e @@ -662,7 +674,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -678,7 +690,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_19_) else: raise @@ -690,7 +702,7 @@ class UnityScriptParser(antlr.LLkParser): name=qname() if 0 == inputState.guessing: attr = Ast.Attribute(ToLexicalInfo(name), name.getText()) - if ((LA(1)==LPAREN) and (tokenSet_19_.member(cast(int, LA(2))))): + if ((LA(1)==LPAREN) and (tokenSet_20_.member(cast(int, LA(2))))): match(LPAREN) _givenValue = LA(1) if ((_givenValue == FALSE) @@ -730,14 +742,14 @@ class UnityScriptParser(antlr.LLkParser): else: // line 1969 raise NoViableAltException(LT(1), getFilename()) match(RPAREN) - elif ((tokenSet_20_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_21_.member(cast(int, LA(1)))) and (tokenSet_22_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_20_) + recover(ex,tokenSet_21_) else: raise return attr @@ -764,14 +776,14 @@ class UnityScriptParser(antlr.LLkParser): buffer.Append(".") buffer.Append(other.getText()) else: - goto _loop38_breakloop - :_loop38_breakloop + goto _loop34_breakloop + :_loop34_breakloop if 0 == inputState.guessing: id.setText(buffer.ToString()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_22_) + recover(ex,tokenSet_23_) else: raise return id @@ -815,12 +827,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: VirtualKeywordHasNoEffect(v) else: // line 1969 - goto _loop48_breakloop - :_loop48_breakloop + goto _loop44_breakloop + :_loop44_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_23_) + recover(ex,tokenSet_24_) else: raise return m @@ -918,7 +930,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_13_) else: raise @@ -927,17 +939,17 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling if ((LA(1)==EOS) and (tokenSet_25_.member(cast(int, LA(2))))): - _cnt45 as int = 0 + _cnt41 as int = 0 while true: if ((LA(1)==EOS) and (tokenSet_25_.member(cast(int, LA(2))))): match(EOS) else: - if (_cnt45 >= 1): - goto _loop45_breakloop + if (_cnt41 >= 1): + goto _loop41_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt45 - :_loop45_breakloop + ++_cnt41 + :_loop41_breakloop elif ((tokenSet_25_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: SemicolonExpected() @@ -1032,7 +1044,7 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) if ((tokenSet_28_.member(cast(int, LA(1)))) and (tokenSet_29_.member(cast(int, LA(2))))): mod=member_modifiers() - elif ((tokenSet_23_.member(cast(int, LA(1)))) and (tokenSet_30_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_30_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1054,18 +1066,18 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: m.Modifiers |= mod if m is not null else: - goto _loop60_breakloop - :_loop60_breakloop + goto _loop56_breakloop + :_loop56_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: SetEndSourceLocation(cd, rbrace) while true: - if ((LA(1)==EOS)): + if ((LA(1)==EOS) and (tokenSet_31_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop62_breakloop - :_loop62_breakloop + goto _loop58_breakloop + :_loop58_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1111,18 +1123,18 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) interface_member(td) else: - goto _loop67_breakloop - :_loop67_breakloop + goto _loop63_breakloop + :_loop63_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: SetEndSourceLocation(td, rbrace) while true: - if ((LA(1)==EOS)): + if ((LA(1)==EOS) and (tokenSet_31_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop69_breakloop - :_loop69_breakloop + goto _loop65_breakloop + :_loop65_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1158,8 +1170,8 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) enum_member(ed) else: - goto _loop78_breakloop - :_loop78_breakloop + goto _loop74_breakloop + :_loop74_breakloop _givenValue = LA(1) if ((_givenValue == COMMA)): // 1831 match(COMMA) @@ -1176,11 +1188,11 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: SetEndSourceLocation(ed, rbrace) while true: - if ((LA(1)==EOS)): + if ((LA(1)==EOS) and (tokenSet_31_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop81_breakloop - :_loop81_breakloop + goto _loop77_breakloop + :_loop77_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1394,987 +1406,866 @@ class UnityScriptParser(antlr.LLkParser): raise return member - public def do_while_statement( - container as Block - ) as void: //throws RecognitionException, TokenStreamException + public def member_modifiers() as TypeMemberModifiers : //throws RecognitionException, TokenStreamException + m as TypeMemberModifiers - d as IToken = null - w as IToken = null + v as IToken = null + m = TypeMemberModifiers.None try: // for error handling - d = LT(1) - match(DO) - if 0 == inputState.guessing: - ws = WhileStatement(ToLexicalInfo(d), Condition: BoolLiteralExpression(true)) - b = ws.Block - container.Add(ws) - EnterLoop(ws) - block(b) - w = LT(1) - match(WHILE) - e=paren_expression() - eos() - if 0 == inputState.guessing: - b.Add(BreakStatement(ToLexicalInfo(w), Modifier: StatementModifier(StatementModifierType.If, e))) - LeaveLoop(ws) + while true: + _givenValue = LA(1) + if ((_givenValue == FINAL)): // 1831 + match(FINAL) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Final + elif ((_givenValue == OVERRIDE)): // 1831 + match(OVERRIDE) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Override + elif ((_givenValue == PUBLIC)): // 1831 + match(PUBLIC) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Public + elif ((_givenValue == PRIVATE)): // 1831 + match(PRIVATE) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Private + elif ((_givenValue == PROTECTED)): // 1831 + match(PROTECTED) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Protected + elif ((_givenValue == INTERNAL)): // 1831 + match(INTERNAL) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Internal + elif ((_givenValue == STATIC)): // 1831 + match(STATIC) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Static + elif ((_givenValue == NEW)): // 1831 + match(NEW) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.New + elif ((_givenValue == VIRTUAL)): // 1831 + v = LT(1) + match(VIRTUAL) + if 0 == inputState.guessing: + VirtualKeywordHasNoEffect(v) + else: // line 1969 + goto _loop47_breakloop + :_loop47_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) recover(ex,tokenSet_24_) else: raise + return m - public def while_statement( - container as Block - ) as void: //throws RecognitionException, TokenStreamException + public def type_reference() as TypeReference : //throws RecognitionException, TokenStreamException + tr as TypeReference - w as IToken = null + lbrack as IToken = null + rank = 1 try: // for error handling - w = LT(1) - match(WHILE) - e=paren_expression() - if 0 == inputState.guessing: - ws = WhileStatement(ToLexicalInfo(w), Condition: e) - b = ws.Block - container.Add(ws) - EnterLoop(ws) - compound_or_single_stmt(b) - if 0 == inputState.guessing: - LeaveLoop(ws) + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + tr=simple_type_reference() + elif ((_givenValue == FUNCTION)): // 1831 + tr=anonymous_function_type() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if ((LA(1)==LBRACK) and (LA(2)==COMMA or LA(2)==RBRACK)): + lbrack = LT(1) + match(LBRACK) + while true: + if ((LA(1)==COMMA)): + match(COMMA) + if 0 == inputState.guessing: + ++rank + else: + goto _loop164_breakloop + :_loop164_breakloop + match(RBRACK) + if 0 == inputState.guessing: + tr = ArrayTypeReference(tr.LexicalInfo, tr, IntegerLiteralExpression(ToLexicalInfo(lbrack), rank)) + elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_33_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_32_) else: raise + return tr - public def for_statement( - container as Block + public def type_reference_list( + typeReferences as TypeReferenceCollection ) as void: //throws RecognitionException, TokenStreamException - f as IToken = null try: // for error handling - f = LT(1) - match(FOR) - match(LPAREN) - synPredMatched129 as bool = false - if ((LA(1)==VAR or LA(1)==ID) and (LA(2)==IN or LA(2)==ID)): - _m129 as int = mark() - synPredMatched129 = true - ++inputState.guessing - try: - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - match(ID) - elif ((_givenValue == VAR)): // 1831 - declaration() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(IN) - except x as RecognitionException: - synPredMatched129 = false - rewind(_m129) - --inputState.guessing - if synPredMatched129: - stmt=for_in(container) - elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_33_.member(cast(int, LA(2))))): // line 2102 - stmt=for_c(container) - else: - raise NoViableAltException(LT(1), getFilename()) + tr=type_reference() if 0 == inputState.guessing: - stmt.LexicalInfo = ToLexicalInfo(f) if stmt is not null + typeReferences.Add(tr) + while true: + if ((LA(1)==COMMA)): + match(COMMA) + tr=type_reference() + if 0 == inputState.guessing: + typeReferences.Add(tr) + else: + goto _loop180_breakloop + :_loop180_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_34_) else: raise - public def if_statement( - container as Block - ) as void: //throws RecognitionException, TokenStreamException + public def function_member( + cd as ClassDefinition + ) as TypeMember : //throws RecognitionException, TokenStreamException + member as TypeMember - it as IToken = null - et as IToken = null + getter as IToken = null + setter as IToken = null try: // for error handling - it = LT(1) - match(IF) - e=paren_expression() - if 0 == inputState.guessing: - s = IfStatement(ToLexicalInfo(it), Condition: e) - b = s.TrueBlock = Block() - container.Add(s) - compound_or_single_stmt(b) - if ((LA(1)==ELSE) and (tokenSet_34_.member(cast(int, LA(2))))): - et = LT(1) - match(ELSE) - if 0 == inputState.guessing: - b = s.FalseBlock = Block(ToLexicalInfo(et)) - compound_or_single_stmt(b) - elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + match(FUNCTION) + _givenValue = LA(1) + if ((_givenValue == GET)): // 1831 + getter = LT(1) + match(GET) + elif ((_givenValue == SET)): // 1831 + setter = LT(1) + match(SET) + elif ((_givenValue == FINAL) + or (_givenValue ==ID) + ): // 1827 pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + memberName=member_name() + if 0 == inputState.guessing: + method as Method + if memberName.getText() == cd.Name: + member = method = Constructor(ToLexicalInfo(memberName)) + else: + member = method = Method(ToLexicalInfo(memberName), Name: memberName.getText()) + if getter is not null or setter is not null: + p = cd.Members[memberName.getText()] as Property + if p is null: + p = Property(ToLexicalInfo(memberName), Name: memberName.getText()) + cd.Members.Add(p) + if getter is not null: + p.Getter = method + else: + p.Setter = method + FlushAttributes(p) + else: + cd.Members.Add(method) + FlushAttributes(method) + function_body(method) + if 0 == inputState.guessing: + // TODO: move this error checking to a compiler step + // as well as properly checking the type of the accessors + // against the type of the property + if setter is not null: + if method.Parameters.Count != 1 or method.Parameters[0].Name != "value": + ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(ToLexicalInfo(memberName))) + method.Parameters.Clear() + if getter is not null: + if method.Parameters.Count > 0: + ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(ToLexicalInfo(memberName))) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_35_) else: raise + return member - public def try_statement( - container as Block + public def interface_member( + parent as TypeDefinition ) as void: //throws RecognitionException, TokenStreamException - tt as IToken = null - ct as IToken = null - id as IToken = null + name as IToken = null try: // for error handling - tt = LT(1) - match(TRY) + match(FUNCTION) + name = LT(1) + match(ID) if 0 == inputState.guessing: - s = TryStatement(ToLexicalInfo(tt)) - b = s.ProtectedBlock - container.Add(s) - compound_or_single_stmt(b) - while true: - if ((LA(1)==CATCH) and (LA(2)==LPAREN)): - ct = LT(1) - match(CATCH) - match(LPAREN) - id = LT(1) - match(ID) - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RPAREN) - if 0 == inputState.guessing: - tr = SimpleTypeReference(ToLexicalInfo(id), "System.Exception") if tr is null - handler = ExceptionHandler( - ToLexicalInfo(ct), - Declaration: Declaration(ToLexicalInfo(id), Name: id.getText(), Type: tr)) - s.ExceptionHandlers.Add(handler) - b = handler.Block - tr = null - compound_or_single_stmt(b) - else: - goto _loop156_breakloop - :_loop156_breakloop - if ((LA(1)==FINALLY) and (tokenSet_34_.member(cast(int, LA(2))))): - finally_block(s) - elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + method = Method(ToLexicalInfo(name), Name: name.getText()) + FlushAttributes(method) + parent.Members.Add(method) + match(LPAREN) + _givenValue = LA(1) + if ((_givenValue == ID) + or (_givenValue ==AT) + ): // 1827 + parameter_declaration_list(method) + elif ((_givenValue == RPAREN)): // 1831 pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_24_) - else: - raise - - public def switch_statement( - container as Block - ) as void: //throws RecognitionException, TokenStreamException - - s as IToken = null - c as IToken = null - fallthrough as IToken = null - d as IToken = null - - try: // for error handling - s = LT(1) - match(SWITCH) - e=paren_expression() - if 0 == inputState.guessing: - switchMacro = MacroStatement(ToLexicalInfo(s), Name: MacroName(s.getText())) - switchMacro.Arguments.Add(e) - switchBlock = switchMacro.Body - container.Add(switchMacro) - match(LBRACE) - while true: - if ((LA(1)==CASE)): - c = LT(1) - match(CASE) - e=expression() - match(COLON) - if 0 == inputState.guessing: - item = MacroStatement(ToLexicalInfo(c), Name: c.getText()) - item.Arguments.Add(e) - itemBlock = item.Body - switchBlock.Add(item) - while true: - if ((LA(1)==CASE)): - fallthrough = LT(1) - match(CASE) - e=expression() - match(COLON) - if 0 == inputState.guessing: - item.Arguments.Add(e); - else: - goto _loop144_breakloop - :_loop144_breakloop - _cnt146 as int = 0 - while true: - if ((tokenSet_34_.member(cast(int, LA(1))))): - statement(itemBlock) - else: - if (_cnt146 >= 1): - goto _loop146_breakloop - else: - raise NoViableAltException(LT(1), getFilename()) - ++_cnt146 - :_loop146_breakloop - else: - goto _loop147_breakloop - :_loop147_breakloop + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RPAREN) _givenValue = LA(1) - if ((_givenValue == DEFAULT)): // 1831 - d = LT(1) - match(DEFAULT) + if ((_givenValue == COLON)): // 1831 match(COLON) + tr=type_reference() if 0 == inputState.guessing: - item = MacroStatement(ToLexicalInfo(d), Name: d.getText()) - itemBlock = item.Body - switchBlock.Add(item) - _cnt150 as int = 0 - while true: - if ((tokenSet_34_.member(cast(int, LA(1))))): - statement(itemBlock) - else: - if (_cnt150 >= 1): - goto _loop150_breakloop - else: - raise NoViableAltException(LT(1), getFilename()) - ++_cnt150 - :_loop150_breakloop - elif ((_givenValue == RBRACE)): // 1831 + method.ReturnType = tr; + elif ((_givenValue == FUNCTION) + or (_givenValue ==RBRACE) + or (_givenValue ==EOS) + or (_givenValue ==AT) + ): // 1827 pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - match(RBRACE) while true: - if ((LA(1)==EOS) and (tokenSet_24_.member(cast(int, LA(2))))): + if ((LA(1)==EOS)): match(EOS) else: - goto _loop152_breakloop - :_loop152_breakloop + goto _loop70_breakloop + :_loop70_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_36_) else: raise - public def expression_statement( - b as Block + public def parameter_declaration_list( + m as INodeWithParameters ) as void: //throws RecognitionException, TokenStreamException try: // for error handling - e=assignment_expression() - if 0 == inputState.guessing: - b.Add(ExpressionStatement(e)) + parameter_declaration(m) + while true: + if ((LA(1)==COMMA)): + match(COMMA) + parameter_declaration(m) + else: + goto _loop92_breakloop + :_loop92_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_37_) else: raise - public def yield_statement( - b as Block + public def enum_member( + container as EnumDefinition ) as void: //throws RecognitionException, TokenStreamException - yt as IToken = null + name as IToken = null try: // for error handling - yt = LT(1) - match(YIELD) - if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_35_.member(cast(int, LA(2))))): - e=expression() - elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + _givenValue = LA(1) + if ((_givenValue == AT)): // 1831 + attributes() + elif ((_givenValue == ID)): // 1831 pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + name = LT(1) + match(ID) + _givenValue = LA(1) + if ((_givenValue == ASSIGN)): // 1831 + match(ASSIGN) + initializer=integer_literal() + elif ((_givenValue == RBRACE) + or (_givenValue ==COMMA) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) if 0 == inputState.guessing: - b.Add(YieldStatement(ToLexicalInfo(yt), Expression: e)) + em = EnumMember(ToLexicalInfo(name), Name: name.getText(), Initializer: initializer) + FlushAttributes(em) + container.Members.Add(em) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_38_) else: raise - public def return_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException + public def integer_literal() as IntegerLiteralExpression : //throws RecognitionException, TokenStreamException + e as IntegerLiteralExpression - ret as IToken = null + i as IToken = null + l as IToken = null try: // for error handling - ret = LT(1) - match(RETURN) - if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_35_.member(cast(int, LA(2))))): - e=expression() - elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - b.Add(ReturnStatement(ToLexicalInfo(ret), Expression: e)) + _givenValue = LA(1) + if ((_givenValue == INT)): // 1831 + i = LT(1) + match(INT) + if 0 == inputState.guessing: + e = ParseIntegerLiteralExpression(i, i.getText(), false); + elif ((_givenValue == LONG)): // 1831 + l = LT(1) + match(LONG) + if 0 == inputState.guessing: + s = l.getText() + e = ParseIntegerLiteralExpression(l, s[:-1], true) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_18_) else: raise + return e - public def break_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException + public def member_name() as antlr.IToken : //throws RecognitionException, TokenStreamException + token as antlr.IToken - t as IToken = null + name as IToken = null + f as IToken = null try: // for error handling - t = LT(1) - match(BREAK) - if 0 == inputState.guessing: - b.Add(BreakStatement(ToLexicalInfo(t))) + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + name = LT(1) + match(ID) + if 0 == inputState.guessing: + token = name; + elif ((_givenValue == FINAL)): // 1831 + f = LT(1) + match(FINAL) + if 0 == inputState.guessing: + token = f; KeywordCannotBeUsedAsAnIdentifier(token); + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_39_) else: raise + return token - public def continue_statement( + public def compound_statement( b as Block ) as void: //throws RecognitionException, TokenStreamException - t as IToken = null try: // for error handling - t = LT(1) - match(CONTINUE) - if 0 == inputState.guessing: - gotoLabel = GetCurrentLoopLabel() - if gotoLabel is not null: - // we might be inside a c style for statement - b.Add(GotoStatement(ToLexicalInfo(t), Label: ReferenceExpression(gotoLabel))) + block(b) + while true: + if ((LA(1)==EOS) and (tokenSet_40_.member(cast(int, LA(2))))): + match(EOS) else: - b.Add(ContinueStatement(ToLexicalInfo(t))) + goto _loop99_breakloop + :_loop99_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_40_) else: raise - public def throw_statement( - b as Block + public def parameter_declaration( + m as INodeWithParameters ) as void: //throws RecognitionException, TokenStreamException - t as IToken = null + id as IToken = null try: // for error handling - t = LT(1) - match(THROW) - if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_35_.member(cast(int, LA(2))))): - e=expression() - elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + _givenValue = LA(1) + if ((_givenValue == AT)): // 1831 + attributes() + elif ((_givenValue == ID)): // 1831 pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + id = LT(1) + match(ID) + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + elif ((_givenValue == RPAREN) + or (_givenValue ==COMMA) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) if 0 == inputState.guessing: - b.Add(RaiseStatement(ToLexicalInfo(t), Exception: e)) + parameter = ParameterDeclaration(ToLexicalInfo(id), Name: id.getText(), Type: tr) + m.Parameters.Add(parameter) + FlushAttributes(parameter) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_16_) else: raise - public def member_modifiers() as TypeMemberModifiers : //throws RecognitionException, TokenStreamException - m as TypeMemberModifiers + public def compound_or_single_stmt( + b as Block + ) as void: //throws RecognitionException, TokenStreamException - v as IToken = null - m = TypeMemberModifiers.None try: // for error handling - while true: - _givenValue = LA(1) - if ((_givenValue == FINAL)): // 1831 - match(FINAL) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Final - elif ((_givenValue == OVERRIDE)): // 1831 - match(OVERRIDE) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Override - elif ((_givenValue == PUBLIC)): // 1831 - match(PUBLIC) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Public - elif ((_givenValue == PRIVATE)): // 1831 - match(PRIVATE) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Private - elif ((_givenValue == PROTECTED)): // 1831 - match(PROTECTED) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Protected - elif ((_givenValue == INTERNAL)): // 1831 - match(INTERNAL) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Internal - elif ((_givenValue == STATIC)): // 1831 - match(STATIC) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Static - elif ((_givenValue == NEW)): // 1831 - match(NEW) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.New - elif ((_givenValue == VIRTUAL)): // 1831 - v = LT(1) - match(VIRTUAL) - if 0 == inputState.guessing: - VirtualKeywordHasNoEffect(v) - else: // line 1969 - goto _loop51_breakloop - :_loop51_breakloop + if ((LA(1)==LBRACE) and (tokenSet_41_.member(cast(int, LA(2))))): + compound_statement(b) + elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_42_.member(cast(int, LA(2))))): // line 2102 + statement(b) + else: + raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_23_) + recover(ex,tokenSet_13_) else: raise - return m - public def type_reference() as TypeReference : //throws RecognitionException, TokenStreamException - tr as TypeReference + public def block( + b as Block + ) as void: //throws RecognitionException, TokenStreamException - lbrack as IToken = null - rank = 1 + rbrace as IToken = null try: // for error handling - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - tr=simple_type_reference() - elif ((_givenValue == FUNCTION)): // 1831 - tr=anonymous_function_type() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if ((LA(1)==LBRACK) and (LA(2)==COMMA or LA(2)==RBRACK)): - lbrack = LT(1) - match(LBRACK) - while true: - if ((LA(1)==COMMA)): - match(COMMA) - if 0 == inputState.guessing: - ++rank - else: - goto _loop168_breakloop - :_loop168_breakloop - match(RBRACK) - if 0 == inputState.guessing: - tr = ArrayTypeReference(tr.LexicalInfo, tr, IntegerLiteralExpression(ToLexicalInfo(lbrack), rank)) - elif ((tokenSet_36_.member(cast(int, LA(1)))) and (tokenSet_37_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) + match(LBRACE) + while true: + if ((tokenSet_2_.member(cast(int, LA(1))))): + statement(b) + else: + goto _loop102_breakloop + :_loop102_breakloop + rbrace = LT(1) + match(RBRACE) + if 0 == inputState.guessing: + SetEndSourceLocation(b, rbrace) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_18_) else: raise - return tr - public def type_reference_list( - typeReferences as TypeReferenceCollection + public def do_while_statement( + container as Block ) as void: //throws RecognitionException, TokenStreamException + d as IToken = null + w as IToken = null try: // for error handling - tr=type_reference() + d = LT(1) + match(DO) if 0 == inputState.guessing: - typeReferences.Add(tr) - while true: - if ((LA(1)==COMMA)): - match(COMMA) - tr=type_reference() - if 0 == inputState.guessing: - typeReferences.Add(tr) - else: - goto _loop184_breakloop - :_loop184_breakloop + ws = WhileStatement(ToLexicalInfo(d), Condition: BoolLiteralExpression(true)) + b = ws.Block + container.Add(ws) + EnterLoop(ws) + block(b) + w = LT(1) + match(WHILE) + e=paren_expression() + eos() + if 0 == inputState.guessing: + b.Add(BreakStatement(ToLexicalInfo(w), Modifier: StatementModifier(StatementModifierType.If, e))) + LeaveLoop(ws) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_38_) + recover(ex,tokenSet_13_) else: raise - public def function_member( - cd as ClassDefinition - ) as TypeMember : //throws RecognitionException, TokenStreamException - member as TypeMember + public def while_statement( + container as Block + ) as void: //throws RecognitionException, TokenStreamException - getter as IToken = null - setter as IToken = null + w as IToken = null try: // for error handling - match(FUNCTION) - _givenValue = LA(1) - if ((_givenValue == GET)): // 1831 - getter = LT(1) - match(GET) - elif ((_givenValue == SET)): // 1831 - setter = LT(1) - match(SET) - elif ((_givenValue == FINAL) - or (_givenValue ==ID) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - memberName=member_name() + w = LT(1) + match(WHILE) + e=paren_expression() if 0 == inputState.guessing: - method as Method - if memberName.getText() == cd.Name: - member = method = Constructor(ToLexicalInfo(memberName)) - else: - member = method = Method(ToLexicalInfo(memberName), Name: memberName.getText()) - if getter is not null or setter is not null: - p = cd.Members[memberName.getText()] as Property - if p is null: - p = Property(ToLexicalInfo(memberName), Name: memberName.getText()) - cd.Members.Add(p) - if getter is not null: - p.Getter = method - else: - p.Setter = method - FlushAttributes(p) - else: - cd.Members.Add(method) - FlushAttributes(method) - function_body(method) + ws = WhileStatement(ToLexicalInfo(w), Condition: e) + b = ws.Block + container.Add(ws) + EnterLoop(ws) + compound_or_single_stmt(b) if 0 == inputState.guessing: - // TODO: move this error checking to a compiler step - // as well as properly checking the type of the accessors - // against the type of the property - if setter is not null: - if method.Parameters.Count != 1 or method.Parameters[0].Name != "value": - ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(ToLexicalInfo(memberName))) - method.Parameters.Clear() - if getter is not null: - if method.Parameters.Count > 0: - ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(ToLexicalInfo(memberName))) + LeaveLoop(ws) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_39_) + recover(ex,tokenSet_13_) else: raise - return member - public def interface_member( - parent as TypeDefinition + public def for_statement( + container as Block ) as void: //throws RecognitionException, TokenStreamException - name as IToken = null + f as IToken = null try: // for error handling - match(FUNCTION) - name = LT(1) - match(ID) - if 0 == inputState.guessing: - method = Method(ToLexicalInfo(name), Name: name.getText()) - FlushAttributes(method) - parent.Members.Add(method) + f = LT(1) + match(FOR) match(LPAREN) - _givenValue = LA(1) - if ((_givenValue == ID) - or (_givenValue ==AT) - ): // 1827 - parameter_declaration_list(method) - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RPAREN) - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - if 0 == inputState.guessing: - method.ReturnType = tr; - elif ((_givenValue == FUNCTION) - or (_givenValue ==RBRACE) - or (_givenValue ==EOS) - or (_givenValue ==AT) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - while true: - if ((LA(1)==EOS)): - match(EOS) - else: - goto _loop74_breakloop - :_loop74_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_40_) + synPredMatched125 as bool = false + if ((LA(1)==VAR or LA(1)==ID) and (LA(2)==IN or LA(2)==ID)): + _m125 as int = mark() + synPredMatched125 = true + ++inputState.guessing + try: + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + match(ID) + elif ((_givenValue == VAR)): // 1831 + declaration() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(IN) + except x as RecognitionException: + synPredMatched125 = false + rewind(_m125) + --inputState.guessing + if synPredMatched125: + stmt=for_in(container) + elif ((tokenSet_43_.member(cast(int, LA(1)))) and (tokenSet_44_.member(cast(int, LA(2))))): // line 2102 + stmt=for_c(container) else: - raise - - public def parameter_declaration_list( - m as INodeWithParameters - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - parameter_declaration(m) - while true: - if ((LA(1)==COMMA)): - match(COMMA) - parameter_declaration(m) - else: - goto _loop96_breakloop - :_loop96_breakloop + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + stmt.LexicalInfo = ToLexicalInfo(f) if stmt is not null except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_41_) + recover(ex,tokenSet_13_) else: raise - public def enum_member( - container as EnumDefinition + public def if_statement( + container as Block ) as void: //throws RecognitionException, TokenStreamException - name as IToken = null + it as IToken = null + et as IToken = null try: // for error handling - _givenValue = LA(1) - if ((_givenValue == AT)): // 1831 - attributes() - elif ((_givenValue == ID)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - name = LT(1) - match(ID) - _givenValue = LA(1) - if ((_givenValue == ASSIGN)): // 1831 - match(ASSIGN) - initializer=integer_literal() - elif ((_givenValue == RBRACE) - or (_givenValue ==COMMA) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) + it = LT(1) + match(IF) + e=paren_expression() if 0 == inputState.guessing: - em = EnumMember(ToLexicalInfo(name), Name: name.getText(), Initializer: initializer) - FlushAttributes(em) - container.Members.Add(em) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_42_) - else: - raise - - public def integer_literal() as IntegerLiteralExpression : //throws RecognitionException, TokenStreamException - e as IntegerLiteralExpression - - i as IToken = null - l as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == INT)): // 1831 - i = LT(1) - match(INT) - if 0 == inputState.guessing: - e = ParseIntegerLiteralExpression(i, i.getText(), false); - elif ((_givenValue == LONG)): // 1831 - l = LT(1) - match(LONG) + s = IfStatement(ToLexicalInfo(it), Condition: e) + b = s.TrueBlock = Block() + container.Add(s) + compound_or_single_stmt(b) + if ((LA(1)==ELSE) and (tokenSet_2_.member(cast(int, LA(2))))): + et = LT(1) + match(ELSE) if 0 == inputState.guessing: - s = l.getText() - e = ParseIntegerLiteralExpression(l, s[:-1], true) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_17_) + b = s.FalseBlock = Block(ToLexicalInfo(et)) + compound_or_single_stmt(b) + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + pass // 947 else: - raise - return e - - public def member_name() as antlr.IToken : //throws RecognitionException, TokenStreamException - token as antlr.IToken - - name as IToken = null - f as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - name = LT(1) - match(ID) - if 0 == inputState.guessing: - token = name; - elif ((_givenValue == FINAL)): // 1831 - f = LT(1) - match(FINAL) - if 0 == inputState.guessing: - token = f; KeywordCannotBeUsedAsAnIdentifier(token); - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) + raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_43_) + recover(ex,tokenSet_13_) else: raise - return token - public def compound_statement( - b as Block + public def try_statement( + container as Block ) as void: //throws RecognitionException, TokenStreamException + tt as IToken = null + ct as IToken = null + id as IToken = null try: // for error handling - block(b) + tt = LT(1) + match(TRY) + if 0 == inputState.guessing: + s = TryStatement(ToLexicalInfo(tt)) + b = s.ProtectedBlock + container.Add(s) + compound_or_single_stmt(b) while true: - if ((LA(1)==EOS) and (tokenSet_44_.member(cast(int, LA(2))))): - match(EOS) + if ((LA(1)==CATCH) and (LA(2)==LPAREN)): + ct = LT(1) + match(CATCH) + match(LPAREN) + id = LT(1) + match(ID) + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + elif ((_givenValue == RPAREN)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RPAREN) + if 0 == inputState.guessing: + tr = SimpleTypeReference(ToLexicalInfo(id), "System.Exception") if tr is null + handler = ExceptionHandler( + ToLexicalInfo(ct), + Declaration: Declaration(ToLexicalInfo(id), Name: id.getText(), Type: tr)) + s.ExceptionHandlers.Add(handler) + b = handler.Block + tr = null + compound_or_single_stmt(b) else: - goto _loop103_breakloop - :_loop103_breakloop + goto _loop152_breakloop + :_loop152_breakloop + if ((LA(1)==FINALLY) and (tokenSet_2_.member(cast(int, LA(2))))): + finally_block(s) + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_44_) + recover(ex,tokenSet_13_) else: raise - public def parameter_declaration( - m as INodeWithParameters + public def switch_statement( + container as Block ) as void: //throws RecognitionException, TokenStreamException - id as IToken = null + s as IToken = null + c as IToken = null + fallthrough as IToken = null + d as IToken = null try: // for error handling + s = LT(1) + match(SWITCH) + e=paren_expression() + if 0 == inputState.guessing: + switchMacro = MacroStatement(ToLexicalInfo(s), Name: MacroName(s.getText())) + switchMacro.Arguments.Add(e) + switchBlock = switchMacro.Body + container.Add(switchMacro) + match(LBRACE) + while true: + if ((LA(1)==CASE)): + c = LT(1) + match(CASE) + e=expression() + match(COLON) + if 0 == inputState.guessing: + item = MacroStatement(ToLexicalInfo(c), Name: c.getText()) + item.Arguments.Add(e) + itemBlock = item.Body + switchBlock.Add(item) + while true: + if ((LA(1)==CASE)): + fallthrough = LT(1) + match(CASE) + e=expression() + match(COLON) + if 0 == inputState.guessing: + item.Arguments.Add(e); + else: + goto _loop140_breakloop + :_loop140_breakloop + _cnt142 as int = 0 + while true: + if ((tokenSet_2_.member(cast(int, LA(1))))): + statement(itemBlock) + else: + if (_cnt142 >= 1): + goto _loop142_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) + ++_cnt142 + :_loop142_breakloop + else: + goto _loop143_breakloop + :_loop143_breakloop _givenValue = LA(1) - if ((_givenValue == AT)): // 1831 - attributes() - elif ((_givenValue == ID)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - id = LT(1) - match(ID) - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 + if ((_givenValue == DEFAULT)): // 1831 + d = LT(1) + match(DEFAULT) match(COLON) - tr=type_reference() - elif ((_givenValue == RPAREN) - or (_givenValue ==COMMA) - ): // 1827 + if 0 == inputState.guessing: + item = MacroStatement(ToLexicalInfo(d), Name: d.getText()) + itemBlock = item.Body + switchBlock.Add(item) + _cnt146 as int = 0 + while true: + if ((tokenSet_2_.member(cast(int, LA(1))))): + statement(itemBlock) + else: + if (_cnt146 >= 1): + goto _loop146_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) + ++_cnt146 + :_loop146_breakloop + elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - parameter = ParameterDeclaration(ToLexicalInfo(id), Name: id.getText(), Type: tr) - m.Parameters.Add(parameter) - FlushAttributes(parameter) + match(RBRACE) + while true: + if ((LA(1)==EOS) and (tokenSet_13_.member(cast(int, LA(2))))): + match(EOS) + else: + goto _loop148_breakloop + :_loop148_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_13_) else: raise - public def compound_or_single_stmt( + public def expression_statement( b as Block ) as void: //throws RecognitionException, TokenStreamException try: // for error handling - if ((LA(1)==LBRACE) and (tokenSet_45_.member(cast(int, LA(2))))): - compound_statement(b) - elif ((tokenSet_34_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): // line 2102 - statement(b) - else: - raise NoViableAltException(LT(1), getFilename()) + e=assignment_expression() + if 0 == inputState.guessing: + b.Add(ExpressionStatement(e)) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_13_) else: raise - public def statement( + public def yield_statement( b as Block ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == DO) - or (_givenValue ==FOR) - or (_givenValue ==IF) - or (_givenValue ==TRY) - or (_givenValue ==WHILE) - or (_givenValue ==SWITCH) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == DO)): // 1831 - do_while_statement(b) - elif ((_givenValue == WHILE)): // 1831 - while_statement(b) - elif ((_givenValue == FOR)): // 1831 - for_statement(b) - elif ((_givenValue == IF)): // 1831 - if_statement(b) - elif ((_givenValue == TRY)): // 1831 - try_statement(b) - elif ((_givenValue == SWITCH)): // 1831 - switch_statement(b) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - elif ((_givenValue == BREAK) - or (_givenValue ==CONTINUE) - or (_givenValue ==FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==RETURN) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==THROW) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==VAR) - or (_givenValue ==YIELD) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - expression_statement(b) - elif ((_givenValue == YIELD)): // 1831 - yield_statement(b) - elif ((_givenValue == RETURN)): // 1831 - return_statement(b) - elif ((_givenValue == BREAK)): // 1831 - break_statement(b) - elif ((_givenValue == CONTINUE)): // 1831 - continue_statement(b) - elif ((_givenValue == THROW)): // 1831 - throw_statement(b) - elif ((_givenValue == VAR)): // 1831 - declaration_statement(b) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - eos() - elif ((_givenValue == EOS)): // 1831 - _cnt113 as int = 0 - while true: - if ((LA(1)==EOS) and (tokenSet_24_.member(cast(int, LA(2))))): - match(EOS) - else: - if (_cnt113 >= 1): - goto _loop113_breakloop - else: - raise NoViableAltException(LT(1), getFilename()) - ++_cnt113 - :_loop113_breakloop - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) + + yt as IToken = null + + try: // for error handling + yt = LT(1) + match(YIELD) + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_45_.member(cast(int, LA(2))))): + e=expression() + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + b.Add(YieldStatement(ToLexicalInfo(yt), Expression: e)) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_13_) else: raise - public def block( + public def return_statement( b as Block ) as void: //throws RecognitionException, TokenStreamException - rbrace as IToken = null + ret as IToken = null try: // for error handling - match(LBRACE) - while true: - if ((tokenSet_34_.member(cast(int, LA(1))))): - statement(b) + ret = LT(1) + match(RETURN) + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_45_.member(cast(int, LA(2))))): + e=expression() + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + b.Add(ReturnStatement(ToLexicalInfo(ret), Expression: e)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_13_) + else: + raise + + public def break_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + t as IToken = null + + try: // for error handling + t = LT(1) + match(BREAK) + if 0 == inputState.guessing: + b.Add(BreakStatement(ToLexicalInfo(t))) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_13_) + else: + raise + + public def continue_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + t as IToken = null + + try: // for error handling + t = LT(1) + match(CONTINUE) + if 0 == inputState.guessing: + gotoLabel = GetCurrentLoopLabel() + if gotoLabel is not null: + // we might be inside a c style for statement + b.Add(GotoStatement(ToLexicalInfo(t), Label: ReferenceExpression(gotoLabel))) else: - goto _loop106_breakloop - :_loop106_breakloop - rbrace = LT(1) - match(RBRACE) + b.Add(ContinueStatement(ToLexicalInfo(t))) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_13_) + else: + raise + + public def throw_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + t as IToken = null + + try: // for error handling + t = LT(1) + match(THROW) + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_45_.member(cast(int, LA(2))))): + e=expression() + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) if 0 == inputState.guessing: - SetEndSourceLocation(b, rbrace) + b.Add(RaiseStatement(ToLexicalInfo(t), Exception: e)) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_13_) else: raise @@ -2457,7 +2348,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_47_) + recover(ex,tokenSet_46_) else: raise return d @@ -2613,7 +2504,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_48_) + recover(ex,tokenSet_47_) else: raise return e @@ -2654,7 +2545,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_13_) else: raise return stmt @@ -2783,7 +2674,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_13_) else: raise return stmt @@ -2799,7 +2690,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -2819,7 +2710,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_13_) else: raise @@ -2830,7 +2721,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=logical_or() - if ((LA(1)==QUESTION_MARK) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==QUESTION_MARK) and (tokenSet_14_.member(cast(int, LA(2))))): qm = LT(1) match(QUESTION_MARK) trueValue=logical_or() @@ -2841,14 +2732,14 @@ class UnityScriptParser(antlr.LLkParser): Condition: e, TrueValue: trueValue, FalseValue: falseValue) - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_48_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -2882,7 +2773,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return name @@ -2901,7 +2792,7 @@ class UnityScriptParser(antlr.LLkParser): arguments = gtr.GenericArguments type_reference_list(arguments) match(GREATER_THAN) - elif ((tokenSet_36_.member(cast(int, LA(1)))) and (tokenSet_37_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_33_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: tr = SimpleTypeReference(ToLexicalInfo(typeName), Name: typeName.getText()) else: @@ -2909,7 +2800,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_32_) else: raise return tr @@ -2931,14 +2822,14 @@ class UnityScriptParser(antlr.LLkParser): returnType=type_reference() if 0 == inputState.guessing: callableTypeRef.ReturnType = returnType - elif ((tokenSet_36_.member(cast(int, LA(1)))) and (tokenSet_37_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_33_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_32_) else: raise return tr @@ -2964,8 +2855,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) else: - goto _loop174_breakloop - :_loop174_breakloop + goto _loop170_breakloop + :_loop170_breakloop elif ((_givenValue == RPAREN)): // 1831 pass // 947 else: // line 1969 @@ -2974,7 +2865,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_32_) else: raise @@ -2996,15 +2887,15 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dimensions.Add(size) else: - goto _loop177_breakloop - :_loop177_breakloop + goto _loop173_breakloop + :_loop173_breakloop match(RBRACK) if 0 == inputState.guessing: e = CodeFactory.NewArrayInitializer(tr.LexicalInfo, tr, dimensions) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3019,7 +2910,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=term() while true: - if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_14_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == ADD)): // 1831 add = LT(1) @@ -3041,12 +2932,12 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop251_breakloop - :_loop251_breakloop + goto _loop247_breakloop + :_loop247_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3061,7 +2952,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3071,18 +2962,18 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched188 as bool = false + synPredMatched184 as bool = false if ((LA(1)==NEW) and (LA(2)==ID)): - _m188 as int = mark() - synPredMatched188 = true + _m184 as int = mark() + synPredMatched184 = true ++inputState.guessing try: new_array_expression() except x as RecognitionException: - synPredMatched188 = false - rewind(_m188) + synPredMatched184 = false + rewind(_m184) --inputState.guessing - if synPredMatched188: + if synPredMatched184: e=new_array_expression() elif ((LA(1)==NEW) and (LA(2)==ID)): // line 2102 match(NEW) @@ -3098,7 +2989,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3144,8 +3035,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ec.Add(e); else: - goto _loop217_breakloop - :_loop217_breakloop + goto _loop213_breakloop + :_loop213_breakloop elif ((_givenValue == RPAREN) or (_givenValue ==RBRACK) ): // 1827 @@ -3155,7 +3046,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_50_) + recover(ex,tokenSet_49_) else: raise @@ -3185,18 +3076,18 @@ class UnityScriptParser(antlr.LLkParser): else: // line 1969 if ((LA(1)==FUNCTION) and (LA(2)==LPAREN)): e=function_expression() - elif ((LA(1)==ID) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==ID) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 e=simple_reference_expression() - elif ((LA(1)==LPAREN) and (tokenSet_13_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==LPAREN) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 e=paren_expression() - elif ((tokenSet_51_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_50_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 e=typeof_expression() else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3238,7 +3129,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3299,9 +3190,9 @@ class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((LA(1)==LBRACE) and (tokenSet_45_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_41_.member(cast(int, LA(2))))): block(body) - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 returnValue=expression() if 0 == inputState.guessing: body.Add(returnValue) @@ -3310,7 +3201,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3328,7 +3219,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3343,11 +3234,11 @@ class UnityScriptParser(antlr.LLkParser): if ((_givenValue == TYPEOF)): // 1831 t = LT(1) match(TYPEOF) - if ((LA(1)==LPAREN) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==LPAREN) and (tokenSet_14_.member(cast(int, LA(2))))): match(LPAREN) arg=expression() match(RPAREN) - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 arg=expression() else: raise NoViableAltException(LT(1), getFilename()) @@ -3378,7 +3269,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3413,7 +3304,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3554,7 +3445,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_52_) + recover(ex,tokenSet_51_) else: raise @@ -3571,7 +3462,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=atom() while true: - if ((LA(1)==LBRACK) and (tokenSet_53_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACK) and (tokenSet_52_.member(cast(int, LA(2))))): lbrack = LT(1) match(LBRACK) if 0 == inputState.guessing: @@ -3584,13 +3475,13 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) slice(se) else: - goto _loop233_breakloop - :_loop233_breakloop + goto _loop229_breakloop + :_loop229_breakloop match(RBRACK) - elif ((LA(1)==DOT) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DOT) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 match(DOT) e=member_reference_expression(e) - elif ((LA(1)==LPAREN) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==LPAREN) and (tokenSet_20_.member(cast(int, LA(2))))): // line 2102 lparen = LT(1) match(LPAREN) if 0 == inputState.guessing: @@ -3601,12 +3492,12 @@ class UnityScriptParser(antlr.LLkParser): expression_list(args) match(RPAREN) else: - goto _loop236_breakloop - :_loop236_breakloop + goto _loop232_breakloop + :_loop232_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3619,17 +3510,17 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=slicing_expression() - if ((LA(1)==INCREMENT) and (tokenSet_17_.member(cast(int, LA(2))))): + if ((LA(1)==INCREMENT) and (tokenSet_18_.member(cast(int, LA(2))))): postinc = LT(1) match(INCREMENT) if 0 == inputState.guessing: token = postinc; operator = UnaryOperatorType.PostIncrement; - elif ((LA(1)==DECREMENT) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DECREMENT) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 preinc = LT(1) match(DECREMENT) if 0 == inputState.guessing: token = preinc; operator= UnaryOperatorType.PostDecrement; - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_48_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3638,7 +3529,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3693,14 +3584,14 @@ class UnityScriptParser(antlr.LLkParser): tr=type_reference() if 0 == inputState.guessing: e = CastExpression(ToLexicalInfo(c), Target: e, Type: tr) - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_48_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3750,7 +3641,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3766,7 +3657,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=unary_expression() while true: - if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_14_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == MULTIPLY)): // 1831 m = LT(1) @@ -3793,12 +3684,12 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop247_breakloop - :_loop247_breakloop + goto _loop243_breakloop + :_loop243_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3812,7 +3703,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=sum() while true: - if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_14_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == SHIFT_LEFT)): // 1831 sl = LT(1) @@ -3830,12 +3721,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop255_breakloop - :_loop255_breakloop + goto _loop251_breakloop + :_loop251_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3856,7 +3747,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=shift() while true: - if ((tokenSet_55_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((tokenSet_54_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == IN) or (_givenValue ==LESS_THAN) @@ -3910,12 +3801,12 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop267_breakloop - :_loop267_breakloop + goto _loop263_breakloop + :_loop263_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3931,7 +3822,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=comparison() while true: - if ((tokenSet_56_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((tokenSet_55_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == EQUALITY)): // 1831 te = LT(1) @@ -3959,12 +3850,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), op, e, r) else: - goto _loop275_breakloop - :_loop275_breakloop + goto _loop271_breakloop + :_loop271_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -3977,7 +3868,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=equality() while true: - if ((LA(1)==BITWISE_AND) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_AND) and (tokenSet_14_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_AND) if 0 == inputState.guessing: @@ -3986,12 +3877,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop278_breakloop - :_loop278_breakloop + goto _loop274_breakloop + :_loop274_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -4004,7 +3895,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_and() while true: - if ((LA(1)==BITWISE_XOR) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_XOR) and (tokenSet_14_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_XOR) if 0 == inputState.guessing: @@ -4013,12 +3904,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop281_breakloop - :_loop281_breakloop + goto _loop277_breakloop + :_loop277_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -4031,7 +3922,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_xor() while true: - if ((LA(1)==BITWISE_OR) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_OR) and (tokenSet_14_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_OR) if 0 == inputState.guessing: @@ -4040,12 +3931,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop284_breakloop - :_loop284_breakloop + goto _loop280_breakloop + :_loop280_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -4058,7 +3949,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_or() while true: - if ((LA(1)==LOGICAL_AND) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==LOGICAL_AND) and (tokenSet_14_.member(cast(int, LA(2))))): op = LT(1) match(LOGICAL_AND) rhs=bitwise_or() @@ -4068,12 +3959,12 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop287_breakloop - :_loop287_breakloop + goto _loop283_breakloop + :_loop283_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -4086,7 +3977,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=logical_and() while true: - if ((LA(1)==LOGICAL_OR) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==LOGICAL_OR) and (tokenSet_14_.member(cast(int, LA(2))))): op = LT(1) match(LOGICAL_OR) rhs=logical_and() @@ -4096,12 +3987,12 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop290_breakloop - :_loop290_breakloop + goto _loop286_breakloop + :_loop286_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -4131,7 +4022,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -4145,19 +4036,19 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling lbrack = LT(1) match(LBRACK) - synPredMatched298 as bool = false - if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_57_.member(cast(int, LA(2))))): - _m298 as int = mark() - synPredMatched298 = true + synPredMatched294 as bool = false + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_56_.member(cast(int, LA(2))))): + _m294 as int = mark() + synPredMatched294 = true ++inputState.guessing try: expression() match(FOR) except x as RecognitionException: - synPredMatched298 = false - rewind(_m298) + synPredMatched294 = false + rewind(_m294) --inputState.guessing - if synPredMatched298: + if synPredMatched294: projection=expression() match(FOR) match(LPAREN) @@ -4183,7 +4074,7 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) - elif ((tokenSet_58_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_57_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)); items = ale.Items; expression_list(items) @@ -4193,7 +4084,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -4244,8 +4135,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dle.Items.Add(pair); else: - goto _loop306_breakloop - :_loop306_breakloop + goto _loop302_breakloop + :_loop302_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 @@ -4254,7 +4145,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return dle @@ -4272,7 +4163,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return re @@ -4300,7 +4191,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -4318,7 +4209,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -4336,7 +4227,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -4354,7 +4245,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return e @@ -4372,7 +4263,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_18_) else: raise return rle @@ -4392,7 +4283,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_42_) + recover(ex,tokenSet_38_) else: raise return ep @@ -4530,7 +4421,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) private static def mk_tokenSet_2_() as (long): - data = (829189822610818592L, 8589935663105L, 0L, 0L, ) + data = (829189822610818592L, 8589935663617L, 0L, 0L, ) return data public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) private static def mk_tokenSet_3_() as (long): @@ -4542,7 +4433,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) private static def mk_tokenSet_5_() as (long): - data = (829225191148541730L, 8609263015937L, 0L, 0L, ) + data = (829225191148541730L, 8609263016449L, 0L, 0L, ) return data public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) private static def mk_tokenSet_6_() as (long): @@ -4550,7 +4441,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) private static def mk_tokenSet_7_() as (long): - data = (829225191146444578L, 8592083146753L, 0L, 0L, ) + data = (829225191146444578L, 8592083147265L, 0L, 0L, ) return data public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) private static def mk_tokenSet_8_() as (long): @@ -4574,51 +4465,51 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_12_ = BitSet(mk_tokenSet_12_()) private static def mk_tokenSet_13_() as (long): - data = (828674151387774976L, 8589935663105L, 0L, 0L, ) + data = (1119144417158487970L, 8592083147265L, 0L, 0L, ) return data public static final tokenSet_13_ = BitSet(mk_tokenSet_13_()) private static def mk_tokenSet_14_() as (long): - data = (-4647702995452805040L, 8728380176823L, 0L, 0L, ) + data = (828674151387774976L, 8589935663105L, 0L, 0L, ) return data public static final tokenSet_14_ = BitSet(mk_tokenSet_14_()) private static def mk_tokenSet_15_() as (long): - data = (-8070450532247928832L, 0L, ) + data = (-4647702995452805040L, 8728380176823L, 0L, 0L, ) return data public static final tokenSet_15_ = BitSet(mk_tokenSet_15_()) private static def mk_tokenSet_16_() as (long): - data = (576460752303423488L, 1024L, 0L, 0L, ) + data = (-8070450532247928832L, 0L, ) return data public static final tokenSet_16_ = BitSet(mk_tokenSet_16_()) private static def mk_tokenSet_17_() as (long): - data = (-85906169870L, 8766028251135L, 0L, 0L, ) + data = (576460752303423488L, 1024L, 0L, 0L, ) return data public static final tokenSet_17_ = BitSet(mk_tokenSet_17_()) private static def mk_tokenSet_18_() as (long): - data = (36081762102972672L, 2147483648L, 0L, 0L, ) + data = (-85906169870L, 8766028251135L, 0L, 0L, ) return data public static final tokenSet_18_ = BitSet(mk_tokenSet_18_()) private static def mk_tokenSet_19_() as (long): - data = (1981595655994621952L, 8589935663105L, 0L, 0L, ) + data = (36081762102972672L, 2147483648L, 0L, 0L, ) return data public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) private static def mk_tokenSet_20_() as (long): - data = (829225195441411874L, 8592083146753L, 0L, 0L, ) + data = (1981595655994621952L, 8589935663105L, 0L, 0L, ) return data public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) private static def mk_tokenSet_21_() as (long): - data = (-1688867046500494L, 8766028251135L, 0L, 0L, ) + data = (829225195441411874L, 8592083147265L, 0L, 0L, ) return data public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) private static def mk_tokenSet_22_() as (long): - data = (-85899878414L, 8783208120319L, 0L, 0L, ) + data = (-1688867046500494L, 8766028251135L, 0L, 0L, ) return data public static final tokenSet_22_ = BitSet(mk_tokenSet_22_()) private static def mk_tokenSet_23_() as (long): - data = (17600793022720L, 0L, ) + data = (-85899878414L, 8783208120319L, 0L, 0L, ) return data public static final tokenSet_23_ = BitSet(mk_tokenSet_23_()) private static def mk_tokenSet_24_() as (long): - data = (1119144417158487970L, 8592083147265L, 0L, 0L, ) + data = (17600793022720L, 0L, ) return data public static final tokenSet_24_ = BitSet(mk_tokenSet_24_()) private static def mk_tokenSet_25_() as (long): @@ -4646,115 +4537,111 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) private static def mk_tokenSet_31_() as (long): - data = (1117455571593123618L, 8592083146753L, 0L, 0L, ) + data = (1117455571593123618L, 8592083147265L, 0L, 0L, ) return data public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) private static def mk_tokenSet_32_() as (long): - data = (828691743573819392L, 8589935663617L, 0L, 0L, ) + data = (-85901975566L, 8766028251135L, 0L, 0L, ) return data public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) private static def mk_tokenSet_33_() as (long): - data = (3456524534000402512L, 8763880767487L, 0L, 0L, ) + data = (-17181974542L, 8766028251135L, 0L, 0L, ) return data public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) private static def mk_tokenSet_34_() as (long): - data = (829189822610818592L, 8589935663617L, 0L, 0L, ) + data = (144115188075855872L, 134217728L, 0L, 0L, ) return data public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) private static def mk_tokenSet_35_() as (long): - data = (3424987426414125042L, 8730527660983L, 0L, 0L, ) + data = (288283341235720448L, 2147483648L, 0L, 0L, ) return data public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) private static def mk_tokenSet_36_() as (long): - data = (-85901975566L, 8766028251135L, 0L, 0L, ) + data = (288230376151973888L, 2147483648L, 0L, 0L, ) return data public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) private static def mk_tokenSet_37_() as (long): - data = (-17181974542L, 8766028251135L, 0L, 0L, ) + data = (1152921504606846976L, 0L, ) return data public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) private static def mk_tokenSet_38_() as (long): - data = (144115188075855872L, 134217728L, 0L, 0L, ) + data = (-8935141660703064064L, 0L, ) return data public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) private static def mk_tokenSet_39_() as (long): - data = (288283341235720448L, 2147483648L, 0L, 0L, ) + data = (5729141590020511522L, 8592083148289L, 0L, 0L, ) return data public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) private static def mk_tokenSet_40_() as (long): - data = (288230376151973888L, 2147483648L, 0L, 0L, ) + data = (1119144421453455266L, 8592083147265L, 0L, 0L, ) return data public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) private static def mk_tokenSet_41_() as (long): - data = (1152921504606846976L, 0L, ) + data = (1117420198762530336L, 8589935663617L, 0L, 0L, ) return data public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) private static def mk_tokenSet_42_() as (long): - data = (-8935141660703064064L, 0L, ) + data = (3458764423619403762L, 8766028251135L, 0L, 0L, ) return data public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) private static def mk_tokenSet_43_() as (long): - data = (5729141590020511522L, 8592083148289L, 0L, 0L, ) + data = (828691743573819392L, 8589935663617L, 0L, 0L, ) return data public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) private static def mk_tokenSet_44_() as (long): - data = (1119144421453455266L, 8592083147265L, 0L, 0L, ) + data = (3456524534000402512L, 8763880767487L, 0L, 0L, ) return data public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) private static def mk_tokenSet_45_() as (long): - data = (1117420198762530336L, 8589935663617L, 0L, 0L, ) + data = (3424987426414125042L, 8730527660983L, 0L, 0L, ) return data public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) private static def mk_tokenSet_46_() as (long): - data = (3458764423619403762L, 8766028251135L, 0L, 0L, ) + data = (1119144417166876578L, 8592083148289L, 0L, 0L, ) return data public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) private static def mk_tokenSet_47_() as (long): - data = (1119144417166876578L, 8592083148289L, 0L, 0L, ) + data = (2272065921765334946L, 8592083147265L, 0L, 0L, ) return data public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) private static def mk_tokenSet_48_() as (long): - data = (2272065921765334946L, 8592083147265L, 0L, 0L, ) + data = (-17186168846L, 8766028251135L, 0L, 0L, ) return data public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) private static def mk_tokenSet_49_() as (long): - data = (-17186168846L, 8766028251135L, 0L, 0L, ) + data = (1152921504606846976L, 2L, 0L, 0L, ) return data public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) private static def mk_tokenSet_50_() as (long): - data = (1152921504606846976L, 2L, 0L, 0L, ) + data = (612498345415671808L, 0L, ) return data public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) private static def mk_tokenSet_51_() as (long): - data = (612498345415671808L, 0L, ) + data = (-9223372036854775808L, 2L, 0L, 0L, ) return data public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) private static def mk_tokenSet_52_() as (long): - data = (-9223372036854775808L, 2L, 0L, 0L, ) + data = (5440360169815162880L, 8589935663105L, 0L, 0L, ) return data public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) private static def mk_tokenSet_53_() as (long): - data = (5440360169815162880L, 8589935663105L, 0L, 0L, ) + data = (36028865738964992L, 8388608L, 0L, 0L, ) return data public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) private static def mk_tokenSet_54_() as (long): - data = (36028865738964992L, 8388608L, 0L, 0L, ) + data = (41943040L, 427819008L, 0L, 0L, ) return data public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) private static def mk_tokenSet_55_() as (long): - data = (41943040L, 427819008L, 0L, 0L, ) + data = (0L, 6684672L, 0L, 0L, ) return data public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) private static def mk_tokenSet_56_() as (long): - data = (0L, 6684672L, 0L, 0L, ) + data = (3422747536795254864L, 8728380176823L, 0L, 0L, ) return data public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) private static def mk_tokenSet_57_() as (long): - data = (3422747536795254864L, 8728380176823L, 0L, 0L, ) - return data - public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) - private static def mk_tokenSet_58_() as (long): data = (828674151387774976L, 8589935663107L, 0L, 0L, ) return data - public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) + public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index b20011c..15cfb71 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -235,6 +235,7 @@ start[CompileUnit cu] module = Module(LexicalInfo(getFilename(), 1, 1)) module.Name = CreateModuleName(getFilename()) cu.Modules.Add(module) + globals = module.Globals }: ( import_directive[module] @@ -248,7 +249,7 @@ start[CompileUnit cu] module_member[module] ) | module_member[module] - | global_statement[module] + | statement[globals] )* eof:EOF { @@ -364,32 +365,6 @@ module_field[Module m] { f.Modifiers |= mod } ; -global_statement[Module m] -{ - b = m.Globals -}: - ( - do_while_statement[b] | - while_statement[b] | - for_statement[b] | - if_statement[b] | - try_statement[b] | - switch_statement[b] - ) | - ( - ( - expression_statement[b] | - yield_statement[b] | - return_statement[b] | - break_statement[b] | - continue_statement[b] | - throw_statement[b] | - declaration_statement[b] - ) - eos - ) -; - qname returns [Token id] { }: From 08be4068a9d727451a8891a471d62ada757f84af Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 13 Jan 2011 11:57:11 -0200 Subject: [PATCH 120/276] disable test currently failing to verify --- tests/eval/eval-in-static-function-2.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/eval/eval-in-static-function-2.js b/tests/eval/eval-in-static-function-2.js index d9013da..9ffdddd 100755 --- a/tests/eval/eval-in-static-function-2.js +++ b/tests/eval/eval-in-static-function-2.js @@ -1,3 +1,4 @@ +// category FailsOnMono /* script(1,7): BCE0020: An instance of type 'eval-in-static-function-2' is required to access non static member 'a'. script(1,11): BCE0020: An instance of type 'eval-in-static-function-2' is required to access non static member 'bar'. From 555259e49a02c5553098a2a54790e89991798402 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 13 Jan 2011 12:44:43 -0200 Subject: [PATCH 121/276] test fixture missing from last commit --- src/UnityScript.Tests/EvalTestFixture.boo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UnityScript.Tests/EvalTestFixture.boo b/src/UnityScript.Tests/EvalTestFixture.boo index baf4084..ce1c233 100755 --- a/src/UnityScript.Tests/EvalTestFixture.boo +++ b/src/UnityScript.Tests/EvalTestFixture.boo @@ -34,7 +34,7 @@ class EvalTestFixture(AbstractIntegrationTestFixture): [Test] def eval_in_static_function_1(): RunTestCase("tests/eval/eval-in-static-function-1.js") - + [Category("FailsOnMono")] [Test] def eval_in_static_function_2(): RunTestCase("tests/eval/eval-in-static-function-2.js") From 30855938636e14396ff6950ad1f1cff010980676 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 14 Jan 2011 04:25:38 +0100 Subject: [PATCH 122/276] grab nunit.inc from the boo source tree --- default.build | 2 +- nunit.inc | 24 ------------------------ 2 files changed, 1 insertion(+), 25 deletions(-) delete mode 100644 nunit.inc diff --git a/default.build b/default.build index 9a2e085..d5e684f 100755 --- a/default.build +++ b/default.build @@ -13,7 +13,7 @@ - + diff --git a/nunit.inc b/nunit.inc deleted file mode 100644 index d62ab3f..0000000 --- a/nunit.inc +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - From a81acd6604bafc6e33c117feb7918f254c2988e4 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. Oliveira" Date: Fri, 14 Jan 2011 12:41:30 -0800 Subject: [PATCH 123/276] nunit-console2 => nunit-console --- default.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.build b/default.build index d5e684f..c733d11 100755 --- a/default.build +++ b/default.build @@ -21,7 +21,7 @@ - + From d58bd80185197de0a15fd73d704c47bb1c9d1d08 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 19 Jan 2011 09:52:19 -0200 Subject: [PATCH 124/276] better error message for 'final' and 'internal' keywords being used as identifiers --- .../ErrorMessagesTestFixture.Generated.boo | 4 + .../Core/UnityScriptCompilerErrors.boo | 2 +- src/UnityScript/Parser/UnityScriptParser.boo | 145 ++++++++++-------- src/UnityScript/UnityScript.g | 17 +- .../error-for-final-used-as-identifier.js | 20 ++- .../error-for-internal-used-as-identifier.js | 23 +++ 6 files changed, 141 insertions(+), 70 deletions(-) create mode 100755 tests/error-messages/error-for-internal-used-as-identifier.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index 8dcb962..19b1bc5 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -38,6 +38,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/error-for-final-used-as-identifier.js") + [Test] def error_for_internal_used_as_identifier(): + RunTestCase("tests/error-messages/error-for-internal-used-as-identifier.js") + + [Test] def for_variable_already_defined(): RunTestCase("tests/error-messages/for-variable-already-defined.js") diff --git a/src/UnityScript/Core/UnityScriptCompilerErrors.boo b/src/UnityScript/Core/UnityScriptCompilerErrors.boo index ad34872..bc86aaa 100755 --- a/src/UnityScript/Core/UnityScriptCompilerErrors.boo +++ b/src/UnityScript/Core/UnityScriptCompilerErrors.boo @@ -23,7 +23,7 @@ static class UnityScriptCompilerErrors: return CreateError("UCE0006", location, "'$typeName' is not a class. 'extends' can only be used with classes. Did you mean 'implements'?") def KeywordCannotBeUsedAsAnIdentifier(location as LexicalInfo, keyword as string): - return CreateError("UCE0007", location, "Reserved keyword '$keyword' cannot be used as an identifier.") + return CreateError("UCE0007", location, "'$keyword' keyword cannot be used as an identifier.") def EvalHasBeenDisabled(location as LexicalInfo, reason as string): return CreateError("UCE0008", location, reason) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 289200f..8dfde81 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -457,7 +457,7 @@ class UnityScriptParser(antlr.LLkParser): --inputState.guessing if synPredMatched25: module_field(module) - elif ((LA(1)==VAR) and (LA(2)==ID)): // line 2102 + elif ((LA(1)==VAR) and (LA(2)==FINAL or LA(2)==INTERNAL or LA(2)==ID)): // line 2102 declaration_statement(globals) eos() elif ((tokenSet_11_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 @@ -1233,7 +1233,9 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling match(LPAREN) _givenValue = LA(1) - if ((_givenValue == ID) + if ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) or (_givenValue ==AT) ): // 1827 parameter_declaration_list(method) @@ -1270,7 +1272,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling match(VAR) - name=member_name() + name=identifier() _givenValue = LA(1) if ((_givenValue == COLON)): // 1831 match(COLON) @@ -1546,12 +1548,13 @@ class UnityScriptParser(antlr.LLkParser): setter = LT(1) match(SET) elif ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) or (_givenValue ==ID) ): // 1827 pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - memberName=member_name() + memberName=identifier() if 0 == inputState.guessing: method as Method if memberName.getText() == cd.Name: @@ -1607,7 +1610,9 @@ class UnityScriptParser(antlr.LLkParser): parent.Members.Add(method) match(LPAREN) _givenValue = LA(1) - if ((_givenValue == ID) + if ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) or (_givenValue ==AT) ): // 1827 parameter_declaration_list(method) @@ -1730,11 +1735,12 @@ class UnityScriptParser(antlr.LLkParser): raise return e - public def member_name() as antlr.IToken : //throws RecognitionException, TokenStreamException + public def identifier() as antlr.IToken : //throws RecognitionException, TokenStreamException token as antlr.IToken name as IToken = null f as IToken = null + i as IToken = null try: // for error handling _givenValue = LA(1) @@ -1748,6 +1754,11 @@ class UnityScriptParser(antlr.LLkParser): match(FINAL) if 0 == inputState.guessing: token = f; KeywordCannotBeUsedAsAnIdentifier(token); + elif ((_givenValue == INTERNAL)): // 1831 + i = LT(1) + match(INTERNAL) + if 0 == inputState.guessing: + token = i; KeywordCannotBeUsedAsAnIdentifier(token); else: // line 1969 raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: @@ -1782,18 +1793,19 @@ class UnityScriptParser(antlr.LLkParser): m as INodeWithParameters ) as void: //throws RecognitionException, TokenStreamException - id as IToken = null try: // for error handling _givenValue = LA(1) if ((_givenValue == AT)): // 1831 attributes() - elif ((_givenValue == ID)): // 1831 + elif ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) + ): // 1827 pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - id = LT(1) - match(ID) + id=identifier() _givenValue = LA(1) if ((_givenValue == COLON)): // 1831 match(COLON) @@ -1925,14 +1937,17 @@ class UnityScriptParser(antlr.LLkParser): match(FOR) match(LPAREN) synPredMatched125 as bool = false - if ((LA(1)==VAR or LA(1)==ID) and (LA(2)==IN or LA(2)==ID)): + if ((tokenSet_43_.member(cast(int, LA(1)))) and (tokenSet_44_.member(cast(int, LA(2))))): _m125 as int = mark() synPredMatched125 = true ++inputState.guessing try: _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - match(ID) + if ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) + ): // 1827 + identifier() elif ((_givenValue == VAR)): // 1831 declaration() else: // line 1969 @@ -1944,7 +1959,7 @@ class UnityScriptParser(antlr.LLkParser): --inputState.guessing if synPredMatched125: stmt=for_in(container) - elif ((tokenSet_43_.member(cast(int, LA(1)))) and (tokenSet_44_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_45_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): // line 2102 stmt=for_c(container) else: raise NoViableAltException(LT(1), getFilename()) @@ -2165,7 +2180,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling yt = LT(1) match(YIELD) - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_45_.member(cast(int, LA(2))))): + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_47_.member(cast(int, LA(2))))): e=expression() elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 pass // 947 @@ -2189,7 +2204,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling ret = LT(1) match(RETURN) - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_45_.member(cast(int, LA(2))))): + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_47_.member(cast(int, LA(2))))): e=expression() elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 pass // 947 @@ -2254,7 +2269,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling t = LT(1) match(THROW) - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_45_.member(cast(int, LA(2))))): + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_47_.member(cast(int, LA(2))))): e=expression() elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 pass // 947 @@ -2272,12 +2287,10 @@ class UnityScriptParser(antlr.LLkParser): public def declaration() as Declaration : //throws RecognitionException, TokenStreamException d as Declaration - id as IToken = null try: // for error handling match(VAR) - id = LT(1) - match(ID) + id=identifier() _givenValue = LA(1) if ((_givenValue == COLON)): // 1831 match(COLON) @@ -2348,7 +2361,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_46_) + recover(ex,tokenSet_48_) else: raise return d @@ -2504,7 +2517,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_47_) + recover(ex,tokenSet_49_) else: raise return e @@ -2514,13 +2527,14 @@ class UnityScriptParser(antlr.LLkParser): ) as Statement : //throws RecognitionException, TokenStreamException stmt as Statement - id as IToken = null try: // for error handling _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - id = LT(1) - match(ID) + if ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) + ): // 1827 + id=identifier() if 0 == inputState.guessing: d = Declaration(ToLexicalInfo(id), Name: id.getText()) elif ((_givenValue == VAR)): // 1831 @@ -2732,7 +2746,7 @@ class UnityScriptParser(antlr.LLkParser): Condition: e, TrueValue: trueValue, FalseValue: falseValue) - elif ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_48_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_50_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3046,7 +3060,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_49_) + recover(ex,tokenSet_51_) else: raise @@ -3080,7 +3094,7 @@ class UnityScriptParser(antlr.LLkParser): e=simple_reference_expression() elif ((LA(1)==LPAREN) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 e=paren_expression() - elif ((tokenSet_50_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_52_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 e=typeof_expression() else: raise NoViableAltException(LT(1), getFilename()) @@ -3148,7 +3162,9 @@ class UnityScriptParser(antlr.LLkParser): body = e.Body match(LPAREN) _givenValue = LA(1) - if ((_givenValue == ID) + if ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) or (_givenValue ==AT) ): // 1827 parameter_declaration_list(e) @@ -3445,7 +3461,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_51_) + recover(ex,tokenSet_53_) else: raise @@ -3462,7 +3478,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=atom() while true: - if ((LA(1)==LBRACK) and (tokenSet_52_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACK) and (tokenSet_54_.member(cast(int, LA(2))))): lbrack = LT(1) match(LBRACK) if 0 == inputState.guessing: @@ -3478,7 +3494,7 @@ class UnityScriptParser(antlr.LLkParser): goto _loop229_breakloop :_loop229_breakloop match(RBRACK) - elif ((LA(1)==DOT) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DOT) and (tokenSet_55_.member(cast(int, LA(2))))): // line 2102 match(DOT) e=member_reference_expression(e) elif ((LA(1)==LPAREN) and (tokenSet_20_.member(cast(int, LA(2))))): // line 2102 @@ -3520,7 +3536,7 @@ class UnityScriptParser(antlr.LLkParser): match(DECREMENT) if 0 == inputState.guessing: token = preinc; operator= UnaryOperatorType.PostDecrement; - elif ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_48_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_50_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3584,7 +3600,7 @@ class UnityScriptParser(antlr.LLkParser): tr=type_reference() if 0 == inputState.guessing: e = CastExpression(ToLexicalInfo(c), Target: e, Type: tr) - elif ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_48_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_50_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3747,7 +3763,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=shift() while true: - if ((tokenSet_54_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((tokenSet_56_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == IN) or (_givenValue ==LESS_THAN) @@ -3822,7 +3838,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=comparison() while true: - if ((tokenSet_55_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((tokenSet_57_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == EQUALITY)): // 1831 te = LT(1) @@ -4031,13 +4047,12 @@ class UnityScriptParser(antlr.LLkParser): e as Expression lbrack as IToken = null - id as IToken = null try: // for error handling lbrack = LT(1) match(LBRACK) synPredMatched294 as bool = false - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_56_.member(cast(int, LA(2))))): + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_58_.member(cast(int, LA(2))))): _m294 as int = mark() synPredMatched294 = true ++inputState.guessing @@ -4053,9 +4068,11 @@ class UnityScriptParser(antlr.LLkParser): match(FOR) match(LPAREN) _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - id = LT(1) - match(ID) + if ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) + ): // 1827 + id=identifier() elif ((_givenValue == VAR)): // 1831 variable=declaration() else: // line 1969 @@ -4074,7 +4091,7 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) - elif ((tokenSet_57_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_59_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)); items = ale.Items; expression_list(items) @@ -4533,7 +4550,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_29_ = BitSet(mk_tokenSet_29_()) private static def mk_tokenSet_30_() as (long): - data = (36028865738998016L, 0L, ) + data = (36028867886481664L, 0L, ) return data public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) private static def mk_tokenSet_31_() as (long): @@ -4569,7 +4586,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) private static def mk_tokenSet_39_() as (long): - data = (5729141590020511522L, 8592083148289L, 0L, 0L, ) + data = (-2339620092358697054L, 8592083148289L, 0L, 0L, ) return data public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) private static def mk_tokenSet_40_() as (long): @@ -4585,63 +4602,71 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) private static def mk_tokenSet_43_() as (long): - data = (828691743573819392L, 8589935663617L, 0L, 0L, ) + data = (36046391352524800L, 0L, ) return data public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) private static def mk_tokenSet_44_() as (long): - data = (3456524534000402512L, 8763880767487L, 0L, 0L, ) + data = (36028799174868992L, 0L, ) return data public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) private static def mk_tokenSet_45_() as (long): - data = (3424987426414125042L, 8730527660983L, 0L, 0L, ) + data = (828691743573819392L, 8589935663617L, 0L, 0L, ) return data public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) private static def mk_tokenSet_46_() as (long): - data = (1119144417166876578L, 8592083148289L, 0L, 0L, ) + data = (3456524536147918928L, 8763880767487L, 0L, 0L, ) return data public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) private static def mk_tokenSet_47_() as (long): - data = (2272065921765334946L, 8592083147265L, 0L, 0L, ) + data = (3424987426414125042L, 8730527660983L, 0L, 0L, ) return data public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) private static def mk_tokenSet_48_() as (long): - data = (-17186168846L, 8766028251135L, 0L, 0L, ) + data = (1119144417166876578L, 8592083148289L, 0L, 0L, ) return data public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) private static def mk_tokenSet_49_() as (long): - data = (1152921504606846976L, 2L, 0L, 0L, ) + data = (2272065921765334946L, 8592083147265L, 0L, 0L, ) return data public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) private static def mk_tokenSet_50_() as (long): - data = (612498345415671808L, 0L, ) + data = (-17186168846L, 8766028251135L, 0L, 0L, ) return data public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) private static def mk_tokenSet_51_() as (long): - data = (-9223372036854775808L, 2L, 0L, 0L, ) + data = (1152921504606846976L, 2L, 0L, 0L, ) return data public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) private static def mk_tokenSet_52_() as (long): - data = (5440360169815162880L, 8589935663105L, 0L, 0L, ) + data = (612498345415671808L, 0L, ) return data public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) private static def mk_tokenSet_53_() as (long): - data = (36028865738964992L, 8388608L, 0L, 0L, ) + data = (-9223372036854775808L, 2L, 0L, 0L, ) return data public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) private static def mk_tokenSet_54_() as (long): - data = (41943040L, 427819008L, 0L, 0L, ) + data = (5440360169815162880L, 8589935663105L, 0L, 0L, ) return data public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) private static def mk_tokenSet_55_() as (long): - data = (0L, 6684672L, 0L, 0L, ) + data = (36028865738964992L, 8388608L, 0L, 0L, ) return data public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) private static def mk_tokenSet_56_() as (long): - data = (3422747536795254864L, 8728380176823L, 0L, 0L, ) + data = (41943040L, 427819008L, 0L, 0L, ) return data public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) private static def mk_tokenSet_57_() as (long): - data = (828674151387774976L, 8589935663107L, 0L, 0L, ) + data = (0L, 6684672L, 0L, 0L, ) return data public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) + private static def mk_tokenSet_58_() as (long): + data = (3422747536795254864L, 8728380176823L, 0L, 0L, ) + return data + public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) + private static def mk_tokenSet_59_() as (long): + data = (828674151387774976L, 8589935663107L, 0L, 0L, ) + return data + public static final tokenSet_59_ = BitSet(mk_tokenSet_59_()) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 15cfb71..a0a47e1 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -566,17 +566,18 @@ enum_member [EnumDefinition container] } ; -member_name returns [antlr.IToken token] +identifier returns [antlr.IToken token] { }: name:ID { token = name; } | f:FINAL { token = f; KeywordCannotBeUsedAsAnIdentifier(token); } + | i:INTERNAL { token = i; KeywordCannotBeUsedAsAnIdentifier(token); } ; field_member[TypeDefinition cd] returns [TypeMember member] { }: - VAR name=member_name (COLON tr=type_reference)? (ASSIGN initializer=expression)? eos + VAR name=identifier (COLON tr=type_reference)? (ASSIGN initializer=expression)? eos { member = Field(ToLexicalInfo(name), Name: name.getText(), @@ -590,7 +591,7 @@ field_member[TypeDefinition cd] returns [TypeMember member] function_member[ClassDefinition cd] returns [TypeMember member] { }: - FUNCTION (getter:GET | setter:SET)? memberName=member_name + FUNCTION (getter:GET | setter:SET)? memberName=identifier { method as Method if memberName.getText() == cd.Name: @@ -653,7 +654,7 @@ parameter_declaration_list[INodeWithParameters m] parameter_declaration[INodeWithParameters m] { }: - (attributes)? id:ID (COLON tr=type_reference)? + (attributes)? id=identifier (COLON tr=type_reference)? { parameter = ParameterDeclaration(ToLexicalInfo(id), Name: id.getText(), Type: tr) m.Parameters.Add(parameter) @@ -789,7 +790,7 @@ for_statement [Block container] f:FOR LPAREN ( - ((ID | declaration) IN)=>stmt=for_in[container] + ((identifier | declaration) IN)=>stmt=for_in[container] | stmt=for_c[container] ) { @@ -840,7 +841,7 @@ for_in [Block container] returns [Statement stmt] { }: ( - (id:ID { d = Declaration(ToLexicalInfo(id), Name: id.getText()) }) + (id=identifier { d = Declaration(ToLexicalInfo(id), Name: id.getText()) }) | d=declaration { DeclarationAnnotations.ForceNewVariable(d) } ) IN iterator=expression @@ -863,7 +864,7 @@ for_in [Block container] returns [Statement stmt] declaration returns [Declaration d] { }: - VAR id:ID (COLON tr=type_reference)? + VAR id=identifier (COLON tr=type_reference)? { d = Declaration(ToLexicalInfo(id), Name: id.getText(), Type: tr) } @@ -1625,7 +1626,7 @@ array_literal returns [Expression e] ( (expression FOR)=>( projection=expression - FOR LPAREN ((id:ID | variable=declaration) IN iterator=expression) RPAREN + FOR LPAREN ((id=identifier | variable=declaration) IN iterator=expression) RPAREN (IF filter=expression)? { if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) diff --git a/tests/error-messages/error-for-final-used-as-identifier.js b/tests/error-messages/error-for-final-used-as-identifier.js index c9badef..78055c4 100755 --- a/tests/error-messages/error-for-final-used-as-identifier.js +++ b/tests/error-messages/error-for-final-used-as-identifier.js @@ -1,5 +1,23 @@ /* -error-for-final-used-as-identifier.js(4,5): UCE0007: Reserved keyword 'final' cannot be used as an identifier. +error-for-final-used-as-identifier.js(8,5): UCE0007: 'final' keyword cannot be used as an identifier. +error-for-final-used-as-identifier.js(11,13): UCE0007: 'final' keyword cannot be used as an identifier. +error-for-final-used-as-identifier.js(14,12): UCE0007: 'final' keyword cannot be used as an identifier. +error-for-final-used-as-identifier.js(18,13): UCE0007: 'final' keyword cannot be used as an identifier. +error-for-final-used-as-identifier.js(21,10): UCE0007: 'final' keyword cannot be used as an identifier. */ var final = false; +function f() { + var final = false; +} + +function g(final: float) { +} + +class C { + var final = false; +} + +for (var final in []) { +} + diff --git a/tests/error-messages/error-for-internal-used-as-identifier.js b/tests/error-messages/error-for-internal-used-as-identifier.js new file mode 100755 index 0000000..68f4594 --- /dev/null +++ b/tests/error-messages/error-for-internal-used-as-identifier.js @@ -0,0 +1,23 @@ +/* +error-for-internal-used-as-identifier.js(8,5): UCE0007: 'internal' keyword cannot be used as an identifier. +error-for-internal-used-as-identifier.js(11,13): UCE0007: 'internal' keyword cannot be used as an identifier. +error-for-internal-used-as-identifier.js(14,12): UCE0007: 'internal' keyword cannot be used as an identifier. +error-for-internal-used-as-identifier.js(18,13): UCE0007: 'internal' keyword cannot be used as an identifier. +error-for-internal-used-as-identifier.js(21,10): UCE0007: 'internal' keyword cannot be used as an identifier. +*/ +var internal = false; + +function f() { + var internal = false; +} + +function g(internal: float) { +} + +class C { + var internal = false; +} + +for (var internal in []) { +} + From 8527c75012823541b29c3273edd775c702e37a31 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 26 Jan 2011 11:35:33 -0200 Subject: [PATCH 125/276] remove NUnit.Framework from the test case scripts --- .../AbstractCompilerTest.boo | 1 - tests/integration/vars-1.js | 23 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/UnityScript.Tests/AbstractCompilerTest.boo b/src/UnityScript.Tests/AbstractCompilerTest.boo index c0d3b97..39a5516 100644 --- a/src/UnityScript.Tests/AbstractCompilerTest.boo +++ b/src/UnityScript.Tests/AbstractCompilerTest.boo @@ -27,7 +27,6 @@ abstract class AbstractCompilerTest: compiler.Parameters.ScriptMainMethod = "Awake" compiler.Parameters.Pipeline = CreateCompilerPipeline() compiler.Parameters.References.Add(typeof(AbstractCompilerTestFixture).Assembly) - compiler.Parameters.References.Add(typeof(Assert).Assembly) compiler.Parameters.References.Add(typeof(UnityScript.Tests.CSharp.FooBarEnum).Assembly) return compiler diff --git a/tests/integration/vars-1.js b/tests/integration/vars-1.js index 3f7a80f..ad20f79 100644 --- a/tests/integration/vars-1.js +++ b/tests/integration/vars-1.js @@ -1,6 +1,5 @@ /* */ -import NUnit.Framework; import System.Reflection; var a = "foo"; @@ -12,17 +11,25 @@ var type = GetType(); function AssertField(name:String) { field = type.GetField(name, flags); - Assert.IsNotNull(field, name); + if (field == null) throw name; return field; } +function AssertIsTrue(condition:boolean, description:String) { + if (!condition) throw description; +} + +function AssertIsFalse(condition:boolean, description:String) { + if (condition) throw description; +} + fa = AssertField("a"); fb = AssertField("b"); fc = AssertField("c"); -Assert.IsTrue(fa.IsPublic, "public a"); -Assert.IsFalse(fa.IsStatic, "instance a"); -Assert.IsTrue(fb.IsPrivate, "private b"); -Assert.IsFalse(fb.IsStatic, "instance b"); -Assert.IsTrue(fc.IsPublic, "public c"); -Assert.IsTrue(fc.IsStatic, "static c"); +AssertIsTrue(fa.IsPublic, "public a"); +AssertIsFalse(fa.IsStatic, "instance a"); +AssertIsTrue(fb.IsPrivate, "private b"); +AssertIsFalse(fb.IsStatic, "instance b"); +AssertIsTrue(fc.IsPublic, "public c"); +AssertIsTrue(fc.IsStatic, "static c"); From 8cadd0ce103f6d992b363d5e5afc9474125262fa Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 26 Jan 2011 11:35:56 -0200 Subject: [PATCH 126/276] support for test scripts containing dots in their names --- refresh-tests.boo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refresh-tests.boo b/refresh-tests.boo index 968cd10..9ecb581 100755 --- a/refresh-tests.boo +++ b/refresh-tests.boo @@ -14,7 +14,7 @@ import Boo.Lang.PatternMatching // return Path.Combine(Project.BaseDirectory, path) def GetTestCaseName(fname as string): - return Path.GetFileNameWithoutExtension(fname).Replace("-", "_") + return Path.GetFileNameWithoutExtension(fname).Replace("-", "_").Replace(".", "_") def WriteTestCases(writer as TextWriter, baseDirs as string*): for baseDir in baseDirs: From a7c50af1d5115d0c487edfe102b9330ffba2f10a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 26 Jan 2011 11:36:31 -0200 Subject: [PATCH 127/276] Boo.Lang namespace shouldn't be implicitly imported --- src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo | 4 ++++ src/UnityScript/Steps/IntroduceUnityGlobalNamespaces.boo | 3 +-- .../error-messages/Boo.Lang.List-is-not-visible-by-default.js | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index 19b1bc5..2fe68ef 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -6,6 +6,10 @@ import NUnit.Framework partial class ErrorMessagesTestFixture: + [Test] def Boo_Lang_List_is_not_visible_by_default(): + RunTestCase("tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js") + + [Test] def array_instantiation_with_array_multiplication(): RunTestCase("tests/error-messages/array-instantiation-with-array-multiplication.js") diff --git a/src/UnityScript/Steps/IntroduceUnityGlobalNamespaces.boo b/src/UnityScript/Steps/IntroduceUnityGlobalNamespaces.boo index 721edb1..33dbc31 100755 --- a/src/UnityScript/Steps/IntroduceUnityGlobalNamespaces.boo +++ b/src/UnityScript/Steps/IntroduceUnityGlobalNamespaces.boo @@ -9,12 +9,11 @@ class IntroduceUnityGlobalNamespaces(AbstractCompilerStep): NameResolutionService.Reset() NameResolutionService.GlobalNamespace = NamespaceDelegator( NameResolutionService.GlobalNamespace, - SafeGetNamespace("Boo.Lang"), TypeSystemServices.BuiltinsType, SafeGetNamespace("UnityScript.Lang"), TypeSystemServices.Map(UnityScript.Lang.UnityBuiltins), TypeSystemServices.Map(UnityScript.Lang.Extensions)) def SafeGetNamespace(name as string): - ns = NameResolutionService.ResolveQualifiedName("Boo.Lang") + ns = NameResolutionService.ResolveQualifiedName(name) return ns or NullNamespace.Default diff --git a/tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js b/tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js new file mode 100644 index 0000000..ba10c3d --- /dev/null +++ b/tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js @@ -0,0 +1,4 @@ +/* +Boo.Lang.List-is-not-visible-by-default.js(4,8): BCE0018: The name 'List' does not denote a valid type ('not found'). Did you mean 'Boo.Lang.List'? +*/ +var l: List.; From 39825ab6bf368e4926fec191a7a11fe80d486cbe Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 31 Jan 2011 12:04:20 -0200 Subject: [PATCH 128/276] suggestions will come from system assemblies first --- tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js diff --git a/tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js b/tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js old mode 100644 new mode 100755 index ba10c3d..82b7897 --- a/tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js +++ b/tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js @@ -1,4 +1,4 @@ /* -Boo.Lang.List-is-not-visible-by-default.js(4,8): BCE0018: The name 'List' does not denote a valid type ('not found'). Did you mean 'Boo.Lang.List'? +Boo.Lang.List-is-not-visible-by-default.js(4,8): BCE0018: The name 'List' does not denote a valid type ('not found'). Did you mean 'System.Collections.Generic.List'? */ var l: List.; From 58a35b2ca4cc3a1476e20445e948cff1debae40c Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 26 Jan 2011 11:35:33 -0200 Subject: [PATCH 129/276] remove NUnit.Framework from the test case scripts --- .../AbstractCompilerTest.boo | 1 - tests/integration/vars-1.js | 23 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/UnityScript.Tests/AbstractCompilerTest.boo b/src/UnityScript.Tests/AbstractCompilerTest.boo index c0d3b97..39a5516 100644 --- a/src/UnityScript.Tests/AbstractCompilerTest.boo +++ b/src/UnityScript.Tests/AbstractCompilerTest.boo @@ -27,7 +27,6 @@ abstract class AbstractCompilerTest: compiler.Parameters.ScriptMainMethod = "Awake" compiler.Parameters.Pipeline = CreateCompilerPipeline() compiler.Parameters.References.Add(typeof(AbstractCompilerTestFixture).Assembly) - compiler.Parameters.References.Add(typeof(Assert).Assembly) compiler.Parameters.References.Add(typeof(UnityScript.Tests.CSharp.FooBarEnum).Assembly) return compiler diff --git a/tests/integration/vars-1.js b/tests/integration/vars-1.js index 3f7a80f..ad20f79 100644 --- a/tests/integration/vars-1.js +++ b/tests/integration/vars-1.js @@ -1,6 +1,5 @@ /* */ -import NUnit.Framework; import System.Reflection; var a = "foo"; @@ -12,17 +11,25 @@ var type = GetType(); function AssertField(name:String) { field = type.GetField(name, flags); - Assert.IsNotNull(field, name); + if (field == null) throw name; return field; } +function AssertIsTrue(condition:boolean, description:String) { + if (!condition) throw description; +} + +function AssertIsFalse(condition:boolean, description:String) { + if (condition) throw description; +} + fa = AssertField("a"); fb = AssertField("b"); fc = AssertField("c"); -Assert.IsTrue(fa.IsPublic, "public a"); -Assert.IsFalse(fa.IsStatic, "instance a"); -Assert.IsTrue(fb.IsPrivate, "private b"); -Assert.IsFalse(fb.IsStatic, "instance b"); -Assert.IsTrue(fc.IsPublic, "public c"); -Assert.IsTrue(fc.IsStatic, "static c"); +AssertIsTrue(fa.IsPublic, "public a"); +AssertIsFalse(fa.IsStatic, "instance a"); +AssertIsTrue(fb.IsPrivate, "private b"); +AssertIsFalse(fb.IsStatic, "instance b"); +AssertIsTrue(fc.IsPublic, "public c"); +AssertIsTrue(fc.IsStatic, "static c"); From aeaff52f9f7b40e5b20be2a58e3aafd5a0d6edcc Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 26 Jan 2011 11:35:56 -0200 Subject: [PATCH 130/276] support for test scripts containing dots in their names --- refresh-tests.boo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refresh-tests.boo b/refresh-tests.boo index 968cd10..9ecb581 100755 --- a/refresh-tests.boo +++ b/refresh-tests.boo @@ -14,7 +14,7 @@ import Boo.Lang.PatternMatching // return Path.Combine(Project.BaseDirectory, path) def GetTestCaseName(fname as string): - return Path.GetFileNameWithoutExtension(fname).Replace("-", "_") + return Path.GetFileNameWithoutExtension(fname).Replace("-", "_").Replace(".", "_") def WriteTestCases(writer as TextWriter, baseDirs as string*): for baseDir in baseDirs: From 398abff42916699bb6f578504fd72fc6b2efb60e Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 26 Jan 2011 11:36:31 -0200 Subject: [PATCH 131/276] Boo.Lang namespace shouldn't be implicitly imported --- src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo | 4 ++++ src/UnityScript/Steps/IntroduceUnityGlobalNamespaces.boo | 3 +-- .../error-messages/Boo.Lang.List-is-not-visible-by-default.js | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index 19b1bc5..2fe68ef 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -6,6 +6,10 @@ import NUnit.Framework partial class ErrorMessagesTestFixture: + [Test] def Boo_Lang_List_is_not_visible_by_default(): + RunTestCase("tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js") + + [Test] def array_instantiation_with_array_multiplication(): RunTestCase("tests/error-messages/array-instantiation-with-array-multiplication.js") diff --git a/src/UnityScript/Steps/IntroduceUnityGlobalNamespaces.boo b/src/UnityScript/Steps/IntroduceUnityGlobalNamespaces.boo index 721edb1..33dbc31 100755 --- a/src/UnityScript/Steps/IntroduceUnityGlobalNamespaces.boo +++ b/src/UnityScript/Steps/IntroduceUnityGlobalNamespaces.boo @@ -9,12 +9,11 @@ class IntroduceUnityGlobalNamespaces(AbstractCompilerStep): NameResolutionService.Reset() NameResolutionService.GlobalNamespace = NamespaceDelegator( NameResolutionService.GlobalNamespace, - SafeGetNamespace("Boo.Lang"), TypeSystemServices.BuiltinsType, SafeGetNamespace("UnityScript.Lang"), TypeSystemServices.Map(UnityScript.Lang.UnityBuiltins), TypeSystemServices.Map(UnityScript.Lang.Extensions)) def SafeGetNamespace(name as string): - ns = NameResolutionService.ResolveQualifiedName("Boo.Lang") + ns = NameResolutionService.ResolveQualifiedName(name) return ns or NullNamespace.Default diff --git a/tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js b/tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js new file mode 100644 index 0000000..ba10c3d --- /dev/null +++ b/tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js @@ -0,0 +1,4 @@ +/* +Boo.Lang.List-is-not-visible-by-default.js(4,8): BCE0018: The name 'List' does not denote a valid type ('not found'). Did you mean 'Boo.Lang.List'? +*/ +var l: List.; From fb379c6ab550e2521dd5eb7a4498d574c61f2663 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 31 Jan 2011 12:04:20 -0200 Subject: [PATCH 132/276] suggestions will come from system assemblies first --- tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js diff --git a/tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js b/tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js old mode 100644 new mode 100755 index ba10c3d..82b7897 --- a/tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js +++ b/tests/error-messages/Boo.Lang.List-is-not-visible-by-default.js @@ -1,4 +1,4 @@ /* -Boo.Lang.List-is-not-visible-by-default.js(4,8): BCE0018: The name 'List' does not denote a valid type ('not found'). Did you mean 'Boo.Lang.List'? +Boo.Lang.List-is-not-visible-by-default.js(4,8): BCE0018: The name 'List' does not denote a valid type ('not found'). Did you mean 'System.Collections.Generic.List'? */ var l: List.; From 1d709b3964a537410afaee5e241e32424bece320 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 2 Feb 2011 12:28:58 -0200 Subject: [PATCH 133/276] typeof for array type references (typeof(T[])) --- src/UnityScript/Parser/UnityScriptLexer.boo | 102 ++++---- src/UnityScript/Parser/UnityScriptParser.boo | 246 +++++++++++-------- src/UnityScript/UnityScript.g | 54 ++-- tests/integration/typeof-1.js | 10 +- 4 files changed, 241 insertions(+), 171 deletions(-) diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index 880582d..b70750e 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -588,8 +588,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mDIGIT(false) else: // line 1969 - goto _loop315_breakloop - :_loop315_breakloop + goto _loop313_breakloop + :_loop313_breakloop _ttype = testLiteralsTable(_ttype) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -682,17 +682,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): match("0x") - _cnt319 as int = 0 + _cnt317 as int = 0 while true: if ((tokenSet_0_.member(cast(int, cached_LA1)))): mHEXDIGIT(false) else: - if (_cnt319 >= 1): - goto _loop319_breakloop + if (_cnt317 >= 1): + goto _loop317_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt319 - :_loop319_breakloop + ++_cnt317 + :_loop317_breakloop if ((cached_LA1==char('L') or cached_LA1==char('l'))): _givenValue = cached_LA1 if ((_givenValue == char('l'))): // 1831 @@ -706,17 +706,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): else: // line 2053 pass // 947 elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt323 as int = 0 + _cnt321 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt323 >= 1): - goto _loop323_breakloop + if (_cnt321 >= 1): + goto _loop321_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt323 - :_loop323_breakloop + ++_cnt321 + :_loop321_breakloop _givenValue = cached_LA1 if ((_givenValue == char('L')) or (_givenValue ==char('l')) @@ -812,17 +812,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_SUFFIX - _cnt332 as int = 0 + _cnt330 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt332 >= 1): - goto _loop332_breakloop + if (_cnt330 >= 1): + goto _loop330_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt332 - :_loop332_breakloop + ++_cnt330 + :_loop330_breakloop if ((cached_LA1==char('E') or cached_LA1==char('e'))): mEXPONENT(false) else: // line 2053 @@ -873,17 +873,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt339 as int = 0 + _cnt337 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt339 >= 1): - goto _loop339_breakloop + if (_cnt337 >= 1): + goto _loop337_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt339 - :_loop339_breakloop + ++_cnt337 + :_loop337_breakloop if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1349,18 +1349,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched386 as bool = false + synPredMatched384 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m386 as int = mark() - synPredMatched386 = true + _m384 as int = mark() + synPredMatched384 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched386 = false - rewind(_m386) + synPredMatched384 = false + rewind(_m384) --inputState.guessing - if synPredMatched386: + if synPredMatched384: mML_COMMENT(false) if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1373,8 +1373,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop391_breakloop - :_loop391_breakloop + goto _loop389_breakloop + :_loop389_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; elif ((_givenValue == char('='))): // 1831 @@ -1403,8 +1403,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop420_breakloop - :_loop420_breakloop + goto _loop418_breakloop + :_loop418_breakloop match("*/") if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1417,7 +1417,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt395 as int = 0 + _cnt393 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1431,12 +1431,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt395 >= 1): - goto _loop395_breakloop + if (_cnt393 >= 1): + goto _loop393_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt395 - :_loop395_breakloop + ++_cnt393 + :_loop393_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1479,8 +1479,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop399_breakloop - :_loop399_breakloop + goto _loop397_breakloop + :_loop397_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1529,8 +1529,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_4_) else: - goto _loop403_breakloop - :_loop403_breakloop + goto _loop401_breakloop + :_loop401_breakloop _saveIndex = text.Length match('\'') text.Length = _saveIndex @@ -1631,17 +1631,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt423 as int = 0 + _cnt421 as int = 0 while true: if ((tokenSet_5_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt423 >= 1): - goto _loop423_breakloop + if (_cnt421 >= 1): + goto _loop421_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt423 - :_loop423_breakloop + ++_cnt421 + :_loop421_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1699,17 +1699,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt429 as int = 0 + _cnt427 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt429 >= 1): - goto _loop429_breakloop + if (_cnt427 >= 1): + goto _loop427_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt429 - :_loop429_breakloop + ++_cnt427 + :_loop427_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 8dfde81..76c9f78 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -2946,8 +2946,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop247_breakloop - :_loop247_breakloop + goto _loop245_breakloop + :_loop245_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3049,8 +3049,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ec.Add(e); else: - goto _loop213_breakloop - :_loop213_breakloop + goto _loop211_breakloop + :_loop211_breakloop elif ((_givenValue == RPAREN) or (_givenValue ==RBRACK) ): // 1827 @@ -3085,18 +3085,17 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 e=literal() + elif ((_givenValue == FUNCTION)): // 1831 + e=function_expression() + elif ((_givenValue == ID)): // 1831 + e=simple_reference_expression() + elif ((_givenValue == LPAREN)): // 1831 + e=paren_expression() elif ((_givenValue == NEW)): // 1831 e=new_expression() + elif ((_givenValue == TYPEOF)): // 1831 + e=typeof_expression() else: // line 1969 - if ((LA(1)==FUNCTION) and (LA(2)==LPAREN)): - e=function_expression() - elif ((LA(1)==ID) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 - e=simple_reference_expression() - elif ((LA(1)==LPAREN) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 - e=paren_expression() - elif ((tokenSet_52_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 - e=typeof_expression() - else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): @@ -3243,45 +3242,28 @@ class UnityScriptParser(antlr.LLkParser): public def typeof_expression() as Expression : //throws RecognitionException, TokenStreamException e as Expression - t as IToken = null try: // for error handling - _givenValue = LA(1) - if ((_givenValue == TYPEOF)): // 1831 - t = LT(1) - match(TYPEOF) - if ((LA(1)==LPAREN) and (tokenSet_14_.member(cast(int, LA(2))))): - match(LPAREN) - arg=expression() - match(RPAREN) - elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 - arg=expression() - else: - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - mie = MethodInvocationExpression(ToLexicalInfo(t)); - mie.Target = ReferenceExpression(ToLexicalInfo(t), Name: t.getText()) - mie.Arguments.Add(arg) - e = mie - elif ((_givenValue == FUNCTION) - or (_givenValue ==ID) - or (_givenValue ==LPAREN) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == LPAREN)): // 1831 + synPredMatched202 as bool = false + if ((LA(1)==TYPEOF) and (tokenSet_14_.member(cast(int, LA(2))))): + _m202 as int = mark() + synPredMatched202 = true + ++inputState.guessing + try: + match(TYPEOF) match(LPAREN) - tr=type_reference() + expression() match(RPAREN) - elif ((_givenValue == FUNCTION) - or (_givenValue ==ID) - ): // 1827 - tr=type_reference() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - e = TypeofExpression(ToLexicalInfo(t), tr); - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) + except x as RecognitionException: + synPredMatched202 = false + rewind(_m202) + --inputState.guessing + if synPredMatched202: + e=typeof_with_expression() + elif ((LA(1)==TYPEOF) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + e=typeof_expression_alt() + else: + raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3325,6 +3307,82 @@ class UnityScriptParser(antlr.LLkParser): raise return e + protected def typeof_with_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + t as IToken = null + + try: // for error handling + t = LT(1) + match(TYPEOF) + arg=expression() + if 0 == inputState.guessing: + mie = MethodInvocationExpression(ToLexicalInfo(t)); + mie.Target = ReferenceExpression(ToLexicalInfo(t), Name: t.getText()) + mie.Arguments.Add(arg) + e = mie + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_18_) + else: + raise + return e + + protected def typeof_expression_alt() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + synPredMatched205 as bool = false + if ((LA(1)==TYPEOF) and (LA(2)==LPAREN)): + _m205 as int = mark() + synPredMatched205 = true + ++inputState.guessing + try: + match(TYPEOF) + match(LPAREN) + type_reference() + match(RPAREN) + except x as RecognitionException: + synPredMatched205 = false + rewind(_m205) + --inputState.guessing + if synPredMatched205: + e=typeof_with_typeref() + elif ((LA(1)==TYPEOF) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + e=typeof_with_expression() + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_18_) + else: + raise + return e + + protected def typeof_with_typeref() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + t as IToken = null + + try: // for error handling + t = LT(1) + match(TYPEOF) + match(LPAREN) + tr=type_reference() + match(RPAREN) + if 0 == inputState.guessing: + e = TypeofExpression(ToLexicalInfo(t), tr); + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_18_) + else: + raise + return e + public def slice( se as SlicingExpression ) as void: //throws RecognitionException, TokenStreamException @@ -3461,7 +3519,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_53_) + recover(ex,tokenSet_52_) else: raise @@ -3478,7 +3536,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=atom() while true: - if ((LA(1)==LBRACK) and (tokenSet_54_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACK) and (tokenSet_53_.member(cast(int, LA(2))))): lbrack = LT(1) match(LBRACK) if 0 == inputState.guessing: @@ -3491,10 +3549,10 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) slice(se) else: - goto _loop229_breakloop - :_loop229_breakloop + goto _loop227_breakloop + :_loop227_breakloop match(RBRACK) - elif ((LA(1)==DOT) and (tokenSet_55_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DOT) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 match(DOT) e=member_reference_expression(e) elif ((LA(1)==LPAREN) and (tokenSet_20_.member(cast(int, LA(2))))): // line 2102 @@ -3508,8 +3566,8 @@ class UnityScriptParser(antlr.LLkParser): expression_list(args) match(RPAREN) else: - goto _loop232_breakloop - :_loop232_breakloop + goto _loop230_breakloop + :_loop230_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3700,8 +3758,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop243_breakloop - :_loop243_breakloop + goto _loop241_breakloop + :_loop241_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3737,8 +3795,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop251_breakloop - :_loop251_breakloop + goto _loop249_breakloop + :_loop249_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3763,7 +3821,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=shift() while true: - if ((tokenSet_56_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((tokenSet_55_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == IN) or (_givenValue ==LESS_THAN) @@ -3817,8 +3875,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop263_breakloop - :_loop263_breakloop + goto _loop261_breakloop + :_loop261_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3838,7 +3896,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=comparison() while true: - if ((tokenSet_57_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((tokenSet_56_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == EQUALITY)): // 1831 te = LT(1) @@ -3866,8 +3924,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), op, e, r) else: - goto _loop271_breakloop - :_loop271_breakloop + goto _loop269_breakloop + :_loop269_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3893,8 +3951,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop274_breakloop - :_loop274_breakloop + goto _loop272_breakloop + :_loop272_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3920,8 +3978,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop277_breakloop - :_loop277_breakloop + goto _loop275_breakloop + :_loop275_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3947,8 +4005,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop280_breakloop - :_loop280_breakloop + goto _loop278_breakloop + :_loop278_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3975,8 +4033,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop283_breakloop - :_loop283_breakloop + goto _loop281_breakloop + :_loop281_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4003,8 +4061,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop286_breakloop - :_loop286_breakloop + goto _loop284_breakloop + :_loop284_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4051,19 +4109,19 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling lbrack = LT(1) match(LBRACK) - synPredMatched294 as bool = false - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_58_.member(cast(int, LA(2))))): - _m294 as int = mark() - synPredMatched294 = true + synPredMatched292 as bool = false + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_57_.member(cast(int, LA(2))))): + _m292 as int = mark() + synPredMatched292 = true ++inputState.guessing try: expression() match(FOR) except x as RecognitionException: - synPredMatched294 = false - rewind(_m294) + synPredMatched292 = false + rewind(_m292) --inputState.guessing - if synPredMatched294: + if synPredMatched292: projection=expression() match(FOR) match(LPAREN) @@ -4091,7 +4149,7 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) - elif ((tokenSet_59_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_58_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)); items = ale.Items; expression_list(items) @@ -4152,8 +4210,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dle.Items.Add(pair); else: - goto _loop302_breakloop - :_loop302_breakloop + goto _loop300_breakloop + :_loop300_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 @@ -4638,35 +4696,31 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) private static def mk_tokenSet_52_() as (long): - data = (612498345415671808L, 0L, ) + data = (-9223372036854775808L, 2L, 0L, 0L, ) return data public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) private static def mk_tokenSet_53_() as (long): - data = (-9223372036854775808L, 2L, 0L, 0L, ) + data = (5440360169815162880L, 8589935663105L, 0L, 0L, ) return data public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) private static def mk_tokenSet_54_() as (long): - data = (5440360169815162880L, 8589935663105L, 0L, 0L, ) + data = (36028865738964992L, 8388608L, 0L, 0L, ) return data public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) private static def mk_tokenSet_55_() as (long): - data = (36028865738964992L, 8388608L, 0L, 0L, ) + data = (41943040L, 427819008L, 0L, 0L, ) return data public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) private static def mk_tokenSet_56_() as (long): - data = (41943040L, 427819008L, 0L, 0L, ) + data = (0L, 6684672L, 0L, 0L, ) return data public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) private static def mk_tokenSet_57_() as (long): - data = (0L, 6684672L, 0L, 0L, ) + data = (3422747536795254864L, 8728380176823L, 0L, 0L, ) return data public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) private static def mk_tokenSet_58_() as (long): - data = (3422747536795254864L, 8728380176823L, 0L, 0L, ) - return data - public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) - private static def mk_tokenSet_59_() as (long): data = (828674151387774976L, 8589935663107L, 0L, 0L, ) return data - public static final tokenSet_59_ = BitSet(mk_tokenSet_59_()) + public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index a0a47e1..1274d49 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -1203,30 +1203,38 @@ paren_expression returns [Expression e] typeof_expression returns [Expression e] { }: - t:TYPEOF - - ((LPAREN)? expression)=>( - ( - (LPAREN arg=expression RPAREN) - | arg=expression - ) - { - mie = MethodInvocationExpression(ToLexicalInfo(t)); - mie.Target = ReferenceExpression(ToLexicalInfo(t), Name: t.getText()) - mie.Arguments.Add(arg) + (TYPEOF LPAREN expression RPAREN)=>e=typeof_with_expression + | e=typeof_expression_alt // workaround antlr boo backend bug that only allows a single predicate per rule +; + +protected +typeof_expression_alt returns [Expression e] +{ +}: + (TYPEOF LPAREN type_reference RPAREN)=>e=typeof_with_typeref + | e=typeof_with_expression +; + +protected +typeof_with_expression returns [Expression e] +{ +}: + t:TYPEOF arg=expression + { + mie = MethodInvocationExpression(ToLexicalInfo(t)); + mie.Target = ReferenceExpression(ToLexicalInfo(t), Name: t.getText()) + mie.Arguments.Add(arg) - e = mie - } - ) - |( - ( - (LPAREN tr=type_reference RPAREN) - | tr=type_reference - ) - { - e = TypeofExpression(ToLexicalInfo(t), tr); - } - ) + e = mie + } +; + +protected +typeof_with_typeref returns [Expression e] +{ +}: + t:TYPEOF LPAREN tr=type_reference RPAREN + { e = TypeofExpression(ToLexicalInfo(t), tr); } ; expression_list[ExpressionCollection ec] diff --git a/tests/integration/typeof-1.js b/tests/integration/typeof-1.js index a17c8e2..3c25d12 100644 --- a/tests/integration/typeof-1.js +++ b/tests/integration/typeof-1.js @@ -1,6 +1,9 @@ /* System.Int32 Foo +Foo +Foo[] +System.String */ import UnityScript.Tests; @@ -9,4 +12,9 @@ class Foo { print(typeof(1)); test = new Foo(); -print(typeof(test)); \ No newline at end of file +print(typeof(test)); +print(typeof(Foo)); +print(typeof(Foo[])); + +var a = ["foo"]; +print(typeof(a[0])); \ No newline at end of file From 5589edda02c5f77bb16001dc45df70dab5826207 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 2 Feb 2011 14:38:18 -0200 Subject: [PATCH 134/276] "typeof(T).Name" must not be parsed as "typeof(T.Name)" --- .../ParserTestFixture.Generated.boo | 4 + src/UnityScript/Parser/UnityScriptLexer.boo | 102 +++++++++--------- src/UnityScript/Parser/UnityScriptParser.boo | 77 +++++++------ src/UnityScript/UnityScript.g | 6 +- tests/parser/typeof-1.js | 5 + 5 files changed, 107 insertions(+), 87 deletions(-) create mode 100644 tests/parser/typeof-1.js diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index 385ff8a..8f38ec9 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -238,6 +238,10 @@ partial class ParserTestFixture: RunTestCase("tests/parser/try-finally.js") + [Test] def typeof_1(): + RunTestCase("tests/parser/typeof-1.js") + + [Test] def var_1(): RunTestCase("tests/parser/var-1.js") diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index b70750e..880582d 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -588,8 +588,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mDIGIT(false) else: // line 1969 - goto _loop313_breakloop - :_loop313_breakloop + goto _loop315_breakloop + :_loop315_breakloop _ttype = testLiteralsTable(_ttype) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -682,17 +682,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): match("0x") - _cnt317 as int = 0 + _cnt319 as int = 0 while true: if ((tokenSet_0_.member(cast(int, cached_LA1)))): mHEXDIGIT(false) else: - if (_cnt317 >= 1): - goto _loop317_breakloop + if (_cnt319 >= 1): + goto _loop319_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt317 - :_loop317_breakloop + ++_cnt319 + :_loop319_breakloop if ((cached_LA1==char('L') or cached_LA1==char('l'))): _givenValue = cached_LA1 if ((_givenValue == char('l'))): // 1831 @@ -706,17 +706,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): else: // line 2053 pass // 947 elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt321 as int = 0 + _cnt323 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt321 >= 1): - goto _loop321_breakloop + if (_cnt323 >= 1): + goto _loop323_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt321 - :_loop321_breakloop + ++_cnt323 + :_loop323_breakloop _givenValue = cached_LA1 if ((_givenValue == char('L')) or (_givenValue ==char('l')) @@ -812,17 +812,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_SUFFIX - _cnt330 as int = 0 + _cnt332 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt330 >= 1): - goto _loop330_breakloop + if (_cnt332 >= 1): + goto _loop332_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt330 - :_loop330_breakloop + ++_cnt332 + :_loop332_breakloop if ((cached_LA1==char('E') or cached_LA1==char('e'))): mEXPONENT(false) else: // line 2053 @@ -873,17 +873,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt337 as int = 0 + _cnt339 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt337 >= 1): - goto _loop337_breakloop + if (_cnt339 >= 1): + goto _loop339_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt337 - :_loop337_breakloop + ++_cnt339 + :_loop339_breakloop if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1349,18 +1349,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched384 as bool = false + synPredMatched386 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m384 as int = mark() - synPredMatched384 = true + _m386 as int = mark() + synPredMatched386 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched384 = false - rewind(_m384) + synPredMatched386 = false + rewind(_m386) --inputState.guessing - if synPredMatched384: + if synPredMatched386: mML_COMMENT(false) if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1373,8 +1373,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop389_breakloop - :_loop389_breakloop + goto _loop391_breakloop + :_loop391_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; elif ((_givenValue == char('='))): // 1831 @@ -1403,8 +1403,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop418_breakloop - :_loop418_breakloop + goto _loop420_breakloop + :_loop420_breakloop match("*/") if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1417,7 +1417,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt393 as int = 0 + _cnt395 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1431,12 +1431,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt393 >= 1): - goto _loop393_breakloop + if (_cnt395 >= 1): + goto _loop395_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt393 - :_loop393_breakloop + ++_cnt395 + :_loop395_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1479,8 +1479,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop397_breakloop - :_loop397_breakloop + goto _loop399_breakloop + :_loop399_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1529,8 +1529,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_4_) else: - goto _loop401_breakloop - :_loop401_breakloop + goto _loop403_breakloop + :_loop403_breakloop _saveIndex = text.Length match('\'') text.Length = _saveIndex @@ -1631,17 +1631,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt421 as int = 0 + _cnt423 as int = 0 while true: if ((tokenSet_5_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt421 >= 1): - goto _loop421_breakloop + if (_cnt423 >= 1): + goto _loop423_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt421 - :_loop421_breakloop + ++_cnt423 + :_loop423_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1699,17 +1699,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt427 as int = 0 + _cnt429 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt427 >= 1): - goto _loop427_breakloop + if (_cnt429 >= 1): + goto _loop429_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt427 - :_loop427_breakloop + ++_cnt429 + :_loop429_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 76c9f78..190d801 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -2946,8 +2946,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop245_breakloop - :_loop245_breakloop + goto _loop247_breakloop + :_loop247_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3049,8 +3049,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ec.Add(e); else: - goto _loop211_breakloop - :_loop211_breakloop + goto _loop213_breakloop + :_loop213_breakloop elif ((_givenValue == RPAREN) or (_givenValue ==RBRACK) ): // 1827 @@ -3315,7 +3315,14 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling t = LT(1) match(TYPEOF) - arg=expression() + if ((LA(1)==LPAREN) and (tokenSet_14_.member(cast(int, LA(2))))): + match(LPAREN) + arg=expression() + match(RPAREN) + elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + arg=expression() + else: + raise NoViableAltException(LT(1), getFilename()) if 0 == inputState.guessing: mie = MethodInvocationExpression(ToLexicalInfo(t)); mie.Target = ReferenceExpression(ToLexicalInfo(t), Name: t.getText()) @@ -3549,8 +3556,8 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) slice(se) else: - goto _loop227_breakloop - :_loop227_breakloop + goto _loop229_breakloop + :_loop229_breakloop match(RBRACK) elif ((LA(1)==DOT) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 match(DOT) @@ -3566,8 +3573,8 @@ class UnityScriptParser(antlr.LLkParser): expression_list(args) match(RPAREN) else: - goto _loop230_breakloop - :_loop230_breakloop + goto _loop232_breakloop + :_loop232_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3758,8 +3765,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop241_breakloop - :_loop241_breakloop + goto _loop243_breakloop + :_loop243_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3795,8 +3802,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop249_breakloop - :_loop249_breakloop + goto _loop251_breakloop + :_loop251_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3875,8 +3882,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop261_breakloop - :_loop261_breakloop + goto _loop263_breakloop + :_loop263_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3924,8 +3931,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), op, e, r) else: - goto _loop269_breakloop - :_loop269_breakloop + goto _loop271_breakloop + :_loop271_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3951,8 +3958,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop272_breakloop - :_loop272_breakloop + goto _loop274_breakloop + :_loop274_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3978,8 +3985,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop275_breakloop - :_loop275_breakloop + goto _loop277_breakloop + :_loop277_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4005,8 +4012,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop278_breakloop - :_loop278_breakloop + goto _loop280_breakloop + :_loop280_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4033,8 +4040,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop281_breakloop - :_loop281_breakloop + goto _loop283_breakloop + :_loop283_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4061,8 +4068,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop284_breakloop - :_loop284_breakloop + goto _loop286_breakloop + :_loop286_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4109,19 +4116,19 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling lbrack = LT(1) match(LBRACK) - synPredMatched292 as bool = false + synPredMatched294 as bool = false if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_57_.member(cast(int, LA(2))))): - _m292 as int = mark() - synPredMatched292 = true + _m294 as int = mark() + synPredMatched294 = true ++inputState.guessing try: expression() match(FOR) except x as RecognitionException: - synPredMatched292 = false - rewind(_m292) + synPredMatched294 = false + rewind(_m294) --inputState.guessing - if synPredMatched292: + if synPredMatched294: projection=expression() match(FOR) match(LPAREN) @@ -4210,8 +4217,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dle.Items.Add(pair); else: - goto _loop300_breakloop - :_loop300_breakloop + goto _loop302_breakloop + :_loop302_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 1274d49..81cdb3c 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -1219,7 +1219,11 @@ protected typeof_with_expression returns [Expression e] { }: - t:TYPEOF arg=expression + t:TYPEOF + ( + (LPAREN arg=expression RPAREN) + | arg=expression + ) { mie = MethodInvocationExpression(ToLexicalInfo(t)); mie.Target = ReferenceExpression(ToLexicalInfo(t), Name: t.getText()) diff --git a/tests/parser/typeof-1.js b/tests/parser/typeof-1.js new file mode 100644 index 0000000..6642032 --- /dev/null +++ b/tests/parser/typeof-1.js @@ -0,0 +1,5 @@ +/* +print(typeof(String).Name) +*/ + +print(typeof(String).Name); \ No newline at end of file From c7cf45bd722f6c554da954dd7d80d1490d798edb Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 2 Feb 2011 14:39:40 -0200 Subject: [PATCH 135/276] test case for typeof(T) being used as target of member reference --- src/UnityScript.Tests/DuckyIntegrationTestFixture.boo | 4 ++++ src/UnityScript.Tests/StrictIntegrationTestFixture.boo | 4 ++++ src/UnityScript/Steps/ProcessUnityScriptMethods.boo | 3 +-- tests/integration/typeof-2.js | 5 +++++ 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 tests/integration/typeof-2.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 6f7f744..e61c225 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -555,6 +555,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/typeof-1.js") + [Test] def typeof_2(): + RunTestCase("tests/integration/typeof-2.js") + + [Test] def types_1(): RunTestCase("tests/integration/types-1.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index 653de0e..78980b1 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -557,6 +557,10 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/typeof-1.js") + [Test] def typeof_2(): + RunTestCase("tests/integration/typeof-2.js") + + [Test] def types_1(): RunTestCase("tests/integration/types-1.js") diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index a1fef1f..06dad43 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -142,8 +142,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): return node.Target = CodeBuilder.CreateReference(_UnityRuntimeServices_GetTypeOf) - BindExpressionType(node, TypeSystemServices.TypeType) - + BindExpressionType(node, TypeSystemServices.TypeType) override protected def ProcessMethodInvocation(node as MethodInvocationExpression, targetEntity as IEntity): """ diff --git a/tests/integration/typeof-2.js b/tests/integration/typeof-2.js new file mode 100644 index 0000000..91bb013 --- /dev/null +++ b/tests/integration/typeof-2.js @@ -0,0 +1,5 @@ +/* +String +*/ + +print(typeof(String).Name); \ No newline at end of file From 0a82f1e644b652975ea9383dbc15557ded842fb7 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 7 Feb 2011 09:51:34 -0200 Subject: [PATCH 136/276] parameterize nunit-console executable --- default.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/default.build b/default.build index c733d11..8ed462b 100755 --- a/default.build +++ b/default.build @@ -14,6 +14,7 @@ + @@ -21,7 +22,7 @@ - + From 3ddb28bc5e5b32173cc9d36e279194efe89c6590 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 7 Feb 2011 09:59:53 -0200 Subject: [PATCH 137/276] update boo project references to 2.0.9.5 --- src/UnityScript.Lang/UnityScript.Lang.booproj | 2 +- src/UnityScript.Tests/UnityScript.Tests.booproj | 14 +++++++------- src/UnityScript/UnityScript.booproj | 10 +++++----- src/us/us.booproj | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/UnityScript.Lang/UnityScript.Lang.booproj b/src/UnityScript.Lang/UnityScript.Lang.booproj index b8554ef..0c11462 100755 --- a/src/UnityScript.Lang/UnityScript.Lang.booproj +++ b/src/UnityScript.Lang/UnityScript.Lang.booproj @@ -33,7 +33,7 @@ - + diff --git a/src/UnityScript.Tests/UnityScript.Tests.booproj b/src/UnityScript.Tests/UnityScript.Tests.booproj index 6df757b..2944cae 100755 --- a/src/UnityScript.Tests/UnityScript.Tests.booproj +++ b/src/UnityScript.Tests/UnityScript.Tests.booproj @@ -32,13 +32,13 @@ - - - - - - - + + + + + + + diff --git a/src/UnityScript/UnityScript.booproj b/src/UnityScript/UnityScript.booproj index 0161e94..13340fa 100755 --- a/src/UnityScript/UnityScript.booproj +++ b/src/UnityScript/UnityScript.booproj @@ -33,11 +33,11 @@ - - - - - + + + + + diff --git a/src/us/us.booproj b/src/us/us.booproj index 8024241..5953b58 100755 --- a/src/us/us.booproj +++ b/src/us/us.booproj @@ -31,8 +31,8 @@ - - + + From 787b74a87f94ce270b1c9fa3646d0fc2e5eac693 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 7 Feb 2011 12:13:48 -0200 Subject: [PATCH 138/276] fix for #pragma followed by id swallowing it in --- .../ParserTestFixture.Generated.boo | 4 + src/UnityScript/Parser/UnityScriptLexer.boo | 418 ++++++------ src/UnityScript/Parser/UnityScriptParser.boo | 595 +++++++++--------- .../Parser/UnityScriptTokenTypes.boo | 130 ++-- .../Parser/UnityScriptTokenTypes.txt | 130 ++-- src/UnityScript/UnityScript.g | 15 +- .../pragma-strict-followed-by-identifier.js | 6 + 7 files changed, 681 insertions(+), 617 deletions(-) create mode 100644 tests/parser/pragma-strict-followed-by-identifier.js diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index 8f38ec9..7f847f3 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -218,6 +218,10 @@ partial class ParserTestFixture: RunTestCase("tests/parser/plusplus-minusminus.js") + [Test] def pragma_strict_followed_by_identifier(): + RunTestCase("tests/parser/pragma-strict-followed-by-identifier.js") + + [Test] def scientific_notation(): RunTestCase("tests/parser/scientific-notation.js") diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index 880582d..aa55acb 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -62,71 +62,71 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): public static final INTERNAL = 31 public static final OVERRIDE = 32 public static final PARTIAL = 33 - public static final PRAGMA = 34 - public static final PRIVATE = 35 - public static final SET = 36 - public static final STATIC = 37 - public static final SUPER = 38 - public static final THIS = 39 - public static final THROW = 40 - public static final TRUE = 41 - public static final TRY = 42 - public static final TYPEOF = 43 - public static final VAR = 44 - public static final VIRTUAL = 45 - public static final WHILE = 46 - public static final YIELD = 47 - public static final SWITCH = 48 - public static final CASE = 49 - public static final DEFAULT = 50 - public static final INPLACE_DIVISION = 51 - public static final INPLACE_ADD = 52 - public static final INPLACE_SUBTRACT = 53 - public static final INPLACE_MULTIPLY = 54 - public static final ID = 55 - public static final DOUBLE_QUOTED_STRING = 56 - public static final LBRACE = 57 - public static final RBRACE = 58 - public static final LPAREN = 59 - public static final RPAREN = 60 - public static final DOT = 61 - public static final COLON = 62 - public static final COMMA = 63 - public static final LBRACK = 64 - public static final RBRACK = 65 - public static final BITWISE_OR = 66 - public static final INPLACE_BITWISE_OR = 67 - public static final BITWISE_AND = 68 - public static final BITWISE_XOR = 69 - public static final INPLACE_BITWISE_AND = 70 - public static final LOGICAL_OR = 71 - public static final LOGICAL_AND = 72 - public static final EOS = 73 - public static final ASSIGN = 74 - public static final INCREMENT = 75 - public static final DECREMENT = 76 - public static final ADD = 77 - public static final SUBTRACT = 78 - public static final MODULUS = 79 - public static final MULTIPLY = 80 - public static final EQUALITY = 81 - public static final INEQUALITY = 82 - public static final QUESTION_MARK = 83 - public static final BITWISE_NOT = 84 - public static final REFERENCE_EQUALITY = 85 - public static final REFERENCE_INEQUALITY = 86 - public static final LESS_THAN = 87 - public static final LESS_THAN_OR_EQUAL = 88 - public static final SHIFT_LEFT = 89 - public static final INPLACE_SHIFT_LEFT = 90 - public static final GREATER_THAN = 91 - public static final GREATER_THAN_OR_EQUAL = 92 - public static final SHIFT_RIGHT = 93 - public static final INPLACE_SHIFT_RIGHT = 94 - public static final AT = 95 - public static final SCRIPT_ATTRIBUTE_MARKER = 96 - public static final ASSEMBLY_ATTRIBUTE_MARKER = 97 - public static final HASH = 98 + public static final PRIVATE = 34 + public static final SET = 35 + public static final STATIC = 36 + public static final SUPER = 37 + public static final THIS = 38 + public static final THROW = 39 + public static final TRUE = 40 + public static final TRY = 41 + public static final TYPEOF = 42 + public static final VAR = 43 + public static final VIRTUAL = 44 + public static final WHILE = 45 + public static final YIELD = 46 + public static final SWITCH = 47 + public static final CASE = 48 + public static final DEFAULT = 49 + public static final INPLACE_DIVISION = 50 + public static final INPLACE_ADD = 51 + public static final INPLACE_SUBTRACT = 52 + public static final INPLACE_MULTIPLY = 53 + public static final PRAGMA_ON = 54 + public static final PRAGMA_OFF = 55 + public static final ID = 56 + public static final DOUBLE_QUOTED_STRING = 57 + public static final LBRACE = 58 + public static final RBRACE = 59 + public static final LPAREN = 60 + public static final RPAREN = 61 + public static final DOT = 62 + public static final COLON = 63 + public static final COMMA = 64 + public static final LBRACK = 65 + public static final RBRACK = 66 + public static final BITWISE_OR = 67 + public static final INPLACE_BITWISE_OR = 68 + public static final BITWISE_AND = 69 + public static final BITWISE_XOR = 70 + public static final INPLACE_BITWISE_AND = 71 + public static final LOGICAL_OR = 72 + public static final LOGICAL_AND = 73 + public static final EOS = 74 + public static final ASSIGN = 75 + public static final INCREMENT = 76 + public static final DECREMENT = 77 + public static final ADD = 78 + public static final SUBTRACT = 79 + public static final MODULUS = 80 + public static final MULTIPLY = 81 + public static final EQUALITY = 82 + public static final INEQUALITY = 83 + public static final QUESTION_MARK = 84 + public static final BITWISE_NOT = 85 + public static final REFERENCE_EQUALITY = 86 + public static final REFERENCE_INEQUALITY = 87 + public static final LESS_THAN = 88 + public static final LESS_THAN_OR_EQUAL = 89 + public static final SHIFT_LEFT = 90 + public static final INPLACE_SHIFT_LEFT = 91 + public static final GREATER_THAN = 92 + public static final GREATER_THAN_OR_EQUAL = 93 + public static final SHIFT_RIGHT = 94 + public static final INPLACE_SHIFT_RIGHT = 95 + public static final AT = 96 + public static final SCRIPT_ATTRIBUTE_MARKER = 97 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 98 public static final INPLACE_BITWISE_XOR = 99 public static final NOT = 100 public static final DIVISION = 101 @@ -169,100 +169,101 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): caseSensitiveLiterals = true setCaseSensitive(true) literals = Hashtable(100, 0.4, null, Comparer.Default) - literals.Add(",", 63) + literals.Add(",", 64) literals.Add("public", 29) - literals.Add("a string", 56) - literals.Add("an identifier", 55) - literals.Add("]", 65) - literals.Add("case", 49) + literals.Add("a string", 57) + literals.Add("an identifier", 56) + literals.Add("]", 66) + literals.Add("case", 48) literals.Add("break", 5) - literals.Add("while", 46) + literals.Add("while", 45) literals.Add("new", 26) - literals.Add("||", 71) - literals.Add("+", 77) + literals.Add("||", 72) + literals.Add("+", 78) literals.Add("instanceof", 25) literals.Add("implements", 22) - literals.Add("*", 80) - literals.Add("|=", 67) - literals.Add("typeof", 43) - literals.Add("@assembly", 97) - literals.Add("[", 64) - literals.Add(">>=", 94) + literals.Add("*", 81) + literals.Add("|=", 68) + literals.Add("typeof", 42) + literals.Add("@assembly", 98) + literals.Add("[", 65) + literals.Add(">>=", 95) literals.Add("return", 28) - literals.Add("throw", 40) - literals.Add("var", 44) - literals.Add(")", 60) - literals.Add("==", 81) + literals.Add("throw", 39) + literals.Add("var", 43) + literals.Add(")", 61) + literals.Add("==", 82) literals.Add("null", 27) literals.Add("protected", 30) - literals.Add("@script", 96) + literals.Add("pragma off", 55) + literals.Add("@script", 97) literals.Add("class", 8) - literals.Add("(", 59) + literals.Add("(", 60) literals.Add("do", 10) - literals.Add("~", 84) + literals.Add("~", 85) literals.Add("function", 18) - literals.Add("/=", 51) - literals.Add("super", 38) - literals.Add("@", 95) - literals.Add("-=", 53) - literals.Add("set", 36) - literals.Add("+=", 52) - literals.Add("!==", 86) - literals.Add("}", 58) + literals.Add("/=", 50) + literals.Add("super", 37) + literals.Add("@", 96) + literals.Add("-=", 52) + literals.Add("set", 35) + literals.Add("+=", 51) + literals.Add("!==", 87) + literals.Add("}", 59) literals.Add("interface", 24) - literals.Add("?", 83) - literals.Add("&", 68) + literals.Add("?", 84) + literals.Add("&", 69) literals.Add("internal", 31) literals.Add("final", 15) - literals.Add("yield", 47) - literals.Add("!=", 82) - literals.Add("===", 85) + literals.Add("yield", 46) + literals.Add("!=", 83) + literals.Add("===", 86) literals.Add("if", 20) - literals.Add("|", 66) + literals.Add("|", 67) literals.Add("override", 32) - literals.Add(">", 91) + literals.Add(">", 92) literals.Add("as", 4) - literals.Add("%", 79) - literals.Add("pragma", 34) + literals.Add("%", 80) literals.Add("catch", 7) - literals.Add("try", 42) - literals.Add("{", 57) - literals.Add("=", 74) + literals.Add("try", 41) + literals.Add("{", 58) + literals.Add("=", 75) literals.Add("enum", 12) literals.Add("for", 17) - literals.Add(">>", 93) + literals.Add(">>", 94) literals.Add("extends", 13) - literals.Add("private", 35) - literals.Add("default", 50) - literals.Add("--", 76) - literals.Add("<", 87) + literals.Add("private", 34) + literals.Add("default", 49) + literals.Add("--", 77) + literals.Add("<", 88) literals.Add("false", 14) - literals.Add("this", 39) - literals.Add("static", 37) - literals.Add(">=", 92) - literals.Add("<=", 88) + literals.Add("this", 38) + literals.Add("static", 36) + literals.Add(">=", 93) + literals.Add("<=", 89) literals.Add("partial", 33) - literals.Add(";", 73) + literals.Add(";", 74) literals.Add("get", 19) - literals.Add("<<=", 90) + literals.Add("<<=", 91) literals.Add("continue", 9) - literals.Add("&&", 72) + literals.Add("&&", 73) literals.Add("cast", 6) - literals.Add("<<", 89) - literals.Add(".", 61) + literals.Add("<<", 90) + literals.Add("pragma on", 54) + literals.Add(".", 62) literals.Add("finally", 16) literals.Add("else", 11) literals.Add("import", 21) - literals.Add("++", 75) - literals.Add(":", 62) + literals.Add("++", 76) + literals.Add(":", 63) literals.Add("in", 23) - literals.Add("switch", 48) - literals.Add("true", 41) - literals.Add("-", 78) - literals.Add("*=", 54) - literals.Add("virtual", 45) - literals.Add("^", 69) - literals.Add("&=", 70) + literals.Add("switch", 47) + literals.Add("true", 40) + literals.Add("-", 79) + literals.Add("*=", 53) + literals.Add("virtual", 44) + literals.Add("^", 70) + literals.Add("&=", 71) override def nextToken() as IToken: theRetToken as IToken @@ -374,7 +375,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): mEOS(true) theRetToken = returnToken_ elif ((_givenValue == char('#'))): // 1831 - mHASH(true) + mPRAGMA_ON(true) theRetToken = returnToken_ elif ((_givenValue == char('%'))): // 1831 mMODULUS(true) @@ -1115,11 +1116,82 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _token.setText(text.ToString(_begin, text.Length-_begin)) returnToken_ = _token - public def mHASH(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + public def mPRAGMA_ON(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException _ttype as int; _token as IToken; _begin = text.Length; - _ttype = HASH + _ttype = PRAGMA_ON + id as IToken - match('#') + _saveIndex = text.Length + match("#pragma") + text.Length = _saveIndex + _cnt363 as int = 0 + while true: + if ((cached_LA1==char(' '))): + _saveIndex = text.Length + match(' ') + text.Length = _saveIndex + else: + if (_cnt363 >= 1): + goto _loop363_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt363 + :_loop363_breakloop + mID(true) + id = returnToken_ + if ((cached_LA1==char(' ')) and (cached_LA2==char('o'))): + _saveIndex = text.Length + match(' ') + text.Length = _saveIndex + if ((cached_LA1==char('o')) and (cached_LA2==char('f'))): + _saveIndex = text.Length + match("off") + text.Length = _saveIndex + if 0 == inputState.guessing: + _ttype = PRAGMA_OFF; + elif ((cached_LA1==char('o')) and (cached_LA2==char('n'))): // line 2102 + _saveIndex = text.Length + match("on") + text.Length = _saveIndex + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + elif ((cached_LA1==char('\n') or cached_LA1==char('\r') or cached_LA1==char(' ')) and (true)): // line 2102 + pass // 947 + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + while true: + if ((cached_LA1==char(' '))): + _saveIndex = text.Length + match(' ') + text.Length = _saveIndex + else: + goto _loop368_breakloop + :_loop368_breakloop + _saveIndex = text.Length + mNEWLINE(false) + text.Length = _saveIndex + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mNEWLINE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = NEWLINE + + _givenValue = cached_LA1 + if ((_givenValue == char('\n'))): // 1831 + match('\n') + elif ((_givenValue == char('\r'))): // 1831 + match('\r') + if ((cached_LA1==char('\n')) and (true) and (true)): + match('\n') + else: // line 2053 + pass // 947 + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if 0 == inputState.guessing: + newline(); if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1349,18 +1421,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched386 as bool = false + synPredMatched393 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m386 as int = mark() - synPredMatched386 = true + _m393 as int = mark() + synPredMatched393 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched386 = false - rewind(_m386) + synPredMatched393 = false + rewind(_m393) --inputState.guessing - if synPredMatched386: + if synPredMatched393: mML_COMMENT(false) if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1373,8 +1445,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop391_breakloop - :_loop391_breakloop + goto _loop398_breakloop + :_loop398_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; elif ((_givenValue == char('='))): // 1831 @@ -1403,8 +1475,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop420_breakloop - :_loop420_breakloop + goto _loop427_breakloop + :_loop427_breakloop match("*/") if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1417,7 +1489,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt395 as int = 0 + _cnt402 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1431,12 +1503,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt395 >= 1): - goto _loop395_breakloop + if (_cnt402 >= 1): + goto _loop402_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt395 - :_loop395_breakloop + ++_cnt402 + :_loop402_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1444,28 +1516,6 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _token.setText(text.ToString(_begin, text.Length-_begin)) returnToken_ = _token - protected def mNEWLINE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = NEWLINE - - _givenValue = cached_LA1 - if ((_givenValue == char('\n'))): // 1831 - match('\n') - elif ((_givenValue == char('\r'))): // 1831 - match('\r') - if ((cached_LA1==char('\n')) and (true) and (true)): - match('\n') - else: // line 2053 - pass // 947 - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if 0 == inputState.guessing: - newline(); - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - public def mDOUBLE_QUOTED_STRING(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_QUOTED_STRING @@ -1479,8 +1529,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop399_breakloop - :_loop399_breakloop + goto _loop406_breakloop + :_loop406_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1529,8 +1579,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_4_) else: - goto _loop403_breakloop - :_loop403_breakloop + goto _loop410_breakloop + :_loop410_breakloop _saveIndex = text.Length match('\'') text.Length = _saveIndex @@ -1631,17 +1681,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt423 as int = 0 + _cnt430 as int = 0 while true: if ((tokenSet_5_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt423 >= 1): - goto _loop423_breakloop + if (_cnt430 >= 1): + goto _loop430_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt423 - :_loop423_breakloop + ++_cnt430 + :_loop430_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1699,17 +1749,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt429 as int = 0 + _cnt436 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt429 >= 1): - goto _loop429_breakloop + if (_cnt436 >= 1): + goto _loop436_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt429 - :_loop429_breakloop + ++_cnt436 + :_loop436_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 190d801..1f83a8c 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -60,71 +60,71 @@ class UnityScriptParser(antlr.LLkParser): public static final INTERNAL = 31 public static final OVERRIDE = 32 public static final PARTIAL = 33 - public static final PRAGMA = 34 - public static final PRIVATE = 35 - public static final SET = 36 - public static final STATIC = 37 - public static final SUPER = 38 - public static final THIS = 39 - public static final THROW = 40 - public static final TRUE = 41 - public static final TRY = 42 - public static final TYPEOF = 43 - public static final VAR = 44 - public static final VIRTUAL = 45 - public static final WHILE = 46 - public static final YIELD = 47 - public static final SWITCH = 48 - public static final CASE = 49 - public static final DEFAULT = 50 - public static final INPLACE_DIVISION = 51 - public static final INPLACE_ADD = 52 - public static final INPLACE_SUBTRACT = 53 - public static final INPLACE_MULTIPLY = 54 - public static final ID = 55 - public static final DOUBLE_QUOTED_STRING = 56 - public static final LBRACE = 57 - public static final RBRACE = 58 - public static final LPAREN = 59 - public static final RPAREN = 60 - public static final DOT = 61 - public static final COLON = 62 - public static final COMMA = 63 - public static final LBRACK = 64 - public static final RBRACK = 65 - public static final BITWISE_OR = 66 - public static final INPLACE_BITWISE_OR = 67 - public static final BITWISE_AND = 68 - public static final BITWISE_XOR = 69 - public static final INPLACE_BITWISE_AND = 70 - public static final LOGICAL_OR = 71 - public static final LOGICAL_AND = 72 - public static final EOS = 73 - public static final ASSIGN = 74 - public static final INCREMENT = 75 - public static final DECREMENT = 76 - public static final ADD = 77 - public static final SUBTRACT = 78 - public static final MODULUS = 79 - public static final MULTIPLY = 80 - public static final EQUALITY = 81 - public static final INEQUALITY = 82 - public static final QUESTION_MARK = 83 - public static final BITWISE_NOT = 84 - public static final REFERENCE_EQUALITY = 85 - public static final REFERENCE_INEQUALITY = 86 - public static final LESS_THAN = 87 - public static final LESS_THAN_OR_EQUAL = 88 - public static final SHIFT_LEFT = 89 - public static final INPLACE_SHIFT_LEFT = 90 - public static final GREATER_THAN = 91 - public static final GREATER_THAN_OR_EQUAL = 92 - public static final SHIFT_RIGHT = 93 - public static final INPLACE_SHIFT_RIGHT = 94 - public static final AT = 95 - public static final SCRIPT_ATTRIBUTE_MARKER = 96 - public static final ASSEMBLY_ATTRIBUTE_MARKER = 97 - public static final HASH = 98 + public static final PRIVATE = 34 + public static final SET = 35 + public static final STATIC = 36 + public static final SUPER = 37 + public static final THIS = 38 + public static final THROW = 39 + public static final TRUE = 40 + public static final TRY = 41 + public static final TYPEOF = 42 + public static final VAR = 43 + public static final VIRTUAL = 44 + public static final WHILE = 45 + public static final YIELD = 46 + public static final SWITCH = 47 + public static final CASE = 48 + public static final DEFAULT = 49 + public static final INPLACE_DIVISION = 50 + public static final INPLACE_ADD = 51 + public static final INPLACE_SUBTRACT = 52 + public static final INPLACE_MULTIPLY = 53 + public static final PRAGMA_ON = 54 + public static final PRAGMA_OFF = 55 + public static final ID = 56 + public static final DOUBLE_QUOTED_STRING = 57 + public static final LBRACE = 58 + public static final RBRACE = 59 + public static final LPAREN = 60 + public static final RPAREN = 61 + public static final DOT = 62 + public static final COLON = 63 + public static final COMMA = 64 + public static final LBRACK = 65 + public static final RBRACK = 66 + public static final BITWISE_OR = 67 + public static final INPLACE_BITWISE_OR = 68 + public static final BITWISE_AND = 69 + public static final BITWISE_XOR = 70 + public static final INPLACE_BITWISE_AND = 71 + public static final LOGICAL_OR = 72 + public static final LOGICAL_AND = 73 + public static final EOS = 74 + public static final ASSIGN = 75 + public static final INCREMENT = 76 + public static final DECREMENT = 77 + public static final ADD = 78 + public static final SUBTRACT = 79 + public static final MODULUS = 80 + public static final MULTIPLY = 81 + public static final EQUALITY = 82 + public static final INEQUALITY = 83 + public static final QUESTION_MARK = 84 + public static final BITWISE_NOT = 85 + public static final REFERENCE_EQUALITY = 86 + public static final REFERENCE_INEQUALITY = 87 + public static final LESS_THAN = 88 + public static final LESS_THAN_OR_EQUAL = 89 + public static final SHIFT_LEFT = 90 + public static final INPLACE_SHIFT_LEFT = 91 + public static final GREATER_THAN = 92 + public static final GREATER_THAN_OR_EQUAL = 93 + public static final SHIFT_RIGHT = 94 + public static final INPLACE_SHIFT_RIGHT = 95 + public static final AT = 96 + public static final SCRIPT_ATTRIBUTE_MARKER = 97 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 98 public static final INPLACE_BITWISE_XOR = 99 public static final NOT = 100 public static final DIVISION = 101 @@ -290,7 +290,9 @@ class UnityScriptParser(antlr.LLkParser): _givenValue = LA(1) if ((_givenValue == IMPORT)): // 1831 import_directive(module) - elif ((_givenValue == HASH)): // 1831 + elif ((_givenValue == PRAGMA_ON) + or (_givenValue ==PRAGMA_OFF) + ): // 1827 pragma_directive(module) else: // line 1969 goto _loop3_breakloop @@ -355,26 +357,27 @@ class UnityScriptParser(antlr.LLkParser): container as Module ) as void: //throws RecognitionException, TokenStreamException - id as IToken = null - option as IToken = null + on as IToken = null + off as IToken = null try: // for error handling - match(HASH) - match(PRAGMA) - id = LT(1) - match(ID) - if ((LA(1)==ID) and (tokenSet_5_.member(cast(int, LA(2))))): - option = LT(1) - match(ID) - elif ((tokenSet_5_.member(cast(int, LA(1)))) and (tokenSet_6_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) + _givenValue = LA(1) + if ((_givenValue == PRAGMA_ON)): // 1831 + on = LT(1) + match(PRAGMA_ON) + if 0 == inputState.guessing: + id=on + elif ((_givenValue == PRAGMA_OFF)): // 1831 + off = LT(1) + match(PRAGMA_OFF) + if 0 == inputState.guessing: + id=off + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) if 0 == inputState.guessing: pragma = id.getText() - pragmaOption = (option.getText() if option is not null else "on") if Pragmas.IsValid(pragma): - if pragmaOption == "on": + if on is not null: Pragmas.TryToEnableOn(container, pragma) else: Pragmas.DisableOn(container, pragma) @@ -409,7 +412,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_7_) + recover(ex,tokenSet_6_) else: raise @@ -432,7 +435,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_8_) + recover(ex,tokenSet_7_) else: raise @@ -444,7 +447,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling synPredMatched25 as bool = false - if (((tokenSet_9_.member(cast(int, LA(1)))) and (tokenSet_10_.member(cast(int, LA(2))))) and (GlobalVariablesBecomeFields())): + if (((tokenSet_8_.member(cast(int, LA(1)))) and (tokenSet_9_.member(cast(int, LA(2))))) and (GlobalVariablesBecomeFields())): _m25 as int = mark() synPredMatched25 = true ++inputState.guessing @@ -460,7 +463,7 @@ class UnityScriptParser(antlr.LLkParser): elif ((LA(1)==VAR) and (LA(2)==FINAL or LA(2)==INTERNAL or LA(2)==ID)): // line 2102 declaration_statement(globals) eos() - elif ((tokenSet_11_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_10_.member(cast(int, LA(1)))) and (tokenSet_11_.member(cast(int, LA(2))))): // line 2102 mod=module_member_modifiers() _givenValue = LA(1) if ((_givenValue == CLASS) @@ -482,7 +485,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_7_) + recover(ex,tokenSet_6_) else: raise @@ -589,7 +592,7 @@ class UnityScriptParser(antlr.LLkParser): elif ((_givenValue == EOS)): // 1831 _cnt109 as int = 0 while true: - if ((LA(1)==EOS) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_12_.member(cast(int, LA(2))))): match(EOS) else: if (_cnt109 >= 1): @@ -603,7 +606,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise @@ -631,7 +634,7 @@ class UnityScriptParser(antlr.LLkParser): value=expression() if 0 == inputState.guessing: attr.NamedArguments.Add(ExpressionPair(name, value)) - elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_15_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 value=expression() if 0 == inputState.guessing: attr.Arguments.Add(value) @@ -640,7 +643,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_15_) else: raise @@ -660,7 +663,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_16_) else: raise return e @@ -674,7 +677,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -690,7 +693,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_18_) else: raise @@ -702,7 +705,7 @@ class UnityScriptParser(antlr.LLkParser): name=qname() if 0 == inputState.guessing: attr = Ast.Attribute(ToLexicalInfo(name), name.getText()) - if ((LA(1)==LPAREN) and (tokenSet_20_.member(cast(int, LA(2))))): + if ((LA(1)==LPAREN) and (tokenSet_19_.member(cast(int, LA(2))))): match(LPAREN) _givenValue = LA(1) if ((_givenValue == FALSE) @@ -742,14 +745,14 @@ class UnityScriptParser(antlr.LLkParser): else: // line 1969 raise NoViableAltException(LT(1), getFilename()) match(RPAREN) - elif ((tokenSet_21_.member(cast(int, LA(1)))) and (tokenSet_22_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_20_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return attr @@ -783,7 +786,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_23_) + recover(ex,tokenSet_22_) else: raise return id @@ -832,7 +835,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_23_) else: raise return m @@ -850,7 +853,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_7_) + recover(ex,tokenSet_6_) else: raise @@ -930,7 +933,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise @@ -938,10 +941,10 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - if ((LA(1)==EOS) and (tokenSet_25_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_24_.member(cast(int, LA(2))))): _cnt41 as int = 0 while true: - if ((LA(1)==EOS) and (tokenSet_25_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_24_.member(cast(int, LA(2))))): match(EOS) else: if (_cnt41 >= 1): @@ -950,7 +953,7 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) ++_cnt41 :_loop41_breakloop - elif ((tokenSet_25_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: SemicolonExpected() else: @@ -958,7 +961,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_25_) + recover(ex,tokenSet_24_) else: raise @@ -1017,7 +1020,7 @@ class UnityScriptParser(antlr.LLkParser): BaseTypeAnnotations.AnnotateImplements(typeRef) match(LBRACE) while true: - if ((tokenSet_27_.member(cast(int, LA(1))))): + if ((tokenSet_26_.member(cast(int, LA(1))))): if 0 == inputState.guessing: mod = TypeMemberModifiers.None _givenValue = LA(1) @@ -1042,9 +1045,9 @@ class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((tokenSet_28_.member(cast(int, LA(1)))) and (tokenSet_29_.member(cast(int, LA(2))))): + if ((tokenSet_27_.member(cast(int, LA(1)))) and (tokenSet_28_.member(cast(int, LA(2))))): mod=member_modifiers() - elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_30_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_23_.member(cast(int, LA(1)))) and (tokenSet_29_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1073,7 +1076,7 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: SetEndSourceLocation(cd, rbrace) while true: - if ((LA(1)==EOS) and (tokenSet_31_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_30_.member(cast(int, LA(2))))): match(EOS) else: goto _loop58_breakloop @@ -1081,7 +1084,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_31_) + recover(ex,tokenSet_30_) else: raise return member @@ -1130,7 +1133,7 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: SetEndSourceLocation(td, rbrace) while true: - if ((LA(1)==EOS) and (tokenSet_31_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_30_.member(cast(int, LA(2))))): match(EOS) else: goto _loop65_breakloop @@ -1138,7 +1141,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_31_) + recover(ex,tokenSet_30_) else: raise return member @@ -1188,7 +1191,7 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: SetEndSourceLocation(ed, rbrace) while true: - if ((LA(1)==EOS) and (tokenSet_31_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_30_.member(cast(int, LA(2))))): match(EOS) else: goto _loop77_breakloop @@ -1196,7 +1199,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_31_) + recover(ex,tokenSet_30_) else: raise return member @@ -1220,7 +1223,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_7_) + recover(ex,tokenSet_6_) else: raise return member @@ -1260,7 +1263,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_31_) + recover(ex,tokenSet_30_) else: raise @@ -1403,7 +1406,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_31_) + recover(ex,tokenSet_30_) else: raise return member @@ -1460,7 +1463,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_23_) else: raise return m @@ -1493,14 +1496,14 @@ class UnityScriptParser(antlr.LLkParser): match(RBRACK) if 0 == inputState.guessing: tr = ArrayTypeReference(tr.LexicalInfo, tr, IntegerLiteralExpression(ToLexicalInfo(lbrack), rank)) - elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_33_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_31_.member(cast(int, LA(1)))) and (tokenSet_32_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_31_) else: raise return tr @@ -1526,7 +1529,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_34_) + recover(ex,tokenSet_33_) else: raise @@ -1589,7 +1592,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_35_) + recover(ex,tokenSet_34_) else: raise return member @@ -1644,7 +1647,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_35_) else: raise @@ -1665,7 +1668,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_37_) + recover(ex,tokenSet_36_) else: raise @@ -1702,7 +1705,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_38_) + recover(ex,tokenSet_37_) else: raise @@ -1730,7 +1733,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -1764,7 +1767,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_39_) + recover(ex,tokenSet_38_) else: raise return token @@ -1777,7 +1780,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling block(b) while true: - if ((LA(1)==EOS) and (tokenSet_40_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_39_.member(cast(int, LA(2))))): match(EOS) else: goto _loop99_breakloop @@ -1785,7 +1788,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_40_) + recover(ex,tokenSet_39_) else: raise @@ -1823,7 +1826,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_15_) else: raise @@ -1833,16 +1836,16 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - if ((LA(1)==LBRACE) and (tokenSet_41_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_40_.member(cast(int, LA(2))))): compound_statement(b) - elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_42_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 statement(b) else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise @@ -1867,7 +1870,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise @@ -1897,7 +1900,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise @@ -1922,7 +1925,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise @@ -1937,7 +1940,7 @@ class UnityScriptParser(antlr.LLkParser): match(FOR) match(LPAREN) synPredMatched125 as bool = false - if ((tokenSet_43_.member(cast(int, LA(1)))) and (tokenSet_44_.member(cast(int, LA(2))))): + if ((tokenSet_42_.member(cast(int, LA(1)))) and (tokenSet_43_.member(cast(int, LA(2))))): _m125 as int = mark() synPredMatched125 = true ++inputState.guessing @@ -1959,7 +1962,7 @@ class UnityScriptParser(antlr.LLkParser): --inputState.guessing if synPredMatched125: stmt=for_in(container) - elif ((tokenSet_45_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_44_.member(cast(int, LA(1)))) and (tokenSet_45_.member(cast(int, LA(2))))): // line 2102 stmt=for_c(container) else: raise NoViableAltException(LT(1), getFilename()) @@ -1968,7 +1971,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise @@ -1994,14 +1997,14 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: b = s.FalseBlock = Block(ToLexicalInfo(et)) compound_or_single_stmt(b) - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise @@ -2051,14 +2054,14 @@ class UnityScriptParser(antlr.LLkParser): :_loop152_breakloop if ((LA(1)==FINALLY) and (tokenSet_2_.member(cast(int, LA(2))))): finally_block(s) - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise @@ -2143,7 +2146,7 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) match(RBRACE) while true: - if ((LA(1)==EOS) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_12_.member(cast(int, LA(2))))): match(EOS) else: goto _loop148_breakloop @@ -2151,7 +2154,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise @@ -2167,7 +2170,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise @@ -2180,9 +2183,9 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling yt = LT(1) match(YIELD) - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_47_.member(cast(int, LA(2))))): + if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -2191,7 +2194,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise @@ -2204,9 +2207,9 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling ret = LT(1) match(RETURN) - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_47_.member(cast(int, LA(2))))): + if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -2215,7 +2218,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise @@ -2233,7 +2236,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise @@ -2256,7 +2259,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise @@ -2269,9 +2272,9 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling t = LT(1) match(THROW) - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_47_.member(cast(int, LA(2))))): + if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -2280,7 +2283,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise @@ -2361,7 +2364,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_48_) + recover(ex,tokenSet_47_) else: raise return d @@ -2517,7 +2520,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_49_) + recover(ex,tokenSet_48_) else: raise return e @@ -2559,7 +2562,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise return stmt @@ -2688,7 +2691,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise return stmt @@ -2704,7 +2707,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -2724,7 +2727,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_13_) + recover(ex,tokenSet_12_) else: raise @@ -2735,7 +2738,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=logical_or() - if ((LA(1)==QUESTION_MARK) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==QUESTION_MARK) and (tokenSet_13_.member(cast(int, LA(2))))): qm = LT(1) match(QUESTION_MARK) trueValue=logical_or() @@ -2746,14 +2749,14 @@ class UnityScriptParser(antlr.LLkParser): Condition: e, TrueValue: trueValue, FalseValue: falseValue) - elif ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_50_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -2787,7 +2790,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return name @@ -2806,7 +2809,7 @@ class UnityScriptParser(antlr.LLkParser): arguments = gtr.GenericArguments type_reference_list(arguments) match(GREATER_THAN) - elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_33_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_31_.member(cast(int, LA(1)))) and (tokenSet_32_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: tr = SimpleTypeReference(ToLexicalInfo(typeName), Name: typeName.getText()) else: @@ -2814,7 +2817,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_31_) else: raise return tr @@ -2836,14 +2839,14 @@ class UnityScriptParser(antlr.LLkParser): returnType=type_reference() if 0 == inputState.guessing: callableTypeRef.ReturnType = returnType - elif ((tokenSet_32_.member(cast(int, LA(1)))) and (tokenSet_33_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_31_.member(cast(int, LA(1)))) and (tokenSet_32_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_31_) else: raise return tr @@ -2879,7 +2882,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_31_) else: raise @@ -2909,7 +2912,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -2924,7 +2927,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=term() while true: - if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_13_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == ADD)): // 1831 add = LT(1) @@ -2951,7 +2954,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -2966,7 +2969,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3003,7 +3006,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3060,7 +3063,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_51_) + recover(ex,tokenSet_50_) else: raise @@ -3100,7 +3103,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3142,7 +3145,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3205,9 +3208,9 @@ class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((LA(1)==LBRACE) and (tokenSet_41_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_40_.member(cast(int, LA(2))))): block(body) - elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 returnValue=expression() if 0 == inputState.guessing: body.Add(returnValue) @@ -3216,7 +3219,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3234,7 +3237,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3245,7 +3248,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling synPredMatched202 as bool = false - if ((LA(1)==TYPEOF) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==TYPEOF) and (tokenSet_13_.member(cast(int, LA(2))))): _m202 as int = mark() synPredMatched202 = true ++inputState.guessing @@ -3260,14 +3263,14 @@ class UnityScriptParser(antlr.LLkParser): --inputState.guessing if synPredMatched202: e=typeof_with_expression() - elif ((LA(1)==TYPEOF) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==TYPEOF) and (tokenSet_13_.member(cast(int, LA(2))))): // line 2102 e=typeof_expression_alt() else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3302,7 +3305,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3315,11 +3318,11 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling t = LT(1) match(TYPEOF) - if ((LA(1)==LPAREN) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==LPAREN) and (tokenSet_13_.member(cast(int, LA(2))))): match(LPAREN) arg=expression() match(RPAREN) - elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 arg=expression() else: raise NoViableAltException(LT(1), getFilename()) @@ -3331,7 +3334,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3357,14 +3360,14 @@ class UnityScriptParser(antlr.LLkParser): --inputState.guessing if synPredMatched205: e=typeof_with_typeref() - elif ((LA(1)==TYPEOF) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==TYPEOF) and (tokenSet_13_.member(cast(int, LA(2))))): // line 2102 e=typeof_with_expression() else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3385,7 +3388,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3526,7 +3529,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_52_) + recover(ex,tokenSet_51_) else: raise @@ -3543,7 +3546,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=atom() while true: - if ((LA(1)==LBRACK) and (tokenSet_53_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACK) and (tokenSet_52_.member(cast(int, LA(2))))): lbrack = LT(1) match(LBRACK) if 0 == inputState.guessing: @@ -3559,10 +3562,10 @@ class UnityScriptParser(antlr.LLkParser): goto _loop229_breakloop :_loop229_breakloop match(RBRACK) - elif ((LA(1)==DOT) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DOT) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 match(DOT) e=member_reference_expression(e) - elif ((LA(1)==LPAREN) and (tokenSet_20_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==LPAREN) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 lparen = LT(1) match(LPAREN) if 0 == inputState.guessing: @@ -3578,7 +3581,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3591,17 +3594,17 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=slicing_expression() - if ((LA(1)==INCREMENT) and (tokenSet_18_.member(cast(int, LA(2))))): + if ((LA(1)==INCREMENT) and (tokenSet_17_.member(cast(int, LA(2))))): postinc = LT(1) match(INCREMENT) if 0 == inputState.guessing: token = postinc; operator = UnaryOperatorType.PostIncrement; - elif ((LA(1)==DECREMENT) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DECREMENT) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 preinc = LT(1) match(DECREMENT) if 0 == inputState.guessing: token = preinc; operator= UnaryOperatorType.PostDecrement; - elif ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_50_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3610,7 +3613,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3665,14 +3668,14 @@ class UnityScriptParser(antlr.LLkParser): tr=type_reference() if 0 == inputState.guessing: e = CastExpression(ToLexicalInfo(c), Target: e, Type: tr) - elif ((tokenSet_18_.member(cast(int, LA(1)))) and (tokenSet_50_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3722,7 +3725,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3738,7 +3741,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=unary_expression() while true: - if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_13_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == MULTIPLY)): // 1831 m = LT(1) @@ -3770,7 +3773,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3784,7 +3787,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=sum() while true: - if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_13_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == SHIFT_LEFT)): // 1831 sl = LT(1) @@ -3807,7 +3810,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3828,7 +3831,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=shift() while true: - if ((tokenSet_55_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((tokenSet_54_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == IN) or (_givenValue ==LESS_THAN) @@ -3887,7 +3890,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3903,7 +3906,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=comparison() while true: - if ((tokenSet_56_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((tokenSet_55_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == EQUALITY)): // 1831 te = LT(1) @@ -3936,7 +3939,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3949,7 +3952,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=equality() while true: - if ((LA(1)==BITWISE_AND) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_AND) and (tokenSet_13_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_AND) if 0 == inputState.guessing: @@ -3963,7 +3966,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -3976,7 +3979,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_and() while true: - if ((LA(1)==BITWISE_XOR) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_XOR) and (tokenSet_13_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_XOR) if 0 == inputState.guessing: @@ -3990,7 +3993,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -4003,7 +4006,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_xor() while true: - if ((LA(1)==BITWISE_OR) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_OR) and (tokenSet_13_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_OR) if 0 == inputState.guessing: @@ -4017,7 +4020,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -4030,7 +4033,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_or() while true: - if ((LA(1)==LOGICAL_AND) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==LOGICAL_AND) and (tokenSet_13_.member(cast(int, LA(2))))): op = LT(1) match(LOGICAL_AND) rhs=bitwise_or() @@ -4045,7 +4048,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -4058,7 +4061,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=logical_and() while true: - if ((LA(1)==LOGICAL_OR) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==LOGICAL_OR) and (tokenSet_13_.member(cast(int, LA(2))))): op = LT(1) match(LOGICAL_OR) rhs=logical_and() @@ -4073,7 +4076,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -4103,7 +4106,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -4117,7 +4120,7 @@ class UnityScriptParser(antlr.LLkParser): lbrack = LT(1) match(LBRACK) synPredMatched294 as bool = false - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_57_.member(cast(int, LA(2))))): + if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_56_.member(cast(int, LA(2))))): _m294 as int = mark() synPredMatched294 = true ++inputState.guessing @@ -4156,7 +4159,7 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) - elif ((tokenSet_58_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_57_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)); items = ale.Items; expression_list(items) @@ -4166,7 +4169,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -4227,7 +4230,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return dle @@ -4245,7 +4248,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return re @@ -4273,7 +4276,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -4291,7 +4294,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -4309,7 +4312,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -4327,7 +4330,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return e @@ -4345,7 +4348,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_17_) else: raise return rle @@ -4365,7 +4368,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_38_) + recover(ex,tokenSet_37_) else: raise return ep @@ -4406,7 +4409,6 @@ class UnityScriptParser(antlr.LLkParser): 'internal', 'override', 'partial', - 'pragma', 'private', 'set', 'static', @@ -4427,6 +4429,8 @@ class UnityScriptParser(antlr.LLkParser): '+=', '-=', '*=', + 'pragma on', + 'pragma off', 'an identifier', 'a string', '{', @@ -4470,7 +4474,6 @@ class UnityScriptParser(antlr.LLkParser): '@', '@script', '@assembly', - 'HASH', 'INPLACE_BITWISE_XOR', 'NOT', 'DIVISION', @@ -4495,19 +4498,19 @@ class UnityScriptParser(antlr.LLkParser): ) private static def mk_tokenSet_0_() as (long): - data = (52960721932544L, 0L, ) + data = (26486543520000L, 0L, ) return data public static final tokenSet_0_ = BitSet(mk_tokenSet_0_()) private static def mk_tokenSet_1_() as (long): - data = (36081757740896512L, 0L, ) + data = (72084080581447936L, 0L, ) return data public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) private static def mk_tokenSet_2_() as (long): - data = (829189822610818592L, 8589935663617L, 0L, 0L, ) + data = (1657588408695277088L, 8589936735234L, 0L, 0L, ) return data public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) private static def mk_tokenSet_3_() as (long): - data = (3457075573759072114L, 8766028251135L, 0L, 0L, ) + data = (6862641368520906610L, 8770323218430L, 0L, 0L, ) return data public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) private static def mk_tokenSet_4_() as (long): @@ -4515,219 +4518,215 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) private static def mk_tokenSet_5_() as (long): - data = (829225191148541730L, 8609263016449L, 0L, 0L, ) + data = (1711649294676055842L, 8594231702530L, 0L, 0L, ) return data public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) private static def mk_tokenSet_6_() as (long): - data = (3457075590938941298L, 8766028251135L, 0L, 0L, ) + data = (1657606099145512738L, 8594231702530L, 0L, 0L, ) return data public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) private static def mk_tokenSet_7_() as (long): - data = (829225191146444578L, 8592083147265L, 0L, 0L, ) + data = (72084084943524096L, 0L, ) return data public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) private static def mk_tokenSet_8_() as (long): - data = (36081762102972672L, 0L, ) + data = (26477936541696L, 0L, ) return data public static final tokenSet_8_ = BitSet(mk_tokenSet_8_()) private static def mk_tokenSet_9_() as (long): - data = (52952114954240L, 0L, ) + data = (72084071974469632L, 0L, ) return data public static final tokenSet_9_ = BitSet(mk_tokenSet_9_()) private static def mk_tokenSet_10_() as (long): - data = (36081749133918208L, 0L, ) + data = (17690450497792L, 0L, ) return data public static final tokenSet_10_ = BitSet(mk_tokenSet_10_()) private static def mk_tokenSet_11_() as (long): - data = (35368535888128L, 0L, ) + data = (72075284488425728L, 0L, ) return data public static final tokenSet_11_ = BitSet(mk_tokenSet_11_()) private static def mk_tokenSet_12_() as (long): - data = (36064165554852096L, 0L, ) + data = (2234911276379135906L, 8594231702530L, 0L, 0L, ) return data public static final tokenSet_12_ = BitSet(mk_tokenSet_12_()) private static def mk_tokenSet_13_() as (long): - data = (1119144417158487970L, 8592083147265L, 0L, 0L, ) + data = (1657330572948946944L, 8589936734210L, 0L, 0L, ) return data public static final tokenSet_13_ = BitSet(mk_tokenSet_13_()) private static def mk_tokenSet_14_() as (long): - data = (828674151387774976L, 8589935663105L, 0L, 0L, ) + data = (9151320352935395408L, 8729386808175L, 0L, 0L, ) return data public static final tokenSet_14_ = BitSet(mk_tokenSet_14_()) private static def mk_tokenSet_15_() as (long): - data = (-4647702995452805040L, 8728380176823L, 0L, 0L, ) + data = (2305843009213693952L, 1L, 0L, 0L, ) return data public static final tokenSet_15_ = BitSet(mk_tokenSet_15_()) private static def mk_tokenSet_16_() as (long): - data = (-8070450532247928832L, 0L, ) + data = (1152921504606846976L, 2048L, 0L, 0L, ) return data public static final tokenSet_16_ = BitSet(mk_tokenSet_16_()) private static def mk_tokenSet_17_() as (long): - data = (576460752303423488L, 1024L, 0L, 0L, ) + data = (-54043229895008270L, 8770323218431L, 0L, 0L, ) return data public static final tokenSet_17_ = BitSet(mk_tokenSet_17_()) private static def mk_tokenSet_18_() as (long): - data = (-85906169870L, 8766028251135L, 0L, 0L, ) + data = (72084084943524096L, 4294967296L, 0L, 0L, ) return data public static final tokenSet_18_ = BitSet(mk_tokenSet_18_()) private static def mk_tokenSet_19_() as (long): - data = (36081762102972672L, 2147483648L, 0L, 0L, ) + data = (3963173582162640896L, 8589936734210L, 0L, 0L, ) return data public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) private static def mk_tokenSet_20_() as (long): - data = (1981595655994621952L, 8589935663105L, 0L, 0L, ) + data = (1657606103440480034L, 8594231702530L, 0L, 0L, ) return data public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) private static def mk_tokenSet_21_() as (long): - data = (829225195441411874L, 8592083147265L, 0L, 0L, ) + data = (-54887620464945294L, 8770323218431L, 0L, 0L, ) return data public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) private static def mk_tokenSet_22_() as (long): - data = (-1688867046500494L, 8766028251135L, 0L, 0L, ) + data = (-34360270862L, 8770323218431L, 0L, 0L, ) return data public static final tokenSet_22_ = BitSet(mk_tokenSet_22_()) private static def mk_tokenSet_23_() as (long): - data = (-85899878414L, 8783208120319L, 0L, 0L, ) + data = (8804700000512L, 0L, ) return data public static final tokenSet_23_ = BitSet(mk_tokenSet_23_()) private static def mk_tokenSet_24_() as (long): - data = (17600793022720L, 0L, ) + data = (2288954476204646306L, 8594231702530L, 0L, 0L, ) return data public static final tokenSet_24_ = BitSet(mk_tokenSet_24_()) private static def mk_tokenSet_25_() as (long): - data = (1119144421455552418L, 8609263016449L, 0L, 0L, ) + data = (-4202510L, 8770323218431L, 0L, 0L, ) return data public static final tokenSet_25_ = BitSet(mk_tokenSet_25_()) private static def mk_tokenSet_26_() as (long): - data = (-6299662L, 8766028251135L, 0L, 0L, ) + data = (26490905596160L, 4294967296L, 0L, 0L, ) return data public static final tokenSet_26_ = BitSet(mk_tokenSet_26_()) private static def mk_tokenSet_27_() as (long): - data = (52965084008704L, 2147483648L, 0L, 0L, ) + data = (26490905596160L, 0L, ) return data public static final tokenSet_27_ = BitSet(mk_tokenSet_27_()) private static def mk_tokenSet_28_() as (long): - data = (52965084008704L, 0L, ) + data = (72084119303786752L, 0L, ) return data public static final tokenSet_28_ = BitSet(mk_tokenSet_28_()) private static def mk_tokenSet_29_() as (long): - data = (36081830822973696L, 0L, ) + data = (72057630545707264L, 0L, ) return data public static final tokenSet_29_ = BitSet(mk_tokenSet_29_()) private static def mk_tokenSet_30_() as (long): - data = (36028867886481664L, 0L, ) + data = (2234066855743903522L, 8594231702530L, 0L, 0L, ) return data public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) private static def mk_tokenSet_31_() as (long): - data = (1117455571593123618L, 8592083147265L, 0L, 0L, ) + data = (-54043229890813966L, 8770323218431L, 0L, 0L, ) return data public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) private static def mk_tokenSet_32_() as (long): - data = (-85901975566L, 8766028251135L, 0L, 0L, ) + data = (-54043195530551310L, 8770323218431L, 0L, 0L, ) return data public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) private static def mk_tokenSet_33_() as (long): - data = (-17181974542L, 8766028251135L, 0L, 0L, ) + data = (288230376151711744L, 268435456L, 0L, 0L, ) return data public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) private static def mk_tokenSet_34_() as (long): - data = (144115188075855872L, 134217728L, 0L, 0L, ) + data = (576487243209019648L, 4294967296L, 0L, 0L, ) return data public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) private static def mk_tokenSet_35_() as (long): - data = (288283341235720448L, 2147483648L, 0L, 0L, ) + data = (576460752303685632L, 4294967296L, 0L, 0L, ) return data public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) private static def mk_tokenSet_36_() as (long): - data = (288230376151973888L, 2147483648L, 0L, 0L, ) + data = (2305843009213693952L, 0L, ) return data public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) private static def mk_tokenSet_37_() as (long): - data = (1152921504606846976L, 0L, ) + data = (576460752303423488L, 1L, 0L, 0L, ) return data public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) private static def mk_tokenSet_38_() as (long): - data = (-8935141660703064064L, 0L, ) + data = (-4682617746958590046L, 8594231704579L, 0L, 0L, ) return data public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) private static def mk_tokenSet_39_() as (long): - data = (-2339620092358697054L, 8592083148289L, 0L, 0L, ) + data = (2234911280674103202L, 8594231702530L, 0L, 0L, ) return data public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) private static def mk_tokenSet_40_() as (long): - data = (1119144421453455266L, 8592083147265L, 0L, 0L, ) + data = (2234049160998700576L, 8589936735234L, 0L, 0L, ) return data public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) private static def mk_tokenSet_41_() as (long): - data = (1117420198762530336L, 8589935663617L, 0L, 0L, ) + data = (6863485793451106290L, 8770323218430L, 0L, 0L, ) return data public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) private static def mk_tokenSet_42_() as (long): - data = (3458764423619403762L, 8766028251135L, 0L, 0L, ) + data = (72066392278466560L, 0L, ) return data public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) private static def mk_tokenSet_43_() as (long): - data = (36046391352524800L, 0L, ) + data = (72057596193832960L, 0L, ) return data public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) private static def mk_tokenSet_44_() as (long): - data = (36028799174868992L, 0L, ) + data = (1657339369041969152L, 8589936735234L, 0L, 0L, ) return data public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) private static def mk_tokenSet_45_() as (long): - data = (828691743573819392L, 8589935663617L, 0L, 0L, ) + data = (6862365844471857232L, 8766028251134L, 0L, 0L, ) return data public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) private static def mk_tokenSet_46_() as (long): - data = (3456524536147918928L, 8763880767487L, 0L, 0L, ) + data = (6846597294848466930L, 8733681776494L, 0L, 0L, ) return data public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) private static def mk_tokenSet_47_() as (long): - data = (3424987426414125042L, 8730527660983L, 0L, 0L, ) + data = (2234911276387524514L, 8594231704578L, 0L, 0L, ) return data public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) private static def mk_tokenSet_48_() as (long): - data = (1119144417166876578L, 8592083148289L, 0L, 0L, ) + data = (4540754285592829858L, 8594231702530L, 0L, 0L, ) return data public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) private static def mk_tokenSet_49_() as (long): - data = (2272065921765334946L, 8592083147265L, 0L, 0L, ) + data = (-54043195534745614L, 8770323218431L, 0L, 0L, ) return data public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) private static def mk_tokenSet_50_() as (long): - data = (-17186168846L, 8766028251135L, 0L, 0L, ) + data = (2305843009213693952L, 4L, 0L, 0L, ) return data public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) private static def mk_tokenSet_51_() as (long): - data = (1152921504606846976L, 2L, 0L, 0L, ) + data = (0L, 5L, 0L, 0L, ) return data public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) private static def mk_tokenSet_52_() as (long): - data = (-9223372036854775808L, 2L, 0L, 0L, ) + data = (-7566041463905828864L, 8589936734210L, 0L, 0L, ) return data public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) private static def mk_tokenSet_53_() as (long): - data = (5440360169815162880L, 8589935663105L, 0L, 0L, ) + data = (72057628398190592L, 16777216L, 0L, 0L, ) return data public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) private static def mk_tokenSet_54_() as (long): - data = (36028865738964992L, 8388608L, 0L, 0L, ) + data = (41943040L, 855638016L, 0L, 0L, ) return data public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) private static def mk_tokenSet_55_() as (long): - data = (41943040L, 427819008L, 0L, 0L, ) + data = (0L, 13369344L, 0L, 0L, ) return data public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) private static def mk_tokenSet_56_() as (long): - data = (0L, 6684672L, 0L, 0L, ) + data = (6845477343721832528L, 8729386808174L, 0L, 0L, ) return data public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) private static def mk_tokenSet_57_() as (long): - data = (3422747536795254864L, 8728380176823L, 0L, 0L, ) + data = (1657330572948946944L, 8589936734214L, 0L, 0L, ) return data public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) - private static def mk_tokenSet_58_() as (long): - data = (828674151387774976L, 8589935663107L, 0L, 0L, ) - return data - public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.boo b/src/UnityScript/Parser/UnityScriptTokenTypes.boo index 73d15cf..3393d48 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.boo +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.boo @@ -34,71 +34,71 @@ class UnityScriptTokenTypes: public static final INTERNAL = 31 public static final OVERRIDE = 32 public static final PARTIAL = 33 - public static final PRAGMA = 34 - public static final PRIVATE = 35 - public static final SET = 36 - public static final STATIC = 37 - public static final SUPER = 38 - public static final THIS = 39 - public static final THROW = 40 - public static final TRUE = 41 - public static final TRY = 42 - public static final TYPEOF = 43 - public static final VAR = 44 - public static final VIRTUAL = 45 - public static final WHILE = 46 - public static final YIELD = 47 - public static final SWITCH = 48 - public static final CASE = 49 - public static final DEFAULT = 50 - public static final INPLACE_DIVISION = 51 - public static final INPLACE_ADD = 52 - public static final INPLACE_SUBTRACT = 53 - public static final INPLACE_MULTIPLY = 54 - public static final ID = 55 - public static final DOUBLE_QUOTED_STRING = 56 - public static final LBRACE = 57 - public static final RBRACE = 58 - public static final LPAREN = 59 - public static final RPAREN = 60 - public static final DOT = 61 - public static final COLON = 62 - public static final COMMA = 63 - public static final LBRACK = 64 - public static final RBRACK = 65 - public static final BITWISE_OR = 66 - public static final INPLACE_BITWISE_OR = 67 - public static final BITWISE_AND = 68 - public static final BITWISE_XOR = 69 - public static final INPLACE_BITWISE_AND = 70 - public static final LOGICAL_OR = 71 - public static final LOGICAL_AND = 72 - public static final EOS = 73 - public static final ASSIGN = 74 - public static final INCREMENT = 75 - public static final DECREMENT = 76 - public static final ADD = 77 - public static final SUBTRACT = 78 - public static final MODULUS = 79 - public static final MULTIPLY = 80 - public static final EQUALITY = 81 - public static final INEQUALITY = 82 - public static final QUESTION_MARK = 83 - public static final BITWISE_NOT = 84 - public static final REFERENCE_EQUALITY = 85 - public static final REFERENCE_INEQUALITY = 86 - public static final LESS_THAN = 87 - public static final LESS_THAN_OR_EQUAL = 88 - public static final SHIFT_LEFT = 89 - public static final INPLACE_SHIFT_LEFT = 90 - public static final GREATER_THAN = 91 - public static final GREATER_THAN_OR_EQUAL = 92 - public static final SHIFT_RIGHT = 93 - public static final INPLACE_SHIFT_RIGHT = 94 - public static final AT = 95 - public static final SCRIPT_ATTRIBUTE_MARKER = 96 - public static final ASSEMBLY_ATTRIBUTE_MARKER = 97 - public static final HASH = 98 + public static final PRIVATE = 34 + public static final SET = 35 + public static final STATIC = 36 + public static final SUPER = 37 + public static final THIS = 38 + public static final THROW = 39 + public static final TRUE = 40 + public static final TRY = 41 + public static final TYPEOF = 42 + public static final VAR = 43 + public static final VIRTUAL = 44 + public static final WHILE = 45 + public static final YIELD = 46 + public static final SWITCH = 47 + public static final CASE = 48 + public static final DEFAULT = 49 + public static final INPLACE_DIVISION = 50 + public static final INPLACE_ADD = 51 + public static final INPLACE_SUBTRACT = 52 + public static final INPLACE_MULTIPLY = 53 + public static final PRAGMA_ON = 54 + public static final PRAGMA_OFF = 55 + public static final ID = 56 + public static final DOUBLE_QUOTED_STRING = 57 + public static final LBRACE = 58 + public static final RBRACE = 59 + public static final LPAREN = 60 + public static final RPAREN = 61 + public static final DOT = 62 + public static final COLON = 63 + public static final COMMA = 64 + public static final LBRACK = 65 + public static final RBRACK = 66 + public static final BITWISE_OR = 67 + public static final INPLACE_BITWISE_OR = 68 + public static final BITWISE_AND = 69 + public static final BITWISE_XOR = 70 + public static final INPLACE_BITWISE_AND = 71 + public static final LOGICAL_OR = 72 + public static final LOGICAL_AND = 73 + public static final EOS = 74 + public static final ASSIGN = 75 + public static final INCREMENT = 76 + public static final DECREMENT = 77 + public static final ADD = 78 + public static final SUBTRACT = 79 + public static final MODULUS = 80 + public static final MULTIPLY = 81 + public static final EQUALITY = 82 + public static final INEQUALITY = 83 + public static final QUESTION_MARK = 84 + public static final BITWISE_NOT = 85 + public static final REFERENCE_EQUALITY = 86 + public static final REFERENCE_INEQUALITY = 87 + public static final LESS_THAN = 88 + public static final LESS_THAN_OR_EQUAL = 89 + public static final SHIFT_LEFT = 90 + public static final INPLACE_SHIFT_LEFT = 91 + public static final GREATER_THAN = 92 + public static final GREATER_THAN_OR_EQUAL = 93 + public static final SHIFT_RIGHT = 94 + public static final INPLACE_SHIFT_RIGHT = 95 + public static final AT = 96 + public static final SCRIPT_ATTRIBUTE_MARKER = 97 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 98 public static final INPLACE_BITWISE_XOR = 99 public static final NOT = 100 public static final DIVISION = 101 diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.txt b/src/UnityScript/Parser/UnityScriptTokenTypes.txt index 873e15f..4d08f75 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.txt +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.txt @@ -30,71 +30,71 @@ PROTECTED="protected"=30 INTERNAL="internal"=31 OVERRIDE="override"=32 PARTIAL="partial"=33 -PRAGMA="pragma"=34 -PRIVATE="private"=35 -SET="set"=36 -STATIC="static"=37 -SUPER="super"=38 -THIS="this"=39 -THROW="throw"=40 -TRUE="true"=41 -TRY="try"=42 -TYPEOF="typeof"=43 -VAR="var"=44 -VIRTUAL="virtual"=45 -WHILE="while"=46 -YIELD="yield"=47 -SWITCH="switch"=48 -CASE="case"=49 -DEFAULT="default"=50 -INPLACE_DIVISION="/="=51 -INPLACE_ADD="+="=52 -INPLACE_SUBTRACT="-="=53 -INPLACE_MULTIPLY="*="=54 -ID="an identifier"=55 -DOUBLE_QUOTED_STRING="a string"=56 -LBRACE="{"=57 -RBRACE="}"=58 -LPAREN="("=59 -RPAREN=")"=60 -DOT="."=61 -COLON=":"=62 -COMMA=","=63 -LBRACK="["=64 -RBRACK="]"=65 -BITWISE_OR="|"=66 -INPLACE_BITWISE_OR="|="=67 -BITWISE_AND="&"=68 -BITWISE_XOR="^"=69 -INPLACE_BITWISE_AND="&="=70 -LOGICAL_OR="||"=71 -LOGICAL_AND="&&"=72 -EOS=";"=73 -ASSIGN="="=74 -INCREMENT="++"=75 -DECREMENT="--"=76 -ADD="+"=77 -SUBTRACT="-"=78 -MODULUS="%"=79 -MULTIPLY="*"=80 -EQUALITY="=="=81 -INEQUALITY="!="=82 -QUESTION_MARK="?"=83 -BITWISE_NOT="~"=84 -REFERENCE_EQUALITY="==="=85 -REFERENCE_INEQUALITY="!=="=86 -LESS_THAN="<"=87 -LESS_THAN_OR_EQUAL="<="=88 -SHIFT_LEFT="<<"=89 -INPLACE_SHIFT_LEFT="<<="=90 -GREATER_THAN=">"=91 -GREATER_THAN_OR_EQUAL=">="=92 -SHIFT_RIGHT=">>"=93 -INPLACE_SHIFT_RIGHT=">>="=94 -AT="@"=95 -SCRIPT_ATTRIBUTE_MARKER="@script"=96 -ASSEMBLY_ATTRIBUTE_MARKER="@assembly"=97 -HASH=98 +PRIVATE="private"=34 +SET="set"=35 +STATIC="static"=36 +SUPER="super"=37 +THIS="this"=38 +THROW="throw"=39 +TRUE="true"=40 +TRY="try"=41 +TYPEOF="typeof"=42 +VAR="var"=43 +VIRTUAL="virtual"=44 +WHILE="while"=45 +YIELD="yield"=46 +SWITCH="switch"=47 +CASE="case"=48 +DEFAULT="default"=49 +INPLACE_DIVISION="/="=50 +INPLACE_ADD="+="=51 +INPLACE_SUBTRACT="-="=52 +INPLACE_MULTIPLY="*="=53 +PRAGMA_ON="pragma on"=54 +PRAGMA_OFF="pragma off"=55 +ID="an identifier"=56 +DOUBLE_QUOTED_STRING="a string"=57 +LBRACE="{"=58 +RBRACE="}"=59 +LPAREN="("=60 +RPAREN=")"=61 +DOT="."=62 +COLON=":"=63 +COMMA=","=64 +LBRACK="["=65 +RBRACK="]"=66 +BITWISE_OR="|"=67 +INPLACE_BITWISE_OR="|="=68 +BITWISE_AND="&"=69 +BITWISE_XOR="^"=70 +INPLACE_BITWISE_AND="&="=71 +LOGICAL_OR="||"=72 +LOGICAL_AND="&&"=73 +EOS=";"=74 +ASSIGN="="=75 +INCREMENT="++"=76 +DECREMENT="--"=77 +ADD="+"=78 +SUBTRACT="-"=79 +MODULUS="%"=80 +MULTIPLY="*"=81 +EQUALITY="=="=82 +INEQUALITY="!="=83 +QUESTION_MARK="?"=84 +BITWISE_NOT="~"=85 +REFERENCE_EQUALITY="==="=86 +REFERENCE_INEQUALITY="!=="=87 +LESS_THAN="<"=88 +LESS_THAN_OR_EQUAL="<="=89 +SHIFT_LEFT="<<"=90 +INPLACE_SHIFT_LEFT="<<="=91 +GREATER_THAN=">"=92 +GREATER_THAN_OR_EQUAL=">="=93 +SHIFT_RIGHT=">>"=94 +INPLACE_SHIFT_RIGHT=">>="=95 +AT="@"=96 +SCRIPT_ATTRIBUTE_MARKER="@script"=97 +ASSEMBLY_ATTRIBUTE_MARKER="@assembly"=98 INPLACE_BITWISE_XOR=99 NOT=100 DIVISION=101 diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 81cdb3c..f9a1707 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -53,7 +53,6 @@ tokens INTERNAL="internal"; OVERRIDE="override"; PARTIAL="partial"; - PRAGMA="pragma"; PRIVATE="private"; SET="set"; STATIC="static"; @@ -78,6 +77,9 @@ tokens INPLACE_SUBTRACT="-="; INPLACE_MULTIPLY="*="; + PRAGMA_ON="pragma on"; + PRAGMA_OFF="pragma off"; + /* lexer token definitions */ ID="an identifier"; DOUBLE_QUOTED_STRING="a string"; @@ -390,12 +392,11 @@ qname returns [Token id] pragma_directive[Module container] { }: - HASH PRAGMA id:ID (option:ID)? + (on:PRAGMA_ON { id=on } | off:PRAGMA_OFF { id=off }) { pragma = id.getText() - pragmaOption = (option.getText() if option is not null else "on") if Pragmas.IsValid(pragma): - if pragmaOption == "on": + if on is not null: Pragmas.TryToEnableOn(container, pragma) else: Pragmas.DisableOn(container, pragma) @@ -1836,7 +1837,11 @@ DECREMENT: "--"; ADD: '+'; -HASH: '#'; +PRAGMA_ON: + "#pragma"! (' '!)+ id:ID + ((' '!) ("off"! { $setType(PRAGMA_OFF); } | "on"!))? + (' '!)* + NEWLINE!; INPLACE_ADD: "+="; diff --git a/tests/parser/pragma-strict-followed-by-identifier.js b/tests/parser/pragma-strict-followed-by-identifier.js new file mode 100644 index 0000000..6fdbb4a --- /dev/null +++ b/tests/parser/pragma-strict-followed-by-identifier.js @@ -0,0 +1,6 @@ +/* +print(Math.add(1, 1)) +*/ +#pragma strict + +print(Math.add(1, 1)); From b404ce619db4b6ecb05de1a521bedb8a9aef6c68 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 8 Feb 2011 10:58:27 -0200 Subject: [PATCH 139/276] unused variables removed + allow multiple spaces after pragma id --- src/UnityScript/Parser/UnityScriptLexer.boo | 82 +++++++++++--------- src/UnityScript/Parser/UnityScriptParser.boo | 2 - src/UnityScript/UnityScript.g | 4 +- 3 files changed, 47 insertions(+), 41 deletions(-) diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index aa55acb..f8acaf8 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -1139,10 +1139,20 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): :_loop363_breakloop mID(true) id = returnToken_ - if ((cached_LA1==char(' ')) and (cached_LA2==char('o'))): - _saveIndex = text.Length - match(' ') - text.Length = _saveIndex + if ((cached_LA1==char(' ')) and (cached_LA2==char(' ') or cached_LA2==char('o')) and (LA(3)==char(' ') or LA(3)==char('f') or LA(3)==char('n') or LA(3)==char('o'))): + _cnt366 as int = 0 + while true: + if ((cached_LA1==char(' '))): + _saveIndex = text.Length + match(' ') + text.Length = _saveIndex + else: + if (_cnt366 >= 1): + goto _loop366_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt366 + :_loop366_breakloop if ((cached_LA1==char('o')) and (cached_LA2==char('f'))): _saveIndex = text.Length match("off") @@ -1155,7 +1165,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): text.Length = _saveIndex else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - elif ((cached_LA1==char('\n') or cached_LA1==char('\r') or cached_LA1==char(' ')) and (true)): // line 2102 + elif ((cached_LA1==char('\n') or cached_LA1==char('\r') or cached_LA1==char(' ')) and (true) and (true)): // line 2102 pass // 947 else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) @@ -1165,8 +1175,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): match(' ') text.Length = _saveIndex else: - goto _loop368_breakloop - :_loop368_breakloop + goto _loop369_breakloop + :_loop369_breakloop _saveIndex = text.Length mNEWLINE(false) text.Length = _saveIndex @@ -1421,18 +1431,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched393 as bool = false + synPredMatched394 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m393 as int = mark() - synPredMatched393 = true + _m394 as int = mark() + synPredMatched394 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched393 = false - rewind(_m393) + synPredMatched394 = false + rewind(_m394) --inputState.guessing - if synPredMatched393: + if synPredMatched394: mML_COMMENT(false) if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1445,8 +1455,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop398_breakloop - :_loop398_breakloop + goto _loop399_breakloop + :_loop399_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; elif ((_givenValue == char('='))): // 1831 @@ -1475,8 +1485,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop427_breakloop - :_loop427_breakloop + goto _loop428_breakloop + :_loop428_breakloop match("*/") if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1489,7 +1499,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt402 as int = 0 + _cnt403 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1503,12 +1513,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt402 >= 1): - goto _loop402_breakloop + if (_cnt403 >= 1): + goto _loop403_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt402 - :_loop402_breakloop + ++_cnt403 + :_loop403_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1529,8 +1539,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop406_breakloop - :_loop406_breakloop + goto _loop407_breakloop + :_loop407_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1579,8 +1589,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_4_) else: - goto _loop410_breakloop - :_loop410_breakloop + goto _loop411_breakloop + :_loop411_breakloop _saveIndex = text.Length match('\'') text.Length = _saveIndex @@ -1681,17 +1691,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt430 as int = 0 + _cnt431 as int = 0 while true: if ((tokenSet_5_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt430 >= 1): - goto _loop430_breakloop + if (_cnt431 >= 1): + goto _loop431_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt430 - :_loop430_breakloop + ++_cnt431 + :_loop431_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1749,17 +1759,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt436 as int = 0 + _cnt437 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt436 >= 1): - goto _loop436_breakloop + if (_cnt437 >= 1): + goto _loop437_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt436 - :_loop436_breakloop + ++_cnt437 + :_loop437_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 1f83a8c..a5a4860 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -3541,7 +3541,6 @@ class UnityScriptParser(antlr.LLkParser): se as SlicingExpression mce as MethodInvocationExpression args as ExpressionCollection - memberName as IToken try: // for error handling e=atom() @@ -3623,7 +3622,6 @@ class UnityScriptParser(antlr.LLkParser): tc as IToken = null c as IToken = null - uOperator = UnaryOperatorType.None try: // for error handling _givenValue = LA(1) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index f9a1707..64d3998 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -1331,7 +1331,6 @@ slicing_expression returns [Expression e] se as SlicingExpression mce as MethodInvocationExpression args as ExpressionCollection - memberName as IToken }: e=atom ( options { greedy=true; }: @@ -1378,7 +1377,6 @@ postfix_unary_expression returns [Expression e] unary_expression returns [Expression e] { - uOperator = UnaryOperatorType.None }: ( e=prefix_unary_expression @@ -1839,7 +1837,7 @@ ADD: '+'; PRAGMA_ON: "#pragma"! (' '!)+ id:ID - ((' '!) ("off"! { $setType(PRAGMA_OFF); } | "on"!))? + ((' '!)+ ("off"! { $setType(PRAGMA_OFF); } | "on"!))? (' '!)* NEWLINE!; From 7632be43e187313b9fcf2cdbae4b11c83f52cfe1 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 8 Feb 2011 11:03:57 -0200 Subject: [PATCH 140/276] support for test cases containing multiple modules --- refresh-tests.boo | 69 +++++++++++-------- .../AbstractCompilerTest.boo | 7 +- .../AbstractCompilerTestFixture.boo | 2 +- ...rojectIntegrationTestFixture.Generated.boo | 11 +++ .../ProjectIntegrationTestFixture.boo | 20 ++++++ .../UnityScript.Tests.booproj | 6 +- src/UnityScript/Steps/ApplySemantics.boo | 2 +- .../ducky-mixed-with-pragma-strict/1-main.js | 6 ++ .../2-ducky-operator.js | 3 + 9 files changed, 89 insertions(+), 37 deletions(-) create mode 100644 src/UnityScript.Tests/ProjectIntegrationTestFixture.Generated.boo create mode 100644 src/UnityScript.Tests/ProjectIntegrationTestFixture.boo create mode 100644 tests/projects/ducky-mixed-with-pragma-strict/1-main.js create mode 100644 tests/projects/ducky-mixed-with-pragma-strict/2-ducky-operator.js diff --git a/refresh-tests.boo b/refresh-tests.boo index 9ecb581..64b0451 100755 --- a/refresh-tests.boo +++ b/refresh-tests.boo @@ -14,21 +14,7 @@ import Boo.Lang.PatternMatching // return Path.Combine(Project.BaseDirectory, path) def GetTestCaseName(fname as string): - return Path.GetFileNameWithoutExtension(fname).Replace("-", "_").Replace(".", "_") - -def WriteTestCases(writer as TextWriter, baseDirs as string*): - for baseDir in baseDirs: - count = 0 - for fname in Directory.GetFiles(baseDir): - continue unless fname.EndsWith(".js") - ++count - categoryAttribute = CategoryAttributeFor(fname) - writer.Write(""" - ${categoryAttribute} - [Test] def ${GetTestCaseName(fname)}(): - RunTestCase("${fname.Replace('\\', '/')}") - """) - print("${count} test cases found in ${baseDir}.") + return Path.GetFileNameWithoutExtension(fname).Replace("-", "_").Replace(".", "_") def CategoryAttributeFor(testFile as string): """ @@ -48,21 +34,20 @@ def FirstLineOf(fname as string): return reader.ReadLine() def GenerateTestFixture(targetFile as string, header as string, *srcDirs as (string)): - contents = GenerateTestFixtureSource(header, srcDirs) + contents = GenerateTestFixtureSource(header, srcDirs, JavascriptFilesIn, CategoryAttributeFor) + WriteFileIfChanged(targetFile, contents) + +def GenerateProjectTestFixture(targetFile as string, header as string, *srcDirs as (string)): + contents = GenerateTestFixtureSource(header, srcDirs, { dir | Directory.GetDirectories(dir) }, { dir | "" }) + WriteFileIfChanged(targetFile, contents) + +def WriteFileIfChanged(targetFile as string, contents as string): if ShouldReplaceContent(targetFile, contents): - WriteAllText(targetFile, contents) + File.WriteAllText(targetFile, contents) def ShouldReplaceContent(fname as string, contents as string): if not File.Exists(fname): return true - return ns(ReadAllText(fname)) != ns(contents) - -def ReadAllText(fname as string): - using reader=File.OpenText(fname): - return reader.ReadToEnd() - -def WriteAllText(fname as string, contents as string): - using writer=StreamWriter(fname): - writer.Write(contents) + return ns(File.ReadAllText(fname)) != ns(contents) def ns(s as string): """ @@ -70,11 +55,37 @@ Normalize string. """ return s.Trim().Replace("\r\n", Environment.NewLine) -def GenerateTestFixtureSource(header as string, srcDirs as (string)): +def GenerateTestFixtureSource( + header as string, + srcDirs as (string), + testCaseProducer as callable(string) as string*, + categoryProducer as callable(string) as string): + writer=StringWriter() writer.Write(header) - WriteTestCases(writer, srcDirs) + for srcDir in srcDirs: + count = 0 + for testCase in testCaseProducer(srcDir): + ++count + categoryAttribute = categoryProducer(testCase) + writer.Write(""" + ${categoryAttribute} + [Test] def ${GetTestCaseName(testCase)}(): + RunTestCase("${testCase.Replace('\\', '/')}") + """) + print "\t${count} test cases found in ${srcDir}." return writer.ToString() + +def JavascriptFilesIn(dir as string): + return fname for fname in Directory.GetFiles(dir) if fname.EndsWith(".js") + +GenerateProjectTestFixture("src/UnityScript.Tests/ProjectIntegrationTestFixture.Generated.boo", """ +namespace UnityScript.Tests + +import NUnit.Framework + +partial class ProjectIntegrationTestFixture: +""", "tests/projects") GenerateTestFixture("src/UnityScript.Tests/ParserTestFixture.Generated.boo", """ namespace UnityScript.Tests @@ -103,7 +114,6 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): override def SetCompilationOptions(): super() - Parameters.Ducky = false Parameters.Strict = true """, "tests/integration") @@ -117,7 +127,6 @@ import NUnit.Framework class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): override def SetCompilationOptions(): super() - Parameters.Ducky = true Parameters.Strict = false """, "tests/integration", "tests/ducky") diff --git a/src/UnityScript.Tests/AbstractCompilerTest.boo b/src/UnityScript.Tests/AbstractCompilerTest.boo index 39a5516..823ade9 100644 --- a/src/UnityScript.Tests/AbstractCompilerTest.boo +++ b/src/UnityScript.Tests/AbstractCompilerTest.boo @@ -30,15 +30,14 @@ abstract class AbstractCompilerTest: compiler.Parameters.References.Add(typeof(UnityScript.Tests.CSharp.FooBarEnum).Assembly) return compiler - virtual def CompileTestCase([required] input as ICompilerInput): + virtual def CompileTestCase(*inputs as (ICompilerInput)): SetCompilationOptions() - Parameters.OutputAssembly = Path.Combine(OutputAssemblyPath, GetType().Name + "-" + Path.GetFileNameWithoutExtension(input.Name) + ".exe") - Parameters.Input.Add(input) + for input in inputs: Parameters.Input.Add(input) + Parameters.OutputAssembly = Path.Combine(OutputAssemblyPath, GetType().Name + "-" + Path.GetFileNameWithoutExtension(Parameters.Input[0].Name) + ".exe") return _compiler.Run() virtual def SetCompilationOptions(): Parameters.Input.Clear() - Parameters.Ducky = true Parameters.Strict = false Parameters.Expando = false diff --git a/src/UnityScript.Tests/AbstractCompilerTestFixture.boo b/src/UnityScript.Tests/AbstractCompilerTestFixture.boo index b5fd70c..649f20e 100755 --- a/src/UnityScript.Tests/AbstractCompilerTestFixture.boo +++ b/src/UnityScript.Tests/AbstractCompilerTestFixture.boo @@ -53,7 +53,7 @@ abstract class AbstractCompilerTestFixture(AbstractCompilerTest): protected virtual def GetActualOutput(result as CompilerContext) as string: return result.CompileUnit.Modules[0].ToCodeString() - def GetExpectedOutput([required] fname as string): + protected virtual def GetExpectedOutput([required] fname as string): contents = ReadAllText(fname) start = contents.IndexOf("/*") end = contents.IndexOf("*/", start + 2) diff --git a/src/UnityScript.Tests/ProjectIntegrationTestFixture.Generated.boo b/src/UnityScript.Tests/ProjectIntegrationTestFixture.Generated.boo new file mode 100644 index 0000000..43c4988 --- /dev/null +++ b/src/UnityScript.Tests/ProjectIntegrationTestFixture.Generated.boo @@ -0,0 +1,11 @@ + +namespace UnityScript.Tests + +import NUnit.Framework + +partial class ProjectIntegrationTestFixture: + + + [Test] def ducky_mixed_with_pragma_strict(): + RunTestCase("tests/projects/ducky-mixed-with-pragma-strict") + \ No newline at end of file diff --git a/src/UnityScript.Tests/ProjectIntegrationTestFixture.boo b/src/UnityScript.Tests/ProjectIntegrationTestFixture.boo new file mode 100644 index 0000000..83ff9b3 --- /dev/null +++ b/src/UnityScript.Tests/ProjectIntegrationTestFixture.boo @@ -0,0 +1,20 @@ +namespace UnityScript.Tests + +import NUnit.Framework +import Boo.Lang.Compiler.IO +import System.IO + +[TestFixture] +partial class ProjectIntegrationTestFixture(AbstractIntegrationTestFixture): + + override def CompileTestCase(location as string): + return CompileTestCase(*array(FileInput(file) for file in SourceFilesIn(location))) + + override def GetExpectedOutput(location as string): + return super(SourceFilesIn(location)[0]) + + def SourceFilesIn(location as string): + files = Directory.GetFiles(location, "*.js") + System.Array.Sort(files) + return files + \ No newline at end of file diff --git a/src/UnityScript.Tests/UnityScript.Tests.booproj b/src/UnityScript.Tests/UnityScript.Tests.booproj index 2944cae..a265605 100755 --- a/src/UnityScript.Tests/UnityScript.Tests.booproj +++ b/src/UnityScript.Tests/UnityScript.Tests.booproj @@ -20,6 +20,7 @@ false false + false none @@ -28,6 +29,7 @@ false false + false @@ -42,7 +44,6 @@ - @@ -72,6 +73,9 @@ + + + diff --git a/src/UnityScript/Steps/ApplySemantics.boo b/src/UnityScript/Steps/ApplySemantics.boo index 006cc94..c499ec4 100755 --- a/src/UnityScript/Steps/ApplySemantics.boo +++ b/src/UnityScript/Steps/ApplySemantics.boo @@ -127,7 +127,7 @@ class ApplySemantics(AbstractVisitorCompilerStep): existing.Annotate("UserDefined") return existing - klass = ClassDefinition(module.LexicalInfo, Name: module.Name, EndSourceLocation: module.EndSourceLocation) + klass = ClassDefinition(module.LexicalInfo, Name: module.Name, EndSourceLocation: module.EndSourceLocation, IsSynthetic: true) AddScriptBaseType(klass) return klass diff --git a/tests/projects/ducky-mixed-with-pragma-strict/1-main.js b/tests/projects/ducky-mixed-with-pragma-strict/1-main.js new file mode 100644 index 0000000..d20f427 --- /dev/null +++ b/tests/projects/ducky-mixed-with-pragma-strict/1-main.js @@ -0,0 +1,6 @@ +/* +42 +*/ +#pragma strict + +print(Math.add(21.0, 21)); diff --git a/tests/projects/ducky-mixed-with-pragma-strict/2-ducky-operator.js b/tests/projects/ducky-mixed-with-pragma-strict/2-ducky-operator.js new file mode 100644 index 0000000..68c61dc --- /dev/null +++ b/tests/projects/ducky-mixed-with-pragma-strict/2-ducky-operator.js @@ -0,0 +1,3 @@ +static class Math { + function add(x, y) { return x + y; } +} From acfa345174d3de140f6d2b3a6883af9c144437c7 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 8 Feb 2011 11:07:00 -0200 Subject: [PATCH 141/276] keep CompilerParameters.Ducky always in sync with CompilerParameters.Strict (Ducky = not Strict); keep CompilerParameters.Strict in sync with per module pragma strict value; work in progress --- .../DuckyIntegrationTestFixture.boo | 1 - .../StrictIntegrationTestFixture.boo | 1 - .../Steps/ExpandUnityDuckTypedExpressions.boo | 6 ++- .../Steps/ProcessUnityScriptMethods.boo | 45 ++++++++++++++----- .../UnityScriptCompilerParameters.boo | 5 ++- src/us/CommandLineOptions.boo | 3 -- src/us/UnityScriptCompilerFactory.boo | 1 - 7 files changed, 41 insertions(+), 21 deletions(-) diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index e61c225..ee10099 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -7,7 +7,6 @@ import NUnit.Framework class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): override def SetCompilationOptions(): super() - Parameters.Ducky = true Parameters.Strict = false diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index 78980b1..9fe807f 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -8,7 +8,6 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): override def SetCompilationOptions(): super() - Parameters.Ducky = false Parameters.Strict = true diff --git a/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo b/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo index 91cc419..dac438b 100755 --- a/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo +++ b/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo @@ -18,9 +18,11 @@ class ExpandUnityDuckTypedExpressions(ExpandDuckTypedExpressions): UnityRuntimeServices_Invoke = ResolveUnityRuntimeMethod("Invoke") UnityRuntimeServices_GetProperty = ResolveUnityRuntimeMethod("GetProperty") - override def EnterModule(module as Module): + override def OnModule(module as Module): _expando = UnityScriptParameters.Expando or Pragmas.IsEnabledOn(module, Pragmas.Expando) - return super(module) + preserving Parameters.Strict: + Parameters.Strict = Pragmas.IsEnabledOn(module, Pragmas.Strict) + super(module) override def GetSetPropertyMethod(): if not _expando: return super() diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index 06dad43..1fc4e12 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -28,8 +28,6 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): deferred _UnityRuntimeServices_GetTypeOf = ResolveUnityRuntimeMethod("GetTypeOf") - _strict = false - _implicit = false override def Initialize(context as CompilerContext): @@ -61,15 +59,15 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): return TypeSystemServices.IEnumeratorType override def IsDuckTyped(e as Expression): - if _strict: return false + if Strict: return false return super(e) override def IsDuckTyped(member as IMember): - if _strict: return false + if Strict: return false return super(member) override protected def MemberNotFound(node as MemberReferenceExpression, ns as INamespace): - if (not _strict) and (UnityScriptParameters.Expando or super.IsDuckTyped(node.Target)): + if (not Strict) and (UnityScriptParameters.Expando or super.IsDuckTyped(node.Target)): BindQuack(node); return super(node, ns) @@ -79,13 +77,36 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): AssertUniqueLocal(d) return null return super(d) + + override def OnModule(module as Module): + downcastPermissions = my(UnityDowncastPermissions) + + preserving _activeModule, Parameters.Strict, _implicit, downcastPermissions.Enabled: + _activeModule = module + Parameters.Strict = Pragmas.IsEnabledOn(module, Pragmas.Strict) + _implicit = Pragmas.IsEnabledOn(module, Pragmas.Implicit) + downcastPermissions.Enabled = Pragmas.IsEnabledOn(module, Pragmas.Downcast) + super(module) + + override def VisitMemberPreservingContext(node as TypeMember): + downcastPermissions = my(UnityDowncastPermissions) + + module = node.EnclosingModule + if module is _activeModule: + super(node) + return - override def OnModule(module as Module): - Parameters.Strict = _strict = Pragmas.IsEnabledOn(module, Pragmas.Strict) - Parameters.Ducky = not _strict - _implicit = Pragmas.IsEnabledOn(module, Pragmas.Implicit) - my(UnityDowncastPermissions).Enabled = Pragmas.IsEnabledOn(module, Pragmas.Downcast) - super(module) + preserving _activeModule, Parameters.Strict, _implicit, downcastPermissions.Enabled: + _activeModule = module + Parameters.Strict = Pragmas.IsEnabledOn(module, Pragmas.Strict) + _implicit = Pragmas.IsEnabledOn(module, Pragmas.Implicit) + downcastPermissions.Enabled = Pragmas.IsEnabledOn(module, Pragmas.Downcast) + super(node) + + _activeModule as Module + + Strict: + get: return Parameters.Strict override def OnMethod(node as Method): super(node) @@ -113,7 +134,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): ContextAnnotations.SetEntryPoint(_context, node) override def ProcessAutoLocalDeclaration(node as BinaryExpression, reference as ReferenceExpression): - if (_strict and not _implicit) and not IsCompilerGenerated(reference): + if (Strict and not _implicit) and not IsCompilerGenerated(reference): EmitUnknownIdentifierError(reference, reference.Name) else: super(node, reference) diff --git a/src/UnityScript/UnityScriptCompilerParameters.boo b/src/UnityScript/UnityScriptCompilerParameters.boo index 25a39ed..4c0a0c3 100755 --- a/src/UnityScript/UnityScriptCompilerParameters.boo +++ b/src/UnityScript/UnityScriptCompilerParameters.boo @@ -28,7 +28,6 @@ class UnityScriptCompilerParameters(CompilerParameters): _disableEval as string def constructor(): - self.Ducky = true self.OutputType = CompilerOutputType.Library self.References.Add(typeof(UnityScript.Lang.Array).Assembly) self.References.Add(GetType().Assembly) @@ -39,3 +38,7 @@ class UnityScriptCompilerParameters(CompilerParameters): DowncastPermissions: { UnityDowncastPermissions() }, LanguageAmbiance: { UnityScriptAmbiance() } } + + override Ducky: + get: return not Strict + set: raise "Ducky is always equals not Strict. Set Strict instead." diff --git a/src/us/CommandLineOptions.boo b/src/us/CommandLineOptions.boo index 314f8a1..15ee19d 100755 --- a/src/us/CommandLineOptions.boo +++ b/src/us/CommandLineOptions.boo @@ -66,9 +66,6 @@ class CommandLineOptions(AbstractCommandLine): [Option("Execute resulting main method.", ShortForm: 'x', LongForm: 'execute')] public Execute = false - - [Option("Enable duck typing.", LongForm: "ducky")] - public Ducky = false [Option("Enable expando mode.", LongForm: "expando")] public Expando = false diff --git a/src/us/UnityScriptCompilerFactory.boo b/src/us/UnityScriptCompilerFactory.boo index 50ebf33..6e36414 100644 --- a/src/us/UnityScriptCompilerFactory.boo +++ b/src/us/UnityScriptCompilerFactory.boo @@ -58,7 +58,6 @@ class UnityScriptCompilerFactory: baseType = resolveType(assemblies, options.BaseClass) compiler.Parameters.ScriptBaseType = baseType compiler.Parameters.ScriptMainMethod = options.MainMethod - compiler.Parameters.Ducky = options.Ducky compiler.Parameters.Debug = options.Debug compiler.Parameters.Expando = options.Expando compiler.Parameters.DisableEval = options.DisableEval From 1ed0dcdc55f1e7d71d067d38aa1e2588702848a0 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 8 Feb 2011 11:21:09 -0200 Subject: [PATCH 142/276] keep variable close to its usage --- src/UnityScript/Steps/ProcessUnityScriptMethods.boo | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index 1fc4e12..522a50e 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -80,7 +80,6 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): override def OnModule(module as Module): downcastPermissions = my(UnityDowncastPermissions) - preserving _activeModule, Parameters.Strict, _implicit, downcastPermissions.Enabled: _activeModule = module Parameters.Strict = Pragmas.IsEnabledOn(module, Pragmas.Strict) @@ -89,13 +88,13 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): super(module) override def VisitMemberPreservingContext(node as TypeMember): - downcastPermissions = my(UnityDowncastPermissions) module = node.EnclosingModule if module is _activeModule: super(node) return + downcastPermissions = my(UnityDowncastPermissions) preserving _activeModule, Parameters.Strict, _implicit, downcastPermissions.Enabled: _activeModule = module Parameters.Strict = Pragmas.IsEnabledOn(module, Pragmas.Strict) From 78bf19838329b645a7c41391991918a69897d98f Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 8 Feb 2011 11:23:36 -0200 Subject: [PATCH 143/276] test case for dynamically dispatched negation --- src/UnityScript.Tests/DuckyIntegrationTestFixture.boo | 4 ++++ tests/ducky/duck-negation.js | 10 ++++++++++ 2 files changed, 14 insertions(+) create mode 100644 tests/ducky/duck-negation.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index ee10099..7e83aae 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -698,6 +698,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/ducky/duck-implicit-bool-simple.js") + [Test] def duck_negation(): + RunTestCase("tests/ducky/duck-negation.js") + + [Test] def duck_return_property(): RunTestCase("tests/ducky/duck-return-property.js") diff --git a/tests/ducky/duck-negation.js b/tests/ducky/duck-negation.js new file mode 100644 index 0000000..a68cbe4 --- /dev/null +++ b/tests/ducky/duck-negation.js @@ -0,0 +1,10 @@ +/* +42 +42 +*/ +function abs(i) { + return i >= 0 ? i : -i; +} + +print(abs(42)); +print(abs(-42)); From ffcb8bd2c22e8514edf4e1c4debd0482d991c457 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 9 Feb 2011 10:23:07 -0200 Subject: [PATCH 144/276] gently deprecates -ducky command line option --- src/us/CommandLineOptions.boo | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/us/CommandLineOptions.boo b/src/us/CommandLineOptions.boo index 15ee19d..89a9ca0 100755 --- a/src/us/CommandLineOptions.boo +++ b/src/us/CommandLineOptions.boo @@ -51,6 +51,10 @@ class CommandLineOptions(AbstractCommandLine): and len(self.MainMethod) > 0 and (len(self.SourceFiles) > 0 or len(self.SourceDirs) > 0)) + + [Option("Option has been deprecated", LongForm: "ducky")] + def DuckyHasBeenDeprecated(value): + Console.Error.WriteLine("WARNING: -ducky command line option has been deprecated and has no effect") [Option("Specifies the output {file} name", ShortForm: "o", LongForm: "out")] public Output = "" From 8324cba0c981a4394f8a6dc152b47bbb1c12a700 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 9 Feb 2011 12:25:23 -0200 Subject: [PATCH 145/276] fixed to comply with latest changes to boo --- src/UnityScript/Steps/ProcessUnityScriptMethods.boo | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index 1fc4e12..8ef96f6 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -142,7 +142,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): def IsCompilerGenerated(reference as ReferenceExpression): return reference.Name.Contains('$') - override protected def ProcessBuiltinInvocation(function as BuiltinFunction, node as MethodInvocationExpression): + override protected def ProcessBuiltinInvocation(node as MethodInvocationExpression, function as BuiltinFunction): if function is UnityScriptTypeSystem.UnityScriptEval: EvalAnnotation.Mark(_currentMethod.Method) BindExpressionType(node, TypeSystemServices.ObjectType) @@ -150,7 +150,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): if function is UnityScriptTypeSystem.UnityScriptTypeof: ProcessTypeofBuiltin(node); return - super(function, node) + super(node, function) private def ProcessTypeofBuiltin(node as MethodInvocationExpression): if node.Arguments.Count != 1: @@ -165,18 +165,17 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): node.Target = CodeBuilder.CreateReference(_UnityRuntimeServices_GetTypeOf) BindExpressionType(node, TypeSystemServices.TypeType) - override protected def ProcessMethodInvocation(node as MethodInvocationExpression, targetEntity as IEntity): + override protected def ProcessMethodInvocation(node as MethodInvocationExpression, method as IMethod): """ Automatically detects coroutine invocations in assignments and as standalone expressions and generates StartCoroutine invocations. """ - super(node, targetEntity) + super(node, method) if not IsPossibleStartCoroutineInvocation(node): return - method as IMethod = targetEntity - if method is null or method.IsStatic: return + if method.IsStatic: return tss = self.UnityScriptTypeSystem if not tss.IsScriptType(method.DeclaringType): return From b18fa94d36dd797aa53fa0ef6b27dbde6375d944 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 10 Feb 2011 12:06:34 -0200 Subject: [PATCH 146/276] prefer property macro over property attribute --- .../UnityScriptCompilerParameters.boo | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/UnityScript/UnityScriptCompilerParameters.boo b/src/UnityScript/UnityScriptCompilerParameters.boo index 4c0a0c3..3cdeaab 100755 --- a/src/UnityScript/UnityScriptCompilerParameters.boo +++ b/src/UnityScript/UnityScriptCompilerParameters.boo @@ -5,27 +5,22 @@ import Boo.Lang.Compiler import Boo.Lang.Compiler.Services import Boo.Lang.Compiler.TypeSystem import Boo.Lang.Compiler.TypeSystem.Services + import UnityScript.TypeSystem class UnityScriptCompilerParameters(CompilerParameters): - [property(ScriptBaseType)] - _baseType as System.Type + property ScriptBaseType as System.Type - [property(ScriptMainMethod)] - _mainMethod as string + property ScriptMainMethod as string - [property(Imports)] - _imports = [] + property Imports = List of string() - [property(Expando)] - _expando = false + property Expando = false - [property(GlobalVariablesBecomeFields)] - _globalVariablesBecomeFields = true + property GlobalVariablesBecomeFields = true - [property(DisableEval)] - _disableEval as string + property DisableEval as string def constructor(): self.OutputType = CompilerOutputType.Library From 0b2060026fd479caade8861272fd9647ceb5620b Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 10 Feb 2011 14:27:59 -0200 Subject: [PATCH 147/276] enable dynamic dispatching for any unknown member in non strict mode (and no longer require DuckTyped annotation for dynamic dispatching); that's the normal javascript behaviour which also happens to provide better performance for members that can be statically determined --- src/UnityScript.Tests/AbstractCompilerTest.boo | 1 - src/UnityScript.Tests/MonoBehaviour.boo | 1 - src/UnityScript/Steps/ProcessUnityScriptMethods.boo | 8 ++++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/UnityScript.Tests/AbstractCompilerTest.boo b/src/UnityScript.Tests/AbstractCompilerTest.boo index 823ade9..3fc7aae 100644 --- a/src/UnityScript.Tests/AbstractCompilerTest.boo +++ b/src/UnityScript.Tests/AbstractCompilerTest.boo @@ -39,7 +39,6 @@ abstract class AbstractCompilerTest: virtual def SetCompilationOptions(): Parameters.Input.Clear() Parameters.Strict = false - Parameters.Expando = false protected abstract def CreateCompilerPipeline() as CompilerPipeline: pass diff --git a/src/UnityScript.Tests/MonoBehaviour.boo b/src/UnityScript.Tests/MonoBehaviour.boo index cff0176..e7a12c5 100755 --- a/src/UnityScript.Tests/MonoBehaviour.boo +++ b/src/UnityScript.Tests/MonoBehaviour.boo @@ -92,7 +92,6 @@ class MonoBehaviour(Component): routine.MoveNext() return routine.Current - [DuckTyped] def GetComponent(type as System.Type) as Component: return _foo if ComponentFoo is type return _bar diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index a5df110..687ab62 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -67,10 +67,10 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): return super(member) override protected def MemberNotFound(node as MemberReferenceExpression, ns as INamespace): - if (not Strict) and (UnityScriptParameters.Expando or super.IsDuckTyped(node.Target)): - BindQuack(node); - return - super(node, ns) + if Strict: + super(node, ns) + else: + BindQuack(node) override protected def LocalToReuseFor(d as Declaration): if DeclarationAnnotations.ShouldForceNewVariableFor(d): From ea9913c04203ee074be5e2ab6555b0c5fb115530 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 10 Feb 2011 14:28:20 -0200 Subject: [PATCH 148/276] some duplication removed --- .../Steps/ProcessUnityScriptMethods.boo | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index 687ab62..88424e8 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -81,10 +81,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): override def OnModule(module as Module): downcastPermissions = my(UnityDowncastPermissions) preserving _activeModule, Parameters.Strict, _implicit, downcastPermissions.Enabled: - _activeModule = module - Parameters.Strict = Pragmas.IsEnabledOn(module, Pragmas.Strict) - _implicit = Pragmas.IsEnabledOn(module, Pragmas.Implicit) - downcastPermissions.Enabled = Pragmas.IsEnabledOn(module, Pragmas.Downcast) + EnterModuleContext(module) super(module) override def VisitMemberPreservingContext(node as TypeMember): @@ -96,11 +93,14 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): downcastPermissions = my(UnityDowncastPermissions) preserving _activeModule, Parameters.Strict, _implicit, downcastPermissions.Enabled: - _activeModule = module - Parameters.Strict = Pragmas.IsEnabledOn(module, Pragmas.Strict) - _implicit = Pragmas.IsEnabledOn(module, Pragmas.Implicit) - downcastPermissions.Enabled = Pragmas.IsEnabledOn(module, Pragmas.Downcast) + EnterModuleContext(module) super(node) + + private def EnterModuleContext(module as Module): + _activeModule = module + Parameters.Strict = Pragmas.IsEnabledOn(module, Pragmas.Strict) + _implicit = Pragmas.IsEnabledOn(module, Pragmas.Implicit) + downcastPermissions.Enabled = Pragmas.IsEnabledOn(module, Pragmas.Downcast) _activeModule as Module From bb8f88b28ddacf3806ed80bc2b9d7d65a59d2fa9 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 10 Feb 2011 14:28:55 -0200 Subject: [PATCH 149/276] test proving that [TypeInferenceRule("TypeReferencedByFirstArgument")] works in strict mode --- .../DuckyIntegrationTestFixture.boo | 4 ++++ src/UnityScript.Tests/MonoBehaviour.boo | 5 ++++- .../StrictIntegrationTestFixture.boo | 4 ++++ tests/integration/inferred-GetComponent.js | 13 +++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tests/integration/inferred-GetComponent.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 7e83aae..df6382e 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -394,6 +394,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/implict-bool-hierarchy.js") + [Test] def inferred_GetComponent(): + RunTestCase("tests/integration/inferred-GetComponent.js") + + [Test] def initializeorder(): RunTestCase("tests/integration/initializeorder.js") diff --git a/src/UnityScript.Tests/MonoBehaviour.boo b/src/UnityScript.Tests/MonoBehaviour.boo index e7a12c5..3a439db 100755 --- a/src/UnityScript.Tests/MonoBehaviour.boo +++ b/src/UnityScript.Tests/MonoBehaviour.boo @@ -92,11 +92,14 @@ class MonoBehaviour(Component): routine.MoveNext() return routine.Current + [TypeInferenceRule("TypeReferencedByFirstArgument")] + def InferredGetComponent(type as System.Type) as Component: + return GetComponent(type) + def GetComponent(type as System.Type) as Component: return _foo if ComponentFoo is type return _bar - [DuckTyped] def GetComponents(type as System.Type) as (Component): return (GetComponent(type),) diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index 9fe807f..bc41ee0 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -396,6 +396,10 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/implict-bool-hierarchy.js") + [Test] def inferred_GetComponent(): + RunTestCase("tests/integration/inferred-GetComponent.js") + + [Test] def initializeorder(): RunTestCase("tests/integration/initializeorder.js") diff --git a/tests/integration/inferred-GetComponent.js b/tests/integration/inferred-GetComponent.js new file mode 100644 index 0000000..ef23e80 --- /dev/null +++ b/tests/integration/inferred-GetComponent.js @@ -0,0 +1,13 @@ +/* +foo +bar +*/ +#pragma strict + +import UnityScript.Tests; + +var foo = InferredGetComponent(ComponentFoo); +foo.Foo(); + +var bar = InferredGetComponent(ComponentBar); +bar.Bar(); \ No newline at end of file From 8cc0199df3af1bcc0da85c2d3f56be8ecec0b77a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 10 Feb 2011 14:38:04 -0200 Subject: [PATCH 150/276] oops... --- src/UnityScript/Steps/ProcessUnityScriptMethods.boo | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index 88424e8..4bc7e70 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -79,8 +79,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): return super(d) override def OnModule(module as Module): - downcastPermissions = my(UnityDowncastPermissions) - preserving _activeModule, Parameters.Strict, _implicit, downcastPermissions.Enabled: + preserving _activeModule, Parameters.Strict, _implicit, my(UnityDowncastPermissions).Enabled: EnterModuleContext(module) super(module) @@ -91,8 +90,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): super(node) return - downcastPermissions = my(UnityDowncastPermissions) - preserving _activeModule, Parameters.Strict, _implicit, downcastPermissions.Enabled: + preserving _activeModule, Parameters.Strict, _implicit, my(UnityDowncastPermissions).Enabled: EnterModuleContext(module) super(node) @@ -100,7 +98,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): _activeModule = module Parameters.Strict = Pragmas.IsEnabledOn(module, Pragmas.Strict) _implicit = Pragmas.IsEnabledOn(module, Pragmas.Implicit) - downcastPermissions.Enabled = Pragmas.IsEnabledOn(module, Pragmas.Downcast) + my(UnityDowncastPermissions).Enabled = Pragmas.IsEnabledOn(module, Pragmas.Downcast) _activeModule as Module From 6c4302ceee705b7763494cd551b6f5c573b6721c Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 11 Feb 2011 12:14:15 -0200 Subject: [PATCH 151/276] use TypeInferenceRules enum instead of hard coded rule name --- src/UnityScript.Tests/MonoBehaviour.boo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UnityScript.Tests/MonoBehaviour.boo b/src/UnityScript.Tests/MonoBehaviour.boo index 3a439db..e814bd3 100755 --- a/src/UnityScript.Tests/MonoBehaviour.boo +++ b/src/UnityScript.Tests/MonoBehaviour.boo @@ -92,7 +92,7 @@ class MonoBehaviour(Component): routine.MoveNext() return routine.Current - [TypeInferenceRule("TypeReferencedByFirstArgument")] + [TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)] def InferredGetComponent(type as System.Type) as Component: return GetComponent(type) From 6e07a58b70b4716928fe4fc1fee8af963a0c7e4c Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 14 Feb 2011 10:11:16 -0200 Subject: [PATCH 152/276] fix Boo.Lang reference --- src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj b/src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj index e737134..e8f1d7e 100755 --- a/src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj +++ b/src/UnityScript.Tests.CSharp/UnityScript.Tests.CSharp.csproj @@ -31,7 +31,7 @@ - + From 1c61798bc0437b94130f6236b95c1840636c3dfe Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 22 Feb 2011 16:33:45 +0100 Subject: [PATCH 153/276] introduce -x-type-inference-rule-attribute so Unity can provide custom type inference rules without a hard dependency on Boo.Lang.dll --- default.build | 1 - .../UnityScriptCompilerFactoryTestFixture.boo | 35 ++++++++++++++++++- .../UnityScriptCompilerParameters.boo | 3 ++ src/us/CommandLineOptions.boo | 3 ++ src/us/UnityScriptCompilerFactory.boo | 7 ++++ 5 files changed, 47 insertions(+), 2 deletions(-) mode change 100644 => 100755 src/UnityScript.Tests/UnityScriptCompilerFactoryTestFixture.boo mode change 100644 => 100755 src/us/UnityScriptCompilerFactory.boo diff --git a/default.build b/default.build index 8ed462b..c5cf12c 100755 --- a/default.build +++ b/default.build @@ -93,7 +93,6 @@ - diff --git a/src/UnityScript.Tests/UnityScriptCompilerFactoryTestFixture.boo b/src/UnityScript.Tests/UnityScriptCompilerFactoryTestFixture.boo old mode 100644 new mode 100755 index db3dddd..ec6e326 --- a/src/UnityScript.Tests/UnityScriptCompilerFactoryTestFixture.boo +++ b/src/UnityScript.Tests/UnityScriptCompilerFactoryTestFixture.boo @@ -3,6 +3,11 @@ namespace UnityScript.Tests import NUnit.Framework import us +import Boo.Lang.Environments +import Boo.Lang.Compiler +import Boo.Lang.Compiler.Steps +import Boo.Lang.Compiler.TypeSystem.Services + [TestFixture] class UnityScriptCompilerFactoryTestFixture: @@ -12,12 +17,40 @@ class UnityScriptCompilerFactoryTestFixture: options = CommandLineOptions( "-d:FOO", "--define:BAR", - "-method:Awake", "-base:${typeof(MonoBehaviour).FullName}", "-r:${GetAssemblyLocation()}") + "-method:Awake", "-base:$MonoBehaviour", + "-r:$(GetAssemblyLocation())") compiler = UnityScriptCompilerFactory.FromCommandLineOptions(options) Assert.AreEqual(["FOO", "BAR"], [define for define in compiler.Parameters.Defines.Keys]) + [Test] + def CustomTypeInferenceRuleAttribute(): + + options = CommandLineOptions( + "-x-type-inference-rule-attribute:$CustomAttribute", + + "-method:Awake", "-base:$MonoBehaviour", + "-r:$(GetAssemblyLocation())") + + compiler = UnityScriptCompilerFactory.FromCommandLineOptions(options) + compiler.Parameters.Pipeline = CompilerPipeline() { ActionStep(CheckCustomTypeInferenceRuleAttribute) } + result = compiler.Run() + Assert.AreEqual(0, len(result.Errors), result.Errors.ToString(true)) + + private def CheckCustomTypeInferenceRuleAttribute(): + method = GetType().GetMethod("MethodWithCustomAttribute") + rule = my(TypeInferenceRuleProvider).TypeInferenceRuleFor(method) + Assert.AreEqual("custom", rule) + + [CustomAttribute] + def MethodWithCustomAttribute(): + return null + +class CustomAttribute(System.Attribute): + override def ToString(): + return "custom" + diff --git a/src/UnityScript/UnityScriptCompilerParameters.boo b/src/UnityScript/UnityScriptCompilerParameters.boo index 4c0a0c3..72d7558 100755 --- a/src/UnityScript/UnityScriptCompilerParameters.boo +++ b/src/UnityScript/UnityScriptCompilerParameters.boo @@ -39,6 +39,9 @@ class UnityScriptCompilerParameters(CompilerParameters): LanguageAmbiance: { UnityScriptAmbiance() } } + def AddToEnvironment(serviceType as System.Type, factory as ObjectFactory): + (Environment as DeferredEnvironment).Add(serviceType, factory) + override Ducky: get: return not Strict set: raise "Ducky is always equals not Strict. Set Strict instead." diff --git a/src/us/CommandLineOptions.boo b/src/us/CommandLineOptions.boo index 89a9ca0..b0d3c44 100755 --- a/src/us/CommandLineOptions.boo +++ b/src/us/CommandLineOptions.boo @@ -127,6 +127,9 @@ class CommandLineOptions(AbstractCommandLine): [Option("display this help and exit", LongForm: "help")] public DoHelp = false + + [Option("Enables custom type inference rules to be specified through the attribute {type}", LongForm: "x-type-inference-rule-attribute")] + public TypeInferenceRuleAttribute as string [Argument] def AddSourceFile([required] sourceFile as string): diff --git a/src/us/UnityScriptCompilerFactory.boo b/src/us/UnityScriptCompilerFactory.boo old mode 100644 new mode 100755 index 6e36414..c10b440 --- a/src/us/UnityScriptCompilerFactory.boo +++ b/src/us/UnityScriptCompilerFactory.boo @@ -5,6 +5,8 @@ import Boo.Lang.Compiler import Boo.Lang.Compiler.IO import Boo.Lang.Compiler.Resources +import Boo.Lang.Compiler.TypeSystem.Services + import System.IO import System.Diagnostics @@ -63,6 +65,11 @@ class UnityScriptCompilerFactory: compiler.Parameters.DisableEval = options.DisableEval compiler.Parameters.Imports.Extend(options.Imports) + if options.TypeInferenceRuleAttribute: + compiler.Parameters.AddToEnvironment( + TypeInferenceRuleProvider, + { CustomTypeInferenceRuleProvider(options.TypeInferenceRuleAttribute) }) + if options.DebugCompiler: compiler.Parameters.Pipeline.BeforeStep += do(sender, args as CompilerStepEventArgs): print "*" * 25 From fb276dae4ce0b66e7d4d172553ea6e46e8aa897a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 28 Feb 2011 14:02:46 -0300 Subject: [PATCH 154/276] test case for overloaded generic base class method --- .../GenericsTestFixture.Generated.boo | 4 ++++ src/UnityScript.Tests/MonoBehaviour.boo | 6 +++++- .../generic-method-overload-in-base-class.js | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) mode change 100755 => 100644 src/UnityScript.Tests/MonoBehaviour.boo create mode 100644 tests/generics/generic-method-overload-in-base-class.js diff --git a/src/UnityScript.Tests/GenericsTestFixture.Generated.boo b/src/UnityScript.Tests/GenericsTestFixture.Generated.boo index 0c6b19c..c476bc6 100644 --- a/src/UnityScript.Tests/GenericsTestFixture.Generated.boo +++ b/src/UnityScript.Tests/GenericsTestFixture.Generated.boo @@ -21,4 +21,8 @@ class GenericsTestFixture(AbstractIntegrationTestFixture): [Test] def generic_method_arguments(): RunTestCase("tests/generics/generic-method-arguments.js") + + + [Test] def generic_method_overload_in_base_class(): + RunTestCase("tests/generics/generic-method-overload-in-base-class.js") \ No newline at end of file diff --git a/src/UnityScript.Tests/MonoBehaviour.boo b/src/UnityScript.Tests/MonoBehaviour.boo old mode 100755 new mode 100644 index e814bd3..842f17f --- a/src/UnityScript.Tests/MonoBehaviour.boo +++ b/src/UnityScript.Tests/MonoBehaviour.boo @@ -14,7 +14,11 @@ struct Vector3: z = z_ class Component: - pass + def GetComponentsInChildren[of T]() as T: + return typeof(T)() + + def GetComponentsInChildren[of T](instantiate as bool) as T: + if instantiate: return typeof(T)() struct Bounds: def IntersectRay(ray as Ray, ref result as single): diff --git a/tests/generics/generic-method-overload-in-base-class.js b/tests/generics/generic-method-overload-in-base-class.js new file mode 100644 index 0000000..ec0522e --- /dev/null +++ b/tests/generics/generic-method-overload-in-base-class.js @@ -0,0 +1,16 @@ +/* +Bar +*/ +import UnityScript.Tests.CSharp; + +class Bar { +} + +function run() { + var f = GetComponentsInChildren.(); + print(f); +} + +run(); + + From a1713e49b3419f8abf7ba0c63ec3dba9c4baaf60 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 28 Feb 2011 14:02:46 -0300 Subject: [PATCH 155/276] test case for overloaded generic base class method --- .../GenericsTestFixture.Generated.boo | 4 ++++ src/UnityScript.Tests/MonoBehaviour.boo | 6 +++++- .../generic-method-overload-in-base-class.js | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) mode change 100755 => 100644 src/UnityScript.Tests/MonoBehaviour.boo create mode 100644 tests/generics/generic-method-overload-in-base-class.js diff --git a/src/UnityScript.Tests/GenericsTestFixture.Generated.boo b/src/UnityScript.Tests/GenericsTestFixture.Generated.boo index 0c6b19c..c476bc6 100644 --- a/src/UnityScript.Tests/GenericsTestFixture.Generated.boo +++ b/src/UnityScript.Tests/GenericsTestFixture.Generated.boo @@ -21,4 +21,8 @@ class GenericsTestFixture(AbstractIntegrationTestFixture): [Test] def generic_method_arguments(): RunTestCase("tests/generics/generic-method-arguments.js") + + + [Test] def generic_method_overload_in_base_class(): + RunTestCase("tests/generics/generic-method-overload-in-base-class.js") \ No newline at end of file diff --git a/src/UnityScript.Tests/MonoBehaviour.boo b/src/UnityScript.Tests/MonoBehaviour.boo old mode 100755 new mode 100644 index e814bd3..842f17f --- a/src/UnityScript.Tests/MonoBehaviour.boo +++ b/src/UnityScript.Tests/MonoBehaviour.boo @@ -14,7 +14,11 @@ struct Vector3: z = z_ class Component: - pass + def GetComponentsInChildren[of T]() as T: + return typeof(T)() + + def GetComponentsInChildren[of T](instantiate as bool) as T: + if instantiate: return typeof(T)() struct Bounds: def IntersectRay(ray as Ray, ref result as single): diff --git a/tests/generics/generic-method-overload-in-base-class.js b/tests/generics/generic-method-overload-in-base-class.js new file mode 100644 index 0000000..ec0522e --- /dev/null +++ b/tests/generics/generic-method-overload-in-base-class.js @@ -0,0 +1,16 @@ +/* +Bar +*/ +import UnityScript.Tests.CSharp; + +class Bar { +} + +function run() { + var f = GetComponentsInChildren.(); + print(f); +} + +run(); + + From a761058884b9d76eb2ac17f467526c5655eb32c3 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 28 Mar 2011 09:43:05 -0300 Subject: [PATCH 156/276] fix do-while condition evaluation --- .../DuckyIntegrationTestFixture.boo | 4 ++ .../ParserTestFixture.Generated.boo | 4 ++ .../StrictIntegrationTestFixture.boo | 4 ++ src/UnityScript/Parser/UnityScriptParser.boo | 2 +- src/UnityScript/UnityScript.g | 2 +- tests/integration/do-while.js | 37 +++++++++++++++++++ tests/parser/do-while-1.js | 2 +- tests/parser/do-while-false.js | 6 +++ 8 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 tests/integration/do-while.js create mode 100644 tests/parser/do-while-false.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index df6382e..c83f017 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -282,6 +282,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/crash.js") + [Test] def do_while(): + RunTestCase("tests/integration/do-while.js") + + [Test] def double_precision_can_be_used_for_literals(): RunTestCase("tests/integration/double-precision-can-be-used-for-literals.js") diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index 7f847f3..e125c22 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -42,6 +42,10 @@ partial class ParserTestFixture: RunTestCase("tests/parser/do-while-1.js") + [Test] def do_while_false(): + RunTestCase("tests/parser/do-while-false.js") + + [Test] def enums(): RunTestCase("tests/parser/enums.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index bc41ee0..1865a2b 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -284,6 +284,10 @@ class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/crash.js") + [Test] def do_while(): + RunTestCase("tests/integration/do-while.js") + + [Test] def double_precision_can_be_used_for_literals(): RunTestCase("tests/integration/double-precision-can-be-used-for-literals.js") diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index a5a4860..9b64ea7 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -1895,7 +1895,7 @@ class UnityScriptParser(antlr.LLkParser): e=paren_expression() eos() if 0 == inputState.guessing: - b.Add(BreakStatement(ToLexicalInfo(w), Modifier: StatementModifier(StatementModifierType.If, e))) + b.Add(BreakStatement(ToLexicalInfo(w), Modifier: StatementModifier(StatementModifierType.Unless, e))) LeaveLoop(ws) except ex as RecognitionException: if (0 == inputState.guessing): diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 64d3998..cd6d6bb 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -900,7 +900,7 @@ do_while_statement[Block container] block[b] w:WHILE e=paren_expression eos { - b.Add(BreakStatement(ToLexicalInfo(w), Modifier: StatementModifier(StatementModifierType.If, e))) + b.Add(BreakStatement(ToLexicalInfo(w), Modifier: StatementModifier(StatementModifierType.Unless, e))) LeaveLoop(ws) } ; diff --git a/tests/integration/do-while.js b/tests/integration/do-while.js new file mode 100644 index 0000000..a81d899 --- /dev/null +++ b/tests/integration/do-while.js @@ -0,0 +1,37 @@ +/* +0 +1 +10 +11 +100 +100, 0 +100, 1 +*** +101 +101, 0 +101, 1 +*** +*/ +var i = 0; +do { + print(i); +} while (++i < 2); + +i = 10; +do { + print(i); + if (++i >= 12) break; +} while (true); + +i = 100; +do { + print(i); + var j = 0; + do { + print(i + ", " + j); + if (++j >= 2) break; + } while (true); + print("***"); +} while (++i < 102); + + diff --git a/tests/parser/do-while-1.js b/tests/parser/do-while-1.js index ef4a34e..95cb05f 100644 --- a/tests/parser/do-while-1.js +++ b/tests/parser/do-while-1.js @@ -3,7 +3,7 @@ i = 0 while true: print(i) - break if ((++i) < 2) + break unless ((++i) < 2) */ var i = 0; do { diff --git a/tests/parser/do-while-false.js b/tests/parser/do-while-false.js new file mode 100644 index 0000000..cf19167 --- /dev/null +++ b/tests/parser/do-while-false.js @@ -0,0 +1,6 @@ +/* +while true: + break unless false +*/ +do { +} while (false); From 8aad9ecc7aac610b5803c27c701b37b95e916273 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 28 Mar 2011 11:38:11 -0300 Subject: [PATCH 157/276] test case for generic dictionary of string to anonymous function type --- .../GenericsTestFixture.Generated.boo | 4 ++++ .../generic-dictionary-of-string-to-function.js | 13 +++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 tests/generics/generic-dictionary-of-string-to-function.js diff --git a/src/UnityScript.Tests/GenericsTestFixture.Generated.boo b/src/UnityScript.Tests/GenericsTestFixture.Generated.boo index c476bc6..24b9b58 100644 --- a/src/UnityScript.Tests/GenericsTestFixture.Generated.boo +++ b/src/UnityScript.Tests/GenericsTestFixture.Generated.boo @@ -7,6 +7,10 @@ import NUnit.Framework class GenericsTestFixture(AbstractIntegrationTestFixture): + [Test] def generic_dictionary_of_string_to_function(): + RunTestCase("tests/generics/generic-dictionary-of-string-to-function.js") + + [Test] def generic_list_instantiation_1(): RunTestCase("tests/generics/generic-list-instantiation-1.js") diff --git a/tests/generics/generic-dictionary-of-string-to-function.js b/tests/generics/generic-dictionary-of-string-to-function.js new file mode 100644 index 0000000..8fb36b1 --- /dev/null +++ b/tests/generics/generic-dictionary-of-string-to-function.js @@ -0,0 +1,13 @@ +/* +foo +bar +*/ +import System.Collections.Generic; + +var dict : Dictionary.; +dict = new Dictionary.(); +dict["foo"] = function() print("foo"); +dict["bar"] = function() print("bar"); + +dict["foo"](); +dict["bar"](); From 99e6525e13fa66ce2d0b2edd0c460705b173ed82 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 28 Mar 2011 11:38:45 -0300 Subject: [PATCH 158/276] don't compile in -verbose mode --- run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run b/run index e0c9ee5..c2251b7 100755 --- a/run +++ b/run @@ -1,2 +1,2 @@ #!/bin/sh -mono --debug bin/us.exe -x -verbose -t:library -r:bin/UnityScript.Tests.CSharp.dll -r:bin/UnityScript.Tests.dll -b:UnityScript.Tests.MonoBehaviour -m:Awake "$@" +mono --debug bin/us.exe -x -t:library -r:bin/UnityScript.Tests.CSharp.dll -r:bin/UnityScript.Tests.dll -b:UnityScript.Tests.MonoBehaviour -m:Awake "$@" From 22114f4d5b42fdfc94d226e22af239642bcb7cef Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 8 Jun 2011 09:54:17 -0300 Subject: [PATCH 159/276] fix Array.slice taking a single argument to return all the elements starting from that index; also includes supports for negative indexes (counting down from the end of the array); closes case #401518 --- src/UnityScript.Lang/Array.boo | 6 ++++-- src/UnityScript.Tests/Lang/ArrayTest.boo | 20 +++++++++++++++++++ .../UnityScript.Tests.booproj | 2 ++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 src/UnityScript.Tests/Lang/ArrayTest.boo diff --git a/src/UnityScript.Lang/Array.boo b/src/UnityScript.Lang/Array.boo index a27bd7f..7307f7c 100755 --- a/src/UnityScript.Lang/Array.boo +++ b/src/UnityScript.Lang/Array.boo @@ -119,10 +119,12 @@ class Array(CollectionBase, Boo.Lang.Runtime.ICoercible): # Returns array with elements removed def Slice(start as int, end as int): - return Array(InnerList.GetRange(start, end - start)); + normalStart = NormalizeIndex(start) + normalEnd = NormalizeIndex(end) + return Array(InnerList.GetRange(normalStart, normalEnd - normalStart)) def Slice(start as int): - return self.Slice(start, self.InnerList.Count - start); + return self.Slice(start, self.InnerList.Count) def slice(start as int, end as int): return self.Slice(start, end) diff --git a/src/UnityScript.Tests/Lang/ArrayTest.boo b/src/UnityScript.Tests/Lang/ArrayTest.boo new file mode 100644 index 0000000..70b9e26 --- /dev/null +++ b/src/UnityScript.Tests/Lang/ArrayTest.boo @@ -0,0 +1,20 @@ +namespace UnityScript.Tests.Lang + +import NUnit.Framework + +[TestFixture] +class ArrayTest: + + [Test] + def Slice(): + fruits = UnityScript.Lang.Array() { "Banana", "Orange", "Apple", "Mango" } + Assert.AreEqual("Banana", fruits.slice(0, 1).ToString()) + Assert.AreEqual("Orange,Apple,Mango", fruits.slice(1).ToString()) + Assert.AreEqual("Apple,Mango", fruits.slice(-2).ToString()) + Assert.AreEqual("Banana,Orange,Apple,Mango", fruits.ToString()) + + + + + + diff --git a/src/UnityScript.Tests/UnityScript.Tests.booproj b/src/UnityScript.Tests/UnityScript.Tests.booproj index a265605..e63aa34 100755 --- a/src/UnityScript.Tests/UnityScript.Tests.booproj +++ b/src/UnityScript.Tests/UnityScript.Tests.booproj @@ -76,6 +76,7 @@ + @@ -98,5 +99,6 @@ + \ No newline at end of file From e8f9494e38e5632e2e4793bf16c8662dabf72849 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 8 Jun 2011 09:54:34 -0300 Subject: [PATCH 160/276] remove unnecessary semicolons --- src/UnityScript.Lang/Array.boo | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/UnityScript.Lang/Array.boo b/src/UnityScript.Lang/Array.boo index 7307f7c..baa6f01 100755 --- a/src/UnityScript.Lang/Array.boo +++ b/src/UnityScript.Lang/Array.boo @@ -84,11 +84,11 @@ class Array(CollectionBase, Boo.Lang.Runtime.ICoercible): # How do i allow the vararg only for ICollections? def Concat(value as ICollection, *items): - return ConcatImpl(value, items); - + return ConcatImpl(value, items) + # How do i allow the vararg only for ICollections? def concat(value as ICollection, *items): - return ConcatImpl(value, items); + return ConcatImpl(value, items) # Pop last and return def Pop(): @@ -134,7 +134,7 @@ class Array(CollectionBase, Boo.Lang.Runtime.ICoercible): # Revert def Reverse() as Array: - self.InnerList.Reverse(); + self.InnerList.Reverse() return self def reverse() as Array: @@ -211,8 +211,8 @@ class Array(CollectionBase, Boo.Lang.Runtime.ICoercible): self.InnerList.InsertRange(index, items) private def ConcatImpl(value as ICollection, [required] items as IEnumerable): - arr = Array (self.InnerList); - arr.InnerList.AddRange(value); + arr = Array (self.InnerList) + arr.InnerList.AddRange(value) for item as ICollection in items: arr.InnerList.AddRange(item) @@ -223,3 +223,7 @@ class Array(CollectionBase, Boo.Lang.Runtime.ICoercible): return if capacity < Count for i in range(capacity-self.Count): InnerList.Add(null) + + private def NormalizeIndex(index as int): + return index if index >= 0 + return index + InnerList.Count From 214e4cb22dc7f751f133eee1ce7e6abaf54bce36 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 8 Jun 2011 10:08:20 -0300 Subject: [PATCH 161/276] accept characters in #pragma lines; closes case #402701 --- .../ParserTestFixture.Generated.boo | 4 + src/UnityScript/Parser/UnityScriptLexer.boo | 123 ++++++++++-------- src/UnityScript/Parser/UnityScriptParser.boo | 24 ++-- .../Parser/UnityScriptTokenTypes.boo | 23 ++-- .../Parser/UnityScriptTokenTypes.txt | 23 ++-- src/UnityScript/UnityScript.g | 9 +- tests/parser/pragma-strict-followed-by-tab.js | 6 + 7 files changed, 122 insertions(+), 90 deletions(-) create mode 100644 tests/parser/pragma-strict-followed-by-tab.js diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index 7f847f3..2e7ddf5 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -222,6 +222,10 @@ partial class ParserTestFixture: RunTestCase("tests/parser/pragma-strict-followed-by-identifier.js") + [Test] def pragma_strict_followed_by_tab(): + RunTestCase("tests/parser/pragma-strict-followed-by-tab.js") + + [Test] def scientific_notation(): RunTestCase("tests/parser/scientific-notation.js") diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index f8acaf8..e0f90f1 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -137,17 +137,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): public static final SINGLE_QUOTED_STRING = 106 public static final DOUBLE_SUFFIX = 107 public static final EXPONENT = 108 - public static final WHITE_SPACE = 109 - public static final DQS_ESC = 110 - public static final SQS_ESC = 111 - public static final SESC = 112 - public static final ML_COMMENT = 113 - public static final RE_CHAR = 114 - public static final RE_ESC = 115 - public static final NEWLINE = 116 - public static final ID_LETTER = 117 - public static final DIGIT = 118 - public static final HEXDIGIT = 119 + public static final PRAGMA_WHITE_SPACE = 109 + public static final WHITE_SPACE = 110 + public static final DQS_ESC = 111 + public static final SQS_ESC = 112 + public static final SESC = 113 + public static final ML_COMMENT = 114 + public static final RE_CHAR = 115 + public static final RE_ESC = 116 + public static final NEWLINE = 117 + public static final ID_LETTER = 118 + public static final DIGIT = 119 + public static final HEXDIGIT = 120 static def IsDigit(ch as char): @@ -1126,10 +1127,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): text.Length = _saveIndex _cnt363 as int = 0 while true: - if ((cached_LA1==char(' '))): - _saveIndex = text.Length - match(' ') - text.Length = _saveIndex + if ((cached_LA1==char('\t') or cached_LA1==char(' '))): + mPRAGMA_WHITE_SPACE(false) else: if (_cnt363 >= 1): goto _loop363_breakloop @@ -1139,13 +1138,11 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): :_loop363_breakloop mID(true) id = returnToken_ - if ((cached_LA1==char(' ')) and (cached_LA2==char(' ') or cached_LA2==char('o')) and (LA(3)==char(' ') or LA(3)==char('f') or LA(3)==char('n') or LA(3)==char('o'))): + if ((cached_LA1==char('\t') or cached_LA1==char(' ')) and (cached_LA2==char('\t') or cached_LA2==char(' ') or cached_LA2==char('o')) and (LA(3)==char('\t') or LA(3)==char(' ') or LA(3)==char('f') or LA(3)==char('n') or LA(3)==char('o'))): _cnt366 as int = 0 while true: - if ((cached_LA1==char(' '))): - _saveIndex = text.Length - match(' ') - text.Length = _saveIndex + if ((cached_LA1==char('\t') or cached_LA1==char(' '))): + mPRAGMA_WHITE_SPACE(false) else: if (_cnt366 >= 1): goto _loop366_breakloop @@ -1165,15 +1162,13 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): text.Length = _saveIndex else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - elif ((cached_LA1==char('\n') or cached_LA1==char('\r') or cached_LA1==char(' ')) and (true) and (true)): // line 2102 + elif ((cached_LA1==char('\t') or cached_LA1==char('\n') or cached_LA1==char('\r') or cached_LA1==char(' ')) and (true) and (true)): // line 2102 pass // 947 else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) while true: - if ((cached_LA1==char(' '))): - _saveIndex = text.Length - match(' ') - text.Length = _saveIndex + if ((cached_LA1==char('\t') or cached_LA1==char(' '))): + mPRAGMA_WHITE_SPACE(false) else: goto _loop369_breakloop :_loop369_breakloop @@ -1185,6 +1180,26 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _token.setText(text.ToString(_begin, text.Length-_begin)) returnToken_ = _token + protected def mPRAGMA_WHITE_SPACE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = PRAGMA_WHITE_SPACE + + _givenValue = cached_LA1 + if ((_givenValue == char(' '))): // 1831 + _saveIndex = text.Length + match(' ') + text.Length = _saveIndex + elif ((_givenValue == char('\t'))): // 1831 + _saveIndex = text.Length + match('\t') + text.Length = _saveIndex + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + protected def mNEWLINE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException _ttype as int; _token as IToken; _begin = text.Length; _ttype = NEWLINE @@ -1431,18 +1446,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched394 as bool = false + synPredMatched396 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m394 as int = mark() - synPredMatched394 = true + _m396 as int = mark() + synPredMatched396 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched394 = false - rewind(_m394) + synPredMatched396 = false + rewind(_m396) --inputState.guessing - if synPredMatched394: + if synPredMatched396: mML_COMMENT(false) if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1455,8 +1470,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop399_breakloop - :_loop399_breakloop + goto _loop401_breakloop + :_loop401_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; elif ((_givenValue == char('='))): // 1831 @@ -1485,8 +1500,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop428_breakloop - :_loop428_breakloop + goto _loop430_breakloop + :_loop430_breakloop match("*/") if 0 == inputState.guessing: _ttype = Token.SKIP; @@ -1499,7 +1514,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt403 as int = 0 + _cnt405 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1513,12 +1528,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt403 >= 1): - goto _loop403_breakloop + if (_cnt405 >= 1): + goto _loop405_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt403 - :_loop403_breakloop + ++_cnt405 + :_loop405_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1539,8 +1554,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop407_breakloop - :_loop407_breakloop + goto _loop409_breakloop + :_loop409_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1589,8 +1604,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_4_) else: - goto _loop411_breakloop - :_loop411_breakloop + goto _loop413_breakloop + :_loop413_breakloop _saveIndex = text.Length match('\'') text.Length = _saveIndex @@ -1691,17 +1706,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt431 as int = 0 + _cnt433 as int = 0 while true: if ((tokenSet_5_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt431 >= 1): - goto _loop431_breakloop + if (_cnt433 >= 1): + goto _loop433_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt431 - :_loop431_breakloop + ++_cnt433 + :_loop433_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1759,17 +1774,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt437 as int = 0 + _cnt439 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt437 >= 1): - goto _loop437_breakloop + if (_cnt439 >= 1): + goto _loop439_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt437 - :_loop437_breakloop + ++_cnt439 + :_loop439_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index a5a4860..875458b 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -135,17 +135,18 @@ class UnityScriptParser(antlr.LLkParser): public static final SINGLE_QUOTED_STRING = 106 public static final DOUBLE_SUFFIX = 107 public static final EXPONENT = 108 - public static final WHITE_SPACE = 109 - public static final DQS_ESC = 110 - public static final SQS_ESC = 111 - public static final SESC = 112 - public static final ML_COMMENT = 113 - public static final RE_CHAR = 114 - public static final RE_ESC = 115 - public static final NEWLINE = 116 - public static final ID_LETTER = 117 - public static final DIGIT = 118 - public static final HEXDIGIT = 119 + public static final PRAGMA_WHITE_SPACE = 109 + public static final WHITE_SPACE = 110 + public static final DQS_ESC = 111 + public static final SQS_ESC = 112 + public static final SESC = 113 + public static final ML_COMMENT = 114 + public static final RE_CHAR = 115 + public static final RE_ESC = 116 + public static final NEWLINE = 117 + public static final ID_LETTER = 118 + public static final DIGIT = 119 + public static final HEXDIGIT = 120 [property(CompilerContext)] @@ -4482,6 +4483,7 @@ class UnityScriptParser(antlr.LLkParser): 'SINGLE_QUOTED_STRING', 'DOUBLE_SUFFIX', 'EXPONENT', + 'PRAGMA_WHITE_SPACE', 'WHITE_SPACE', 'DQS_ESC', 'SQS_ESC', diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.boo b/src/UnityScript/Parser/UnityScriptTokenTypes.boo index 3393d48..7a2cf28 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.boo +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.boo @@ -109,15 +109,16 @@ class UnityScriptTokenTypes: public static final SINGLE_QUOTED_STRING = 106 public static final DOUBLE_SUFFIX = 107 public static final EXPONENT = 108 - public static final WHITE_SPACE = 109 - public static final DQS_ESC = 110 - public static final SQS_ESC = 111 - public static final SESC = 112 - public static final ML_COMMENT = 113 - public static final RE_CHAR = 114 - public static final RE_ESC = 115 - public static final NEWLINE = 116 - public static final ID_LETTER = 117 - public static final DIGIT = 118 - public static final HEXDIGIT = 119 + public static final PRAGMA_WHITE_SPACE = 109 + public static final WHITE_SPACE = 110 + public static final DQS_ESC = 111 + public static final SQS_ESC = 112 + public static final SESC = 113 + public static final ML_COMMENT = 114 + public static final RE_CHAR = 115 + public static final RE_ESC = 116 + public static final NEWLINE = 117 + public static final ID_LETTER = 118 + public static final DIGIT = 119 + public static final HEXDIGIT = 120 diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.txt b/src/UnityScript/Parser/UnityScriptTokenTypes.txt index 4d08f75..9a5bdd2 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.txt +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.txt @@ -105,14 +105,15 @@ LONG=105 SINGLE_QUOTED_STRING=106 DOUBLE_SUFFIX=107 EXPONENT=108 -WHITE_SPACE=109 -DQS_ESC=110 -SQS_ESC=111 -SESC=112 -ML_COMMENT=113 -RE_CHAR=114 -RE_ESC=115 -NEWLINE=116 -ID_LETTER=117 -DIGIT=118 -HEXDIGIT=119 +PRAGMA_WHITE_SPACE=109 +WHITE_SPACE=110 +DQS_ESC=111 +SQS_ESC=112 +SESC=113 +ML_COMMENT=114 +RE_CHAR=115 +RE_ESC=116 +NEWLINE=117 +ID_LETTER=118 +DIGIT=119 +HEXDIGIT=120 diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 64d3998..0f25f70 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -1836,11 +1836,14 @@ DECREMENT: "--"; ADD: '+'; PRAGMA_ON: - "#pragma"! (' '!)+ id:ID - ((' '!)+ ("off"! { $setType(PRAGMA_OFF); } | "on"!))? - (' '!)* + "#pragma"! (PRAGMA_WHITE_SPACE)+ id:ID + ((PRAGMA_WHITE_SPACE)+ ("off"! { $setType(PRAGMA_OFF); } | "on"!))? + (PRAGMA_WHITE_SPACE)* NEWLINE!; +protected +PRAGMA_WHITE_SPACE: (' '! | '\t'!); + INPLACE_ADD: "+="; SUBTRACT: '-'; diff --git a/tests/parser/pragma-strict-followed-by-tab.js b/tests/parser/pragma-strict-followed-by-tab.js new file mode 100644 index 0000000..96e4d93 --- /dev/null +++ b/tests/parser/pragma-strict-followed-by-tab.js @@ -0,0 +1,6 @@ +/* +print(Math.add(1, 1)) +*/ +#pragma strict + +print(Math.add(1, 1)); From 02465ea2f95004f64c1835488036e0b19fc6ac58 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 15 Jun 2011 15:29:41 -0300 Subject: [PATCH 162/276] move test cases that cant possibly work in strict mode to tests/ducky --- tests/{integration => ducky}/array-cast-2.js | 0 tests/{integration => ducky}/array-cast-3.js | 0 tests/{integration => ducky}/array-cast-4.js | 0 tests/{integration => ducky}/array-cast-5.js | 0 tests/{integration => ducky}/array-polymorphic-foreach.js | 0 tests/{integration => ducky}/virtual-test.js | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename tests/{integration => ducky}/array-cast-2.js (100%) rename tests/{integration => ducky}/array-cast-3.js (100%) rename tests/{integration => ducky}/array-cast-4.js (100%) rename tests/{integration => ducky}/array-cast-5.js (100%) rename tests/{integration => ducky}/array-polymorphic-foreach.js (100%) rename tests/{integration => ducky}/virtual-test.js (100%) diff --git a/tests/integration/array-cast-2.js b/tests/ducky/array-cast-2.js similarity index 100% rename from tests/integration/array-cast-2.js rename to tests/ducky/array-cast-2.js diff --git a/tests/integration/array-cast-3.js b/tests/ducky/array-cast-3.js similarity index 100% rename from tests/integration/array-cast-3.js rename to tests/ducky/array-cast-3.js diff --git a/tests/integration/array-cast-4.js b/tests/ducky/array-cast-4.js similarity index 100% rename from tests/integration/array-cast-4.js rename to tests/ducky/array-cast-4.js diff --git a/tests/integration/array-cast-5.js b/tests/ducky/array-cast-5.js similarity index 100% rename from tests/integration/array-cast-5.js rename to tests/ducky/array-cast-5.js diff --git a/tests/integration/array-polymorphic-foreach.js b/tests/ducky/array-polymorphic-foreach.js similarity index 100% rename from tests/integration/array-polymorphic-foreach.js rename to tests/ducky/array-polymorphic-foreach.js diff --git a/tests/integration/virtual-test.js b/tests/ducky/virtual-test.js similarity index 100% rename from tests/integration/virtual-test.js rename to tests/ducky/virtual-test.js From 92d3e9c2c29c69bfe7ab26e5bde5aea97752a48f Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 15 Jun 2011 15:31:43 -0300 Subject: [PATCH 163/276] fix execution of tests in strict mode which can only be enabled on a per module basis with UnityScript.Steps.IntroducePragmas --- refresh-tests.boo | 11 +- ...StrictIntegrationTestFixture.Generated.boo | 589 +++++++++++++++++ .../StrictIntegrationTestFixture.boo | 612 +----------------- .../UnityScript.Tests.booproj | 1 + src/UnityScript/Steps/IntroducePragmas.boo | 4 +- 5 files changed, 599 insertions(+), 618 deletions(-) create mode 100644 src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo diff --git a/refresh-tests.boo b/refresh-tests.boo index 64b0451..898e8b3 100755 --- a/refresh-tests.boo +++ b/refresh-tests.boo @@ -10,9 +10,6 @@ import System import System.IO import Boo.Lang.PatternMatching -//def MapPath(path): -// return Path.Combine(Project.BaseDirectory, path) - def GetTestCaseName(fname as string): return Path.GetFileNameWithoutExtension(fname).Replace("-", "_").Replace(".", "_") @@ -104,17 +101,13 @@ import NUnit.Framework class SemanticsTestFixture(AbstractSemanticsTestFixture): """, "tests/semantics") -GenerateTestFixture("src/UnityScript.Tests/StrictIntegrationTestFixture.boo", """ +GenerateTestFixture("src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo", """ namespace UnityScript.Tests import NUnit.Framework [TestFixture] -class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): - - override def SetCompilationOptions(): - super() - Parameters.Strict = true +partial class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): """, "tests/integration") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo new file mode 100644 index 0000000..441d236 --- /dev/null +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo @@ -0,0 +1,589 @@ + +namespace UnityScript.Tests + +import NUnit.Framework + +[TestFixture] +partial class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): + + + + [Test] def JSCheckFloatToIntOverflow(): + RunTestCase("tests/integration/JSCheckFloatToIntOverflow.js") + + + [Test] def JSChooseOverload(): + RunTestCase("tests/integration/JSChooseOverload.js") + + + [Test] def accessor_2(): + RunTestCase("tests/integration/accessor-2.js") + + + [Test] def accessor_3_duck(): + RunTestCase("tests/integration/accessor-3-duck.js") + + + [Test] def accessor(): + RunTestCase("tests/integration/accessor.js") + + + [Test] def anonymous_function_type_1(): + RunTestCase("tests/integration/anonymous-function-type-1.js") + + + [Test] def anonymous_function_type_2(): + RunTestCase("tests/integration/anonymous-function-type-2.js") + + + [Test] def anonymous_function_type_3(): + RunTestCase("tests/integration/anonymous-function-type-3.js") + + + [Test] def array_Add(): + RunTestCase("tests/integration/array-Add.js") + + + [Test] def array_Remove(): + RunTestCase("tests/integration/array-Remove.js") + + + [Test] def array_cast(): + RunTestCase("tests/integration/array-cast.js") + + + [Test] def array_comprehension_1(): + RunTestCase("tests/integration/array-comprehension-1.js") + + + [Test] def array_concat_1(): + RunTestCase("tests/integration/array-concat-1.js") + + + [Test] def array_concat_2(): + RunTestCase("tests/integration/array-concat-2.js") + + + [Test] def array_create(): + RunTestCase("tests/integration/array-create.js") + + + [Test] def array_ctor_with_single_null_element(): + RunTestCase("tests/integration/array-ctor-with-single-null-element.js") + + + [Test] def array_implicit_from_null_enumerable(): + RunTestCase("tests/integration/array-implicit-from-null-enumerable.js") + + + [Test] def array_implicit_from_null(): + RunTestCase("tests/integration/array-implicit-from-null.js") + + + [Test] def array_initializer_in_static_field(): + RunTestCase("tests/integration/array-initializer-in-static-field.js") + + + [Test] def array_instantiation_with_object_argument_in_strict_mode(): + RunTestCase("tests/integration/array-instantiation-with-object-argument-in-strict-mode.js") + + + [Test] def array_instantiation_with_object_argument(): + RunTestCase("tests/integration/array-instantiation-with-object-argument.js") + + + [Test] def array_iteration_with_nulls(): + RunTestCase("tests/integration/array-iteration-with-nulls.js") + + + [Test] def array_join(): + RunTestCase("tests/integration/array-join.js") + + + [Test] def array_length_duck_typed(): + RunTestCase("tests/integration/array-length-duck-typed.js") + + + [Test] def array_nesting(): + RunTestCase("tests/integration/array-nesting.js") + + + [Test] def array_pop(): + RunTestCase("tests/integration/array-pop.js") + + + [Test] def array_push_2(): + RunTestCase("tests/integration/array-push-2.js") + + + [Test] def array_push(): + RunTestCase("tests/integration/array-push.js") + + + [Test] def array_shift(): + RunTestCase("tests/integration/array-shift.js") + + + [Test] def array_slice(): + RunTestCase("tests/integration/array-slice.js") + + + [Test] def array_sort(): + RunTestCase("tests/integration/array-sort.js") + + + [Test] def array_splice_2(): + RunTestCase("tests/integration/array-splice-2.js") + + + [Test] def array_splice(): + RunTestCase("tests/integration/array-splice.js") + + + [Test] def array_str(): + RunTestCase("tests/integration/array-str.js") + + + [Test] def array_toString(): + RunTestCase("tests/integration/array-toString.js") + + + [Test] def array_unshift(): + RunTestCase("tests/integration/array-unshift.js") + + + [Test] def array_with_initial_length(): + RunTestCase("tests/integration/array-with-initial-length.js") + + + [Test] def array_with_two_dimensions(): + RunTestCase("tests/integration/array-with-two-dimensions.js") + + + [Test] def arrays_2(): + RunTestCase("tests/integration/arrays-2.js") + + + [Test] def arrays_3(): + RunTestCase("tests/integration/arrays-3.js") + + + [Test] def arrays_4(): + RunTestCase("tests/integration/arrays-4.js") + + + [Test] def arrays_6(): + RunTestCase("tests/integration/arrays-6.js") + + + [Test] def arrays(): + RunTestCase("tests/integration/arrays.js") + + + [Test] def assign_iterator(): + RunTestCase("tests/integration/assign_iterator.js") + + + [Test] def attributes_2(): + RunTestCase("tests/integration/attributes-2.js") + + + [Test] def attributes(): + RunTestCase("tests/integration/attributes.js") + + + [Test] def auto_coroutine_2(): + RunTestCase("tests/integration/auto-coroutine-2.js") + + + [Test] def auto_coroutine_return_2(): + RunTestCase("tests/integration/auto-coroutine-return-2.js") + + + [Test] def cast_operator_1(): + RunTestCase("tests/integration/cast-operator-1.js") + + + [Test] def cast_operator_precedence(): + RunTestCase("tests/integration/cast-operator-precedence.js") + + + [Test] def chars(): + RunTestCase("tests/integration/chars.js") + + + [Test] def comma_parsing(): + RunTestCase("tests/integration/comma-parsing.js") + + + [Test] def constructor_1(): + RunTestCase("tests/integration/constructor-1.js") + + + [Test] def constructor_2(): + RunTestCase("tests/integration/constructor_2.js") + + + [Test] def continue_issue(): + RunTestCase("tests/integration/continue-issue.js") + + + [Test] def coroutine_2(): + RunTestCase("tests/integration/coroutine-2.js") + + + [Test] def coroutine_3(): + RunTestCase("tests/integration/coroutine-3.js") + + + [Test] def coroutine_4(): + RunTestCase("tests/integration/coroutine-4.js") + + + [Test] def coroutine_5(): + RunTestCase("tests/integration/coroutine-5.js") + + + [Test] def coroutine_return_type_1(): + RunTestCase("tests/integration/coroutine-return-type-1.js") + + + [Test] def coroutine_try_catch(): + RunTestCase("tests/integration/coroutine-try-catch.js") + + + [Test] def coroutine(): + RunTestCase("tests/integration/coroutine.js") + + + [Test] def crash(): + RunTestCase("tests/integration/crash.js") + + + [Test] def do_while(): + RunTestCase("tests/integration/do-while.js") + + + [Test] def double_precision_can_be_used_for_literals(): + RunTestCase("tests/integration/double-precision-can-be-used-for-literals.js") + + + [Test] def empty_array_literal_as_return_value(): + RunTestCase("tests/integration/empty-array-literal-as-return-value.js") + + + [Test] def empty_array_literal_as_yield_value(): + RunTestCase("tests/integration/empty-array-literal-as-yield-value.js") + + + [Test] def empty_string_array(): + RunTestCase("tests/integration/empty-string-array.js") + + + [Test] def enum_1(): + RunTestCase("tests/integration/enum-1.js") + + + [Test] def enum_2(): + RunTestCase("tests/integration/enum-2.js") + + + [Test] def enum_3(): + RunTestCase("tests/integration/enum-3.js") + + + [Test] def enum_4(): + RunTestCase("tests/integration/enum-4.js") + + + [Test] def enum_5(): + RunTestCase("tests/integration/enum-5.js") + + + [Test] def enum_conversion(): + RunTestCase("tests/integration/enum-conversion.js") + + + [Test] def enumerator_array(): + RunTestCase("tests/integration/enumerator-array.js") + + + [Test] def explicit_awake_function(): + RunTestCase("tests/integration/explicit-awake-function.js") + + + [Test] def float_1(): + RunTestCase("tests/integration/float-1.js") + + + [Test] def float_2(): + RunTestCase("tests/integration/float-2.js") + + + [Test] def float_array_literal(): + RunTestCase("tests/integration/float-array-literal.js") + + + [Test] def float_overload_is_preferred_over_int_for_double_argument_2(): + RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument-2.js") + + + [Test] def float_overload_is_preferred_over_int_for_double_argument_strict_downcast(): + RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument-strict-downcast.js") + + + [Test] def float_overload_is_preferred_over_int_for_double_argument_strict(): + RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument-strict.js") + + + [Test] def float_overload_is_preferred_over_int_for_double_argument(): + RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument.js") + + + [Test] def for_break_1(): + RunTestCase("tests/integration/for-break-1.js") + + + [Test] def for_continue_1(): + RunTestCase("tests/integration/for-continue-1.js") + + + [Test] def for_continue_2(): + RunTestCase("tests/integration/for-continue-2.js") + + + [Test] def for_over_null(): + RunTestCase("tests/integration/for-over-null.js") + + + [Test] def functions_1(): + RunTestCase("tests/integration/functions-1.js") + + + [Test] def generator_inheritance_calling_super(): + RunTestCase("tests/integration/generator-inheritance-calling-super.js") + + + [Test] def generator_inheritance_yielding_super(): + RunTestCase("tests/integration/generator-inheritance-yielding-super.js") + + + [Test] def generator_inheritance(): + RunTestCase("tests/integration/generator-inheritance.js") + + + [Test] def implicit_array_to_native_array_cast(): + RunTestCase("tests/integration/implicit-array-to-native-array-cast.js") + + + [Test] def implict_bool_hierarchy(): + RunTestCase("tests/integration/implict-bool-hierarchy.js") + + + [Test] def inferred_GetComponent(): + RunTestCase("tests/integration/inferred-GetComponent.js") + + + [Test] def initializeorder(): + RunTestCase("tests/integration/initializeorder.js") + + + [Test] def interfaces_1(): + RunTestCase("tests/integration/interfaces-1.js") + + + [Test] def invalidil(): + RunTestCase("tests/integration/invalidil.js") + + + [Test] def length_string(): + RunTestCase("tests/integration/length-string.js") + + + [Test] def linq_array_ToList(): + RunTestCase("tests/integration/linq-array-ToList.js") + + + [Test] def linq_function_inference(): + RunTestCase("tests/integration/linq-function-inference.js") + + + [Test] def linq_lambda_inference(): + RunTestCase("tests/integration/linq-lambda-inference.js") + + + [Test] def magicclass(): + RunTestCase("tests/integration/magicclass.js") + + + [Test] def magicconstructor(): + RunTestCase("tests/integration/magicconstructor.js") + + + [Test] def magicconstructor_2(): + RunTestCase("tests/integration/magicconstructor_2.js") + + + [Test] def multidimensional_arrays_1(): + RunTestCase("tests/integration/multidimensional-arrays-1.js") + + + [Test] def nested_class_1(): + RunTestCase("tests/integration/nested-class-1.js") + + + [Test] def nested_classes(): + RunTestCase("tests/integration/nested-classes.js") + + + [Test] def new_1(): + RunTestCase("tests/integration/new-1.js") + + + [Test] def null_initializer(): + RunTestCase("tests/integration/null-initializer.js") + + + [Test] def operators_4(): + RunTestCase("tests/integration/operators-4.js") + + + [Test] def operators_5(): + RunTestCase("tests/integration/operators-5.js") + + + [Test] def override_1(): + RunTestCase("tests/integration/override-1.js") + + + [Test] def param_test(): + RunTestCase("tests/integration/param_test.js") + + + [Test] def parse_int(): + RunTestCase("tests/integration/parse_int.js") + + + [Test] def private_duck(): + RunTestCase("tests/integration/private-duck.js") + + + [Test] def properties(): + RunTestCase("tests/integration/properties.js") + + + [Test] def quack_fu(): + RunTestCase("tests/integration/quack-fu.js") + + + [Test] def question_mark(): + RunTestCase("tests/integration/question_mark.js") + + + [Test] def raw_array_indexing(): + RunTestCase("tests/integration/raw-array-indexing.js") + + + [Test] def rethrow(): + RunTestCase("tests/integration/rethrow.js") + + + [Test] def script_attributes(): + RunTestCase("tests/integration/script-attributes.js") + + + [Test] def shift_left_bitwise_or(): + RunTestCase("tests/integration/shift-left-bitwise-or.js") + + + [Test] def static_instance_overload_resolution(): + RunTestCase("tests/integration/static-instance-overload-resolution.js") + + + [Test] def string_append(): + RunTestCase("tests/integration/string-append.js") + + + [Test] def string_concat(): + RunTestCase("tests/integration/string-concat.js") + + + [Test] def switch_3(): + RunTestCase("tests/integration/switch-3.js") + + + [Test] def switch_fallthrough(): + RunTestCase("tests/integration/switch-fallthrough.js") + + + [Test] def switch_simple_2(): + RunTestCase("tests/integration/switch-simple-2.js") + + + [Test] def switch_simple(): + RunTestCase("tests/integration/switch-simple.js") + + + [Test] def switch_with_loop(): + RunTestCase("tests/integration/switch-with-loop.js") + + + [Test] def switch(): + RunTestCase("tests/integration/switch.js") + + + [Test] def transform_collider_bounds(): + RunTestCase("tests/integration/transform-collider-bounds.js") + + + [Test] def typecast_1(): + RunTestCase("tests/integration/typecast-1.js") + + + [Test] def typeof_1(): + RunTestCase("tests/integration/typeof-1.js") + + + [Test] def typeof_2(): + RunTestCase("tests/integration/typeof-2.js") + + + [Test] def types_1(): + RunTestCase("tests/integration/types-1.js") + + + [Test] def uint_1(): + RunTestCase("tests/integration/uint-1.js") + + + [Test] def value_types_1(): + RunTestCase("tests/integration/value-types-1.js") + + + [Test] def valuetypes_1(): + RunTestCase("tests/integration/valuetypes-1.js") + + + [Test] def varargs_in_constructor_with_vector3(): + RunTestCase("tests/integration/varargs-in-constructor-with-vector3.js") + + + [Test] def varargs_with_vector3(): + RunTestCase("tests/integration/varargs-with-vector3.js") + + + [Test] def variable_declaration_2(): + RunTestCase("tests/integration/variable-declaration-2.js") + + + [Test] def variable_declaration(): + RunTestCase("tests/integration/variable-declaration.js") + + + [Test] def variables(): + RunTestCase("tests/integration/variables.js") + + + [Test] def vars_1(): + RunTestCase("tests/integration/vars-1.js") + \ No newline at end of file diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo index 1865a2b..cf0f860 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.boo @@ -3,611 +3,9 @@ namespace UnityScript.Tests import NUnit.Framework -[TestFixture] -class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): +partial class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): - override def SetCompilationOptions(): - super() - Parameters.Strict = true - - - - [Test] def JSCheckFloatToIntOverflow(): - RunTestCase("tests/integration/JSCheckFloatToIntOverflow.js") - - - [Test] def JSChooseOverload(): - RunTestCase("tests/integration/JSChooseOverload.js") - - - [Test] def accessor_2(): - RunTestCase("tests/integration/accessor-2.js") - - - [Test] def accessor_3_duck(): - RunTestCase("tests/integration/accessor-3-duck.js") - - - [Test] def accessor(): - RunTestCase("tests/integration/accessor.js") - - - [Test] def anonymous_function_type_1(): - RunTestCase("tests/integration/anonymous-function-type-1.js") - - - [Test] def anonymous_function_type_2(): - RunTestCase("tests/integration/anonymous-function-type-2.js") - - - [Test] def anonymous_function_type_3(): - RunTestCase("tests/integration/anonymous-function-type-3.js") - - - [Test] def array_Add(): - RunTestCase("tests/integration/array-Add.js") - - - [Test] def array_Remove(): - RunTestCase("tests/integration/array-Remove.js") - - - [Test] def array_cast_2(): - RunTestCase("tests/integration/array-cast-2.js") - - - [Test] def array_cast_3(): - RunTestCase("tests/integration/array-cast-3.js") - - - [Test] def array_cast_4(): - RunTestCase("tests/integration/array-cast-4.js") - - - [Test] def array_cast_5(): - RunTestCase("tests/integration/array-cast-5.js") - - - [Test] def array_cast(): - RunTestCase("tests/integration/array-cast.js") - - - [Test] def array_comprehension_1(): - RunTestCase("tests/integration/array-comprehension-1.js") - - - [Test] def array_concat_1(): - RunTestCase("tests/integration/array-concat-1.js") - - - [Test] def array_concat_2(): - RunTestCase("tests/integration/array-concat-2.js") - - - [Test] def array_create(): - RunTestCase("tests/integration/array-create.js") - - - [Test] def array_ctor_with_single_null_element(): - RunTestCase("tests/integration/array-ctor-with-single-null-element.js") - - - [Test] def array_implicit_from_null_enumerable(): - RunTestCase("tests/integration/array-implicit-from-null-enumerable.js") - - - [Test] def array_implicit_from_null(): - RunTestCase("tests/integration/array-implicit-from-null.js") - - - [Test] def array_initializer_in_static_field(): - RunTestCase("tests/integration/array-initializer-in-static-field.js") - - - [Test] def array_instantiation_with_object_argument_in_strict_mode(): - RunTestCase("tests/integration/array-instantiation-with-object-argument-in-strict-mode.js") - - - [Test] def array_instantiation_with_object_argument(): - RunTestCase("tests/integration/array-instantiation-with-object-argument.js") - - - [Test] def array_iteration_with_nulls(): - RunTestCase("tests/integration/array-iteration-with-nulls.js") - - - [Test] def array_join(): - RunTestCase("tests/integration/array-join.js") - - - [Test] def array_length_duck_typed(): - RunTestCase("tests/integration/array-length-duck-typed.js") - - - [Test] def array_nesting(): - RunTestCase("tests/integration/array-nesting.js") - - - [Test] def array_polymorphic_foreach(): - RunTestCase("tests/integration/array-polymorphic-foreach.js") - - - [Test] def array_pop(): - RunTestCase("tests/integration/array-pop.js") - - - [Test] def array_push_2(): - RunTestCase("tests/integration/array-push-2.js") - - - [Test] def array_push(): - RunTestCase("tests/integration/array-push.js") - - - [Test] def array_shift(): - RunTestCase("tests/integration/array-shift.js") - - - [Test] def array_slice(): - RunTestCase("tests/integration/array-slice.js") - - - [Test] def array_sort(): - RunTestCase("tests/integration/array-sort.js") - - - [Test] def array_splice_2(): - RunTestCase("tests/integration/array-splice-2.js") - - - [Test] def array_splice(): - RunTestCase("tests/integration/array-splice.js") - - - [Test] def array_str(): - RunTestCase("tests/integration/array-str.js") - - - [Test] def array_toString(): - RunTestCase("tests/integration/array-toString.js") - - - [Test] def array_unshift(): - RunTestCase("tests/integration/array-unshift.js") - - - [Test] def array_with_initial_length(): - RunTestCase("tests/integration/array-with-initial-length.js") - - - [Test] def array_with_two_dimensions(): - RunTestCase("tests/integration/array-with-two-dimensions.js") - - - [Test] def arrays_2(): - RunTestCase("tests/integration/arrays-2.js") - - - [Test] def arrays_3(): - RunTestCase("tests/integration/arrays-3.js") - - - [Test] def arrays_4(): - RunTestCase("tests/integration/arrays-4.js") - - - [Test] def arrays_6(): - RunTestCase("tests/integration/arrays-6.js") - - - [Test] def arrays(): - RunTestCase("tests/integration/arrays.js") - - - [Test] def assign_iterator(): - RunTestCase("tests/integration/assign_iterator.js") - - - [Test] def attributes_2(): - RunTestCase("tests/integration/attributes-2.js") - - - [Test] def attributes(): - RunTestCase("tests/integration/attributes.js") - - - [Test] def auto_coroutine_2(): - RunTestCase("tests/integration/auto-coroutine-2.js") - - - [Test] def auto_coroutine_return_2(): - RunTestCase("tests/integration/auto-coroutine-return-2.js") - - - [Test] def cast_operator_1(): - RunTestCase("tests/integration/cast-operator-1.js") - - - [Test] def cast_operator_precedence(): - RunTestCase("tests/integration/cast-operator-precedence.js") - - - [Test] def chars(): - RunTestCase("tests/integration/chars.js") - - - [Test] def comma_parsing(): - RunTestCase("tests/integration/comma-parsing.js") - - - [Test] def constructor_1(): - RunTestCase("tests/integration/constructor-1.js") - - - [Test] def constructor_2(): - RunTestCase("tests/integration/constructor_2.js") - - - [Test] def continue_issue(): - RunTestCase("tests/integration/continue-issue.js") - - - [Test] def coroutine_2(): - RunTestCase("tests/integration/coroutine-2.js") - - - [Test] def coroutine_3(): - RunTestCase("tests/integration/coroutine-3.js") - - - [Test] def coroutine_4(): - RunTestCase("tests/integration/coroutine-4.js") - - - [Test] def coroutine_5(): - RunTestCase("tests/integration/coroutine-5.js") - - - [Test] def coroutine_return_type_1(): - RunTestCase("tests/integration/coroutine-return-type-1.js") - - - [Test] def coroutine_try_catch(): - RunTestCase("tests/integration/coroutine-try-catch.js") - - - [Test] def coroutine(): - RunTestCase("tests/integration/coroutine.js") - - - [Test] def crash(): - RunTestCase("tests/integration/crash.js") - - - [Test] def do_while(): - RunTestCase("tests/integration/do-while.js") - - - [Test] def double_precision_can_be_used_for_literals(): - RunTestCase("tests/integration/double-precision-can-be-used-for-literals.js") - - - [Test] def empty_array_literal_as_return_value(): - RunTestCase("tests/integration/empty-array-literal-as-return-value.js") - - - [Test] def empty_array_literal_as_yield_value(): - RunTestCase("tests/integration/empty-array-literal-as-yield-value.js") - - - [Test] def empty_string_array(): - RunTestCase("tests/integration/empty-string-array.js") - - - [Test] def enum_1(): - RunTestCase("tests/integration/enum-1.js") - - - [Test] def enum_2(): - RunTestCase("tests/integration/enum-2.js") - - - [Test] def enum_3(): - RunTestCase("tests/integration/enum-3.js") - - - [Test] def enum_4(): - RunTestCase("tests/integration/enum-4.js") - - - [Test] def enum_5(): - RunTestCase("tests/integration/enum-5.js") - - - [Test] def enum_conversion(): - RunTestCase("tests/integration/enum-conversion.js") - - - [Test] def enumerator_array(): - RunTestCase("tests/integration/enumerator-array.js") - - - [Test] def explicit_awake_function(): - RunTestCase("tests/integration/explicit-awake-function.js") - - - [Test] def float_1(): - RunTestCase("tests/integration/float-1.js") - - - [Test] def float_2(): - RunTestCase("tests/integration/float-2.js") - - - [Test] def float_array_literal(): - RunTestCase("tests/integration/float-array-literal.js") - - - [Test] def float_overload_is_preferred_over_int_for_double_argument_2(): - RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument-2.js") - - - [Test] def float_overload_is_preferred_over_int_for_double_argument_strict_downcast(): - RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument-strict-downcast.js") - - - [Test] def float_overload_is_preferred_over_int_for_double_argument_strict(): - RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument-strict.js") - - - [Test] def float_overload_is_preferred_over_int_for_double_argument(): - RunTestCase("tests/integration/float-overload-is-preferred-over-int-for-double-argument.js") - - - [Test] def for_break_1(): - RunTestCase("tests/integration/for-break-1.js") - - - [Test] def for_continue_1(): - RunTestCase("tests/integration/for-continue-1.js") - - - [Test] def for_continue_2(): - RunTestCase("tests/integration/for-continue-2.js") - - - [Test] def for_over_null(): - RunTestCase("tests/integration/for-over-null.js") - - - [Test] def functions_1(): - RunTestCase("tests/integration/functions-1.js") - - - [Test] def generator_inheritance_calling_super(): - RunTestCase("tests/integration/generator-inheritance-calling-super.js") - - - [Test] def generator_inheritance_yielding_super(): - RunTestCase("tests/integration/generator-inheritance-yielding-super.js") - - - [Test] def generator_inheritance(): - RunTestCase("tests/integration/generator-inheritance.js") - - - [Test] def implict_bool_hierarchy(): - RunTestCase("tests/integration/implict-bool-hierarchy.js") - - - [Test] def inferred_GetComponent(): - RunTestCase("tests/integration/inferred-GetComponent.js") - - - [Test] def initializeorder(): - RunTestCase("tests/integration/initializeorder.js") - - - [Test] def interfaces_1(): - RunTestCase("tests/integration/interfaces-1.js") - - - [Test] def invalidil(): - RunTestCase("tests/integration/invalidil.js") - - - [Test] def length_string(): - RunTestCase("tests/integration/length-string.js") - - - [Test] def linq_array_ToList(): - RunTestCase("tests/integration/linq-array-ToList.js") - - - [Test] def linq_function_inference(): - RunTestCase("tests/integration/linq-function-inference.js") - - - [Test] def linq_lambda_inference(): - RunTestCase("tests/integration/linq-lambda-inference.js") - - - [Test] def magicclass(): - RunTestCase("tests/integration/magicclass.js") - - - [Test] def magicconstructor(): - RunTestCase("tests/integration/magicconstructor.js") - - - [Test] def magicconstructor_2(): - RunTestCase("tests/integration/magicconstructor_2.js") - - - [Test] def multidimensional_arrays_1(): - RunTestCase("tests/integration/multidimensional-arrays-1.js") - - - [Test] def nested_class_1(): - RunTestCase("tests/integration/nested-class-1.js") - - - [Test] def nested_classes(): - RunTestCase("tests/integration/nested-classes.js") - - - [Test] def new_1(): - RunTestCase("tests/integration/new-1.js") - - - [Test] def null_initializer(): - RunTestCase("tests/integration/null-initializer.js") - - - [Test] def operators_4(): - RunTestCase("tests/integration/operators-4.js") - - - [Test] def operators_5(): - RunTestCase("tests/integration/operators-5.js") - - - [Test] def override_1(): - RunTestCase("tests/integration/override-1.js") - - - [Test] def param_test(): - RunTestCase("tests/integration/param_test.js") - - - [Test] def parse_int(): - RunTestCase("tests/integration/parse_int.js") - - - [Test] def private_duck(): - RunTestCase("tests/integration/private-duck.js") - - - [Test] def properties(): - RunTestCase("tests/integration/properties.js") - - - [Test] def quack_fu(): - RunTestCase("tests/integration/quack-fu.js") - - - [Test] def question_mark(): - RunTestCase("tests/integration/question_mark.js") - - - [Test] def raw_array_indexing(): - RunTestCase("tests/integration/raw-array-indexing.js") - - - [Test] def rethrow(): - RunTestCase("tests/integration/rethrow.js") - - - [Test] def script_attributes(): - RunTestCase("tests/integration/script-attributes.js") - - - [Test] def shift_left_bitwise_or(): - RunTestCase("tests/integration/shift-left-bitwise-or.js") - - - [Test] def static_instance_overload_resolution(): - RunTestCase("tests/integration/static-instance-overload-resolution.js") - - - [Test] def string_append(): - RunTestCase("tests/integration/string-append.js") - - - [Test] def string_concat(): - RunTestCase("tests/integration/string-concat.js") - - - [Test] def switch_3(): - RunTestCase("tests/integration/switch-3.js") - - - [Test] def switch_fallthrough(): - RunTestCase("tests/integration/switch-fallthrough.js") - - - [Test] def switch_simple_2(): - RunTestCase("tests/integration/switch-simple-2.js") - - - [Test] def switch_simple(): - RunTestCase("tests/integration/switch-simple.js") - - - [Test] def switch_with_loop(): - RunTestCase("tests/integration/switch-with-loop.js") - - - [Test] def switch(): - RunTestCase("tests/integration/switch.js") - - - [Test] def transform_collider_bounds(): - RunTestCase("tests/integration/transform-collider-bounds.js") - - - [Test] def typecast_1(): - RunTestCase("tests/integration/typecast-1.js") - - - [Test] def typeof_1(): - RunTestCase("tests/integration/typeof-1.js") - - - [Test] def typeof_2(): - RunTestCase("tests/integration/typeof-2.js") - - - [Test] def types_1(): - RunTestCase("tests/integration/types-1.js") - - - [Test] def uint_1(): - RunTestCase("tests/integration/uint-1.js") - - - [Test] def value_types_1(): - RunTestCase("tests/integration/value-types-1.js") - - - [Test] def valuetypes_1(): - RunTestCase("tests/integration/valuetypes-1.js") - - - [Test] def varargs_in_constructor_with_vector3(): - RunTestCase("tests/integration/varargs-in-constructor-with-vector3.js") - - - [Test] def varargs_with_vector3(): - RunTestCase("tests/integration/varargs-with-vector3.js") - - - [Test] def variable_declaration_2(): - RunTestCase("tests/integration/variable-declaration-2.js") - - - [Test] def variable_declaration(): - RunTestCase("tests/integration/variable-declaration.js") - - - [Test] def variables(): - RunTestCase("tests/integration/variables.js") - - - [Test] def vars_1(): - RunTestCase("tests/integration/vars-1.js") - - - [Test] def virtual_test(): - RunTestCase("tests/integration/virtual-test.js") - \ No newline at end of file + override def CreateCompilerPipeline(): + pipeline = super() + pipeline.InsertAfter(UnityScript.Steps.Parse, UnityScript.Steps.IntroducePragmas((UnityScript.Core.Pragmas.Strict,))) + return pipeline \ No newline at end of file diff --git a/src/UnityScript.Tests/UnityScript.Tests.booproj b/src/UnityScript.Tests/UnityScript.Tests.booproj index e63aa34..3c8a722 100755 --- a/src/UnityScript.Tests/UnityScript.Tests.booproj +++ b/src/UnityScript.Tests/UnityScript.Tests.booproj @@ -77,6 +77,7 @@ + diff --git a/src/UnityScript/Steps/IntroducePragmas.boo b/src/UnityScript/Steps/IntroducePragmas.boo index c597a24..36c2bbc 100755 --- a/src/UnityScript/Steps/IntroducePragmas.boo +++ b/src/UnityScript/Steps/IntroducePragmas.boo @@ -6,9 +6,9 @@ import Boo.Lang.Compiler.Steps class IntroducePragmas(AbstractCompilerStep): - _pragmas as List of string + _pragmas as string* - def constructor(pragmas as List of string): + def constructor(pragmas as string*): _pragmas = pragmas override def Run(): From 452dc36524c589c078e52870f16b3f0e0102569e Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 15 Jun 2011 15:33:13 -0300 Subject: [PATCH 164/276] declare all variables in tests that are supposed to work in strict mode --- tests/integration/array-push-2.js | 3 +-- tests/integration/array-push.js | 2 +- tests/integration/array-shift.js | 2 +- tests/integration/array-slice.js | 2 +- tests/integration/array-unshift.js | 3 +-- tests/integration/float-1.js | 18 +++++++++--------- tests/integration/typecast-1.js | 4 ++-- tests/integration/typeof-1.js | 2 +- tests/integration/vars-1.js | 8 ++++---- 9 files changed, 21 insertions(+), 23 deletions(-) diff --git a/tests/integration/array-push-2.js b/tests/integration/array-push-2.js index 410af1a..7c95a55 100644 --- a/tests/integration/array-push-2.js +++ b/tests/integration/array-push-2.js @@ -12,8 +12,7 @@ array.push(1); print (array[0]); print (array[1]); -pushed = array.push("bird", "fish"); -print (pushed ); +print (array.push("bird", "fish")); print (array[2]); print (array[3]); diff --git a/tests/integration/array-push.js b/tests/integration/array-push.js index b946617..6046fa7 100644 --- a/tests/integration/array-push.js +++ b/tests/integration/array-push.js @@ -12,11 +12,11 @@ array.push(1); print (array[0]); print (array[1]); +var pushed; pushed = array.push("bird"); array.push("fish"); print (array[2]); print (array[3]); - print (pushed ); diff --git a/tests/integration/array-shift.js b/tests/integration/array-shift.js index 7cbe5be..5962e86 100644 --- a/tests/integration/array-shift.js +++ b/tests/integration/array-shift.js @@ -6,7 +6,7 @@ fish */ var array = new Array("cat", "dog", "bird", "fish"); -shifted = array.shift(); +var shifted = array.shift(); print ( shifted ); print ( array[0] ); diff --git a/tests/integration/array-slice.js b/tests/integration/array-slice.js index 429489b..0194551 100644 --- a/tests/integration/array-slice.js +++ b/tests/integration/array-slice.js @@ -8,7 +8,7 @@ canary parrot */ var pets_array = new Array("cat", "dog", "fish", "canary", "parrot"); -fourLeggedPets_array = pets_array.slice(0, 2); +var fourLeggedPets_array = pets_array.slice(0, 2); print ( fourLeggedPets_array[0] ); print ( fourLeggedPets_array[1] ); diff --git a/tests/integration/array-unshift.js b/tests/integration/array-unshift.js index 30ec9fc..4caef6b 100644 --- a/tests/integration/array-unshift.js +++ b/tests/integration/array-unshift.js @@ -17,8 +17,7 @@ print ( array[0] ); print ( array[1] ); print ( array[2] ); -n = array.unshift("ferrets", "gophers", "engineers"); -print ( n ); +print (array.unshift("ferrets", "gophers", "engineers")); print ( array[0] ); print ( array[1] ); diff --git a/tests/integration/float-1.js b/tests/integration/float-1.js index 6684005..ba85782 100644 --- a/tests/integration/float-1.js +++ b/tests/integration/float-1.js @@ -9,29 +9,29 @@ System.Single System.Double System.Single */ -v1 = .5; +var v1 = .5; print(v1.GetType()); -v2 = .5f; +var v2 = .5f; print(v2.GetType()); -v3 = .55; +var v3 = .55; print(v3.GetType()); -v4 = .55f; +var v4 = .55f; print(v4.GetType()); -v5 = .555; +var v5 = .555; print(v5.GetType()); -v6 = .555f; +var v6 = .555f; print(v6.GetType()); -v7 = .5555; +var v7 = .5555; print(v7.GetType()); -v8 = .5555d; +var v8 = .5555d; print(v8.GetType()); -v9 = .5555f; // forces single precision +var v9 = .5555f; // forces single precision print(v9.GetType()); diff --git a/tests/integration/typecast-1.js b/tests/integration/typecast-1.js index df19d01..ee54a20 100644 --- a/tests/integration/typecast-1.js +++ b/tests/integration/typecast-1.js @@ -3,12 +3,12 @@ Right */ import UnityScript.Tests; -b = transform as MonoBehaviour; +var b = transform as MonoBehaviour; if (b != null) { print ("Wrong"); } -c = transform as Transform; +var c = transform as Transform; if (c != null) { print ("Right"); } \ No newline at end of file diff --git a/tests/integration/typeof-1.js b/tests/integration/typeof-1.js index 3c25d12..776d643 100644 --- a/tests/integration/typeof-1.js +++ b/tests/integration/typeof-1.js @@ -11,7 +11,7 @@ class Foo { } print(typeof(1)); -test = new Foo(); +var test = new Foo(); print(typeof(test)); print(typeof(Foo)); print(typeof(Foo[])); diff --git a/tests/integration/vars-1.js b/tests/integration/vars-1.js index ad20f79..72a119f 100644 --- a/tests/integration/vars-1.js +++ b/tests/integration/vars-1.js @@ -10,7 +10,7 @@ var flags = BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance|Bin var type = GetType(); function AssertField(name:String) { - field = type.GetField(name, flags); + var field = type.GetField(name, flags); if (field == null) throw name; return field; } @@ -23,9 +23,9 @@ function AssertIsFalse(condition:boolean, description:String) { if (condition) throw description; } -fa = AssertField("a"); -fb = AssertField("b"); -fc = AssertField("c"); +var fa = AssertField("a"); +var fb = AssertField("b"); +var fc = AssertField("c"); AssertIsTrue(fa.IsPublic, "public a"); AssertIsFalse(fa.IsStatic, "instance a"); From a8b705c999ad09fe236cb2bdc84a7c7562ba1a0a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 15 Jun 2011 15:34:12 -0300 Subject: [PATCH 165/276] add required explicit casts to tests that are supposed to work in strict mode --- tests/integration/attributes-2.js | 12 ++++---- tests/integration/coroutine-try-catch.js | 30 +++++++++---------- .../implicit-array-to-native-array-cast.js | 8 +++++ tests/integration/script-attributes.js | 7 ++--- tests/integration/switch-3.js | 15 +++++----- 5 files changed, 39 insertions(+), 33 deletions(-) create mode 100644 tests/integration/implicit-array-to-native-array-cast.js diff --git a/tests/integration/attributes-2.js b/tests/integration/attributes-2.js index 39663d3..cbe30ae 100644 --- a/tests/integration/attributes-2.js +++ b/tests/integration/attributes-2.js @@ -1,13 +1,13 @@ -/* +/* yes -*/ +*/ import UnityScript.Tests; -@AttributeWithMask(AttributeMaskEnum.Foo | AttributeMaskEnum.Bar) -function bar() { -} +@AttributeWithMask(AttributeMaskEnum.Foo | AttributeMaskEnum.Bar) +function bar() { +} -var attr : AttributeWithMask = GetType().GetMethod ("bar").GetCustomAttributes(AttributeWithMask, false)[0]; +var attr = GetType().GetMethod ("bar").GetCustomAttributes(AttributeWithMask, false)[0] as AttributeWithMask; if (attr.mask == (AttributeMaskEnum.Foo | AttributeMaskEnum.Bar)) print ("yes"); \ No newline at end of file diff --git a/tests/integration/coroutine-try-catch.js b/tests/integration/coroutine-try-catch.js index 6e85c58..7700651 100755 --- a/tests/integration/coroutine-try-catch.js +++ b/tests/integration/coroutine-try-catch.js @@ -6,25 +6,25 @@ Caught bar */ class WWW { - public var value: String; + public var value: String; - function WWW(value: String) { - this.value = value; - } + function WWW(value: String) { + this.value = value; + } } function wwws(names) { - for (var str in names) { - var www = new WWW(str); - yield www; - try { - var v = www.value; - throw new System.Exception(); - } catch (x) { - print("Caught " + str); - } + for (var str in names) { + var www = new WWW(str as String); + yield www; + try { + var v = www.value; + throw new System.Exception(); + } catch (x) { + print("Caught " + str); } + } } -for (var www: WWW in wwws(["foo", "bar"])) - print(www.value); +for (var www in wwws(["foo", "bar"])) + print((www as WWW).value); diff --git a/tests/integration/implicit-array-to-native-array-cast.js b/tests/integration/implicit-array-to-native-array-cast.js new file mode 100644 index 0000000..193f46d --- /dev/null +++ b/tests/integration/implicit-array-to-native-array-cast.js @@ -0,0 +1,8 @@ +/* +0,1,2 +*/ +var output : int[]; +var array = Array(0, 1, 2); +output = array; +print(join(output, ",")); + diff --git a/tests/integration/script-attributes.js b/tests/integration/script-attributes.js index 115a78a..595c5ea 100644 --- a/tests/integration/script-attributes.js +++ b/tests/integration/script-attributes.js @@ -1,12 +1,11 @@ -/* +/* yes -*/ +*/ import UnityScript.Tests; - @script AttributeWithMask (AttributeMaskEnum.Foo | AttributeMaskEnum.Bar) -var attr : AttributeWithMask = GetType().GetCustomAttributes(AttributeWithMask, false)[0]; +var attr = GetType().GetCustomAttributes(AttributeWithMask, false)[0] as AttributeWithMask; if (attr.mask == (AttributeMaskEnum.Foo | AttributeMaskEnum.Bar)) print ("yes"); \ No newline at end of file diff --git a/tests/integration/switch-3.js b/tests/integration/switch-3.js index d75a8d6..c3f3df1 100644 --- a/tests/integration/switch-3.js +++ b/tests/integration/switch-3.js @@ -2,12 +2,11 @@ True */ var journalList = Array ("TT"); - -for (var N : String in journalList) -{ - switch(N){ - case "TT": - print ("True"); - break; - } +for (var N in journalList) { + var selector = N as String; + switch (selector) { + case "TT": + print ("True"); + break; + } } From 23104d98bc1be0a1ed004c35ba5b6b30bfdbd992 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 15 Jun 2011 15:34:28 -0300 Subject: [PATCH 166/276] test files missing from last commits --- .../DuckyIntegrationTestFixture.boo | 52 ++++++++++--------- tests/ducky/virtual-test.js | 2 +- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index c83f017..d13191c 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -50,22 +50,6 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-Remove.js") - [Test] def array_cast_2(): - RunTestCase("tests/integration/array-cast-2.js") - - - [Test] def array_cast_3(): - RunTestCase("tests/integration/array-cast-3.js") - - - [Test] def array_cast_4(): - RunTestCase("tests/integration/array-cast-4.js") - - - [Test] def array_cast_5(): - RunTestCase("tests/integration/array-cast-5.js") - - [Test] def array_cast(): RunTestCase("tests/integration/array-cast.js") @@ -126,10 +110,6 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/array-nesting.js") - [Test] def array_polymorphic_foreach(): - RunTestCase("tests/integration/array-polymorphic-foreach.js") - - [Test] def array_pop(): RunTestCase("tests/integration/array-pop.js") @@ -394,6 +374,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/generator-inheritance.js") + [Test] def implicit_array_to_native_array_cast(): + RunTestCase("tests/integration/implicit-array-to-native-array-cast.js") + + [Test] def implict_bool_hierarchy(): RunTestCase("tests/integration/implict-bool-hierarchy.js") @@ -606,10 +590,6 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/vars-1.js") - [Test] def virtual_test(): - RunTestCase("tests/integration/virtual-test.js") - - [Test] def Array_cast_to_native_array_of_struct(): RunTestCase("tests/ducky/Array-cast-to-native-array-of-struct.js") @@ -642,6 +622,22 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/ducky/array-access.js") + [Test] def array_cast_2(): + RunTestCase("tests/ducky/array-cast-2.js") + + + [Test] def array_cast_3(): + RunTestCase("tests/ducky/array-cast-3.js") + + + [Test] def array_cast_4(): + RunTestCase("tests/ducky/array-cast-4.js") + + + [Test] def array_cast_5(): + RunTestCase("tests/ducky/array-cast-5.js") + + [Test] def array_iterate(): RunTestCase("tests/ducky/array-iterate.js") @@ -654,6 +650,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/ducky/array-nest-2.js") + [Test] def array_polymorphic_foreach(): + RunTestCase("tests/ducky/array-polymorphic-foreach.js") + + [Test] def array_push_typesjs(): RunTestCase("tests/ducky/array-push-typesjs.js") @@ -776,4 +776,8 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): [Test] def var_with_no_initializer(): RunTestCase("tests/ducky/var-with-no-initializer.js") + + + [Test] def virtual_test(): + RunTestCase("tests/ducky/virtual-test.js") \ No newline at end of file diff --git a/tests/ducky/virtual-test.js b/tests/ducky/virtual-test.js index 904feec..b3ff5fa 100755 --- a/tests/ducky/virtual-test.js +++ b/tests/ducky/virtual-test.js @@ -20,7 +20,7 @@ class Test1 extends BaseTest { print("Test1 " + p); } - // implicit shadowing, gives a warning + // implicit shadowing, gives a warning in non strict mode function DoStuffNotVirtual (p : float) { print("Test1"); } From 27efa1e007becc7843a9fe62d2b80ece616ab5ea Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 15 Jun 2011 15:35:31 -0300 Subject: [PATCH 167/276] enable IQuackFu even when in strict mode (fixes tests/integration/quack-fu.js) --- src/UnityScript/Steps/ProcessUnityScriptMethods.boo | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index 4bc7e70..93960be 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -57,14 +57,6 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): override def GetGeneratorReturnType(generator as InternalMethod): return TypeSystemServices.IEnumeratorType - - override def IsDuckTyped(e as Expression): - if Strict: return false - return super(e) - - override def IsDuckTyped(member as IMember): - if Strict: return false - return super(member) override protected def MemberNotFound(node as MemberReferenceExpression, ns as INamespace): if Strict: From 65025a7f2e773de2b1e9fa6fa796cb02c1df5903 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 15 Jun 2011 15:36:24 -0300 Subject: [PATCH 168/276] apply type inference to for iterators (fixes tests/integration/chars.js in strict mode) --- src/UnityScript/Steps/ProcessUnityScriptMethods.boo | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index 93960be..d1a1022 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -218,10 +218,11 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): VisitForStatementBlock(node) def ProcessUpdateableIteration(node as ForStatement): + originalIterator = node.Iterator newIterator = CodeBuilder.CreateMethodInvocation(_UnityRuntimeServices_GetEnumerator, node.Iterator) newIterator.LexicalInfo = LexicalInfo(node.Iterator.LexicalInfo) node.Iterator = newIterator - ProcessDeclarationForIterator(node.Declarations[0], TypeSystemServices.ObjectType) + ProcessDeclarationForIterator(node.Declarations[0], GetEnumeratorItemType(GetExpressionType(originalIterator))) VisitForStatementBlock(node) TransformIteration(node) From 40795aafd9f61be10e1a597e3d01f153233724a5 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 15 Jun 2011 15:45:07 -0300 Subject: [PATCH 169/276] add additional parseInt and parseFloat overloads taking double arguments for disambiguation (fixes case #408273) --- src/UnityScript.Lang/UnityBuiltins.boo | 24 +++++++++++++++--------- tests/integration/parse_int.js | 6 +++++- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/UnityScript.Lang/UnityBuiltins.boo b/src/UnityScript.Lang/UnityBuiltins.boo index 3f626a1..65878c0 100755 --- a/src/UnityScript.Lang/UnityBuiltins.boo +++ b/src/UnityScript.Lang/UnityBuiltins.boo @@ -1,24 +1,30 @@ namespace UnityScript.Lang -class UnityBuiltins: +static class UnityBuiltins: - static def eval(code as string): - return null + def eval(code as string) as object: + raise System.NotImplementedException() - static def parseInt (value as System.String) as int: + def parseInt (value as System.String) as int: return int.Parse(value) - static def parseInt (value as single) as int: + def parseInt (value as single) as int: + return value + + def parseInt (value as double) as int: return value - static def parseInt (value as int) as int: + def parseInt (value as int) as int: return value - static def parseFloat (value as System.String) as single: + def parseFloat (value as System.String) as single: return single.Parse(value) - static def parseFloat (value as single) as single: + def parseFloat (value as single) as single: + return value + + def parseFloat (value as double) as single: return value - static def parseFloat (value as int) as single: + def parseFloat (value as int) as single: return value diff --git a/tests/integration/parse_int.js b/tests/integration/parse_int.js index 3d20db4..2e0fa7e 100644 --- a/tests/integration/parse_int.js +++ b/tests/integration/parse_int.js @@ -1,4 +1,8 @@ /* +42 +2 1 */ -print(parseInt(1.5)); \ No newline at end of file +print(parseInt(42.5d)); +print(parseInt(2)); +print(parseInt(1.5f)); \ No newline at end of file From 2eedd93551ca61702462413167933a749b4f3bc7 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 11 Jul 2011 17:19:23 -0300 Subject: [PATCH 170/276] prove internal fields are supported --- src/UnityScript.Tests/DuckyIntegrationTestFixture.boo | 4 ++++ .../StrictIntegrationTestFixture.Generated.boo | 4 ++++ tests/integration/internal-field.js | 8 ++++++++ 3 files changed, 16 insertions(+) create mode 100644 tests/integration/internal-field.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index d13191c..878d878 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -394,6 +394,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/interfaces-1.js") + [Test] def internal_field(): + RunTestCase("tests/integration/internal-field.js") + + [Test] def invalidil(): RunTestCase("tests/integration/invalidil.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo index 441d236..b00596d 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo @@ -392,6 +392,10 @@ partial class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/interfaces-1.js") + [Test] def internal_field(): + RunTestCase("tests/integration/internal-field.js") + + [Test] def invalidil(): RunTestCase("tests/integration/invalidil.js") diff --git a/tests/integration/internal-field.js b/tests/integration/internal-field.js new file mode 100644 index 0000000..0bebe72 --- /dev/null +++ b/tests/integration/internal-field.js @@ -0,0 +1,8 @@ +/* +True +*/ +import System.Reflection; + +internal var i = 42; + +print(GetType().GetField("i", BindingFlags.Instance|BindingFlags.NonPublic).IsAssembly); From 8ec99816f0013ceda63028ed4e8b53754a3da0b9 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 14 Jul 2011 14:28:15 -0300 Subject: [PATCH 171/276] use the boo key for signing --- default.build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/default.build b/default.build index c5cf12c..c199ee1 100755 --- a/default.build +++ b/default.build @@ -16,6 +16,7 @@ + @@ -141,6 +142,7 @@ + + From 1f34f23427e1dd7f580031f2f3c8b05191ff52c0 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 14 Jul 2011 15:50:11 -0300 Subject: [PATCH 172/276] make semantic test suite more precise --- .../AbstractSemanticsTestFixture.boo | 2 +- tests/semantics/Magic2Class.js | 11 ++-- tests/semantics/MagicClass.js | 18 ++++-- tests/semantics/class-3.js | 41 +++++++------ tests/semantics/coroutine.js | 58 ++++++++++++++----- tests/semantics/fields-1.js | 18 ++++-- tests/semantics/functions-2.js | 18 +++--- tests/semantics/magic-members.js | 8 ++- tests/semantics/single-update-function.js | 8 ++- tests/semantics/variables.js | 8 ++- 10 files changed, 128 insertions(+), 62 deletions(-) diff --git a/src/UnityScript.Tests/AbstractSemanticsTestFixture.boo b/src/UnityScript.Tests/AbstractSemanticsTestFixture.boo index 0e2775d..197d491 100755 --- a/src/UnityScript.Tests/AbstractSemanticsTestFixture.boo +++ b/src/UnityScript.Tests/AbstractSemanticsTestFixture.boo @@ -10,4 +10,4 @@ class AbstractSemanticsTestFixture(AbstractCompilerTestFixture): _compiler.Parameters.Imports.Add("UnityScript.Tests") override protected def CreateCompilerPipeline(): - return UnityScript.UnityScriptCompiler.Pipelines.Parse() + return UnityScript.UnityScriptCompiler.Pipelines.Compile() diff --git a/tests/semantics/Magic2Class.js b/tests/semantics/Magic2Class.js index eaea32a..9bbfb3a 100755 --- a/tests/semantics/Magic2Class.js +++ b/tests/semantics/Magic2Class.js @@ -1,16 +1,19 @@ /* import UnityScript.Tests -partial public class Magic2Class: +partial public class Magic2Class(Object): - public virtual def foo(): + public virtual def foo() as void: pass - public virtual def bar(): + public virtual def bar() as void: pass - public virtual def Awake(): + public virtual def Awake() as void: pass + + public def constructor(): + super() */ class Magic2Class { diff --git a/tests/semantics/MagicClass.js b/tests/semantics/MagicClass.js index 76be708..333c993 100755 --- a/tests/semantics/MagicClass.js +++ b/tests/semantics/MagicClass.js @@ -1,20 +1,28 @@ /* import UnityScript.Tests +public class AnotherMagicClass(UnityScript.Tests.MonoBehaviour): + + public def constructor(): + super() + partial public class MagicClass(AnotherMagicClass): - public virtual def foo(): + public virtual def foo() as void: pass - public virtual def bar(): + public virtual def bar() as void: pass - public def constructor(value): - pass + public def constructor(value as Object): + super() - public virtual def Awake(): + public virtual def Awake() as void: pass */ +class AnotherMagicClass extends MonoBehaviour { +} + class MagicClass extends AnotherMagicClass { function foo() { } diff --git a/tests/semantics/class-3.js b/tests/semantics/class-3.js index c3517e6..d5676b7 100755 --- a/tests/semantics/class-3.js +++ b/tests/semantics/class-3.js @@ -1,43 +1,48 @@ /* import UnityScript.Tests -public class Person: +public class Person(Object): - public _name as string + public _name as String private _age as int - public def constructor(name as string, age as int): - _name = name - _age = age + public def constructor(name as String, age as int): + super() + self._name = name + self._age = age - Name: + public Name as String: public virtual get: - return _name + return self._name - Age: + public Age as int: public virtual get: - return _age + return self._age - public virtual def ToString() as string: - return ((_name + ', ') + _age) + public override def ToString() as String: + return Boo.Lang.Runtime.RuntimeServices.op_Addition(Boo.Lang.Runtime.RuntimeServices.op_Addition(self._name, ', '), self._age) - public static def StaticFunction(): + public static def StaticFunction() as void: pass partial public class class-3(UnityScript.Tests.MonoBehaviour): - public p as Person = Person('Eric Idle', 42) + public p as Person - public virtual def Awake(): - print(p.ToString()) + public virtual def Awake() as void: + Boo.Lang.Builtins.print(self.p.ToString()) + + public def constructor(): + super() + self.p = Person('Eric Idle', 42) */ class Person { - var _name:string; + var _name:String; private var _age:int; - function Person(name:string, age:int) { + function Person(name:String, age:int) { _name = name; _age = age; } @@ -50,7 +55,7 @@ class Person { return _age; } - function ToString() : string { + function ToString() : String { return _name + ", " + _age; } diff --git a/tests/semantics/coroutine.js b/tests/semantics/coroutine.js index 8250bba..be94c86 100755 --- a/tests/semantics/coroutine.js +++ b/tests/semantics/coroutine.js @@ -3,26 +3,54 @@ import UnityScript.Tests partial public class coroutine(UnityScript.Tests.MonoBehaviour): - private def spam(): - yield - yield 0 - yield 1 - yield 2 - - public virtual def Awake(): - enumerate = spam() - for e in enumerate: - print(e) + private def spam() as System.Collections.IEnumerator: + return coroutine.$spam$2().GetEnumerator() + + public virtual def Awake() as void: + enumerate = self.StartCoroutine_Auto(self.spam()) + $iterator$1 = UnityScript.Lang.UnityRuntimeServices.GetEnumerator(enumerate) + while $iterator$1.MoveNext(): + e = $iterator$1.get_Current() + Boo.Lang.Builtins.print(e) + UnityScript.Lang.UnityRuntimeServices.Update($iterator$1, e) + + public def constructor(): + super() + + [System.Runtime.CompilerServices.CompilerGeneratedAttribute] + internal final class $spam$2(Boo.Lang.GenericGenerator): + + public virtual def GetEnumerator() as System.Collections.Generic.IEnumerator: + return coroutine.$spam$2.$() + + public def constructor(): + super() + + [System.Runtime.CompilerServices.CompilerGeneratedAttribute] + final class $(Boo.Lang.GenericGeneratorEnumerator, System.Collections.IEnumerator): + + public def constructor(): + super() + + public virtual def MoveNext() as boolean: + __switch__(self._state, $state$0, $state$1, $state$2, $state$3) + :$state$0 + return self.YieldDefault(2) + :$state$2 + return self.Yield(3, 42) + :$state$3 + self.YieldDefault(1) + :$state$1 + + */ private function spam() { - // Allow for this shorthand form of yield. - // It should yield 0 + // shorthand form of yield. + // same as yield 0 in this case yield; - yield 0; - yield 1; - yield 2; + yield 42; } enumerate = spam(); diff --git a/tests/semantics/fields-1.js b/tests/semantics/fields-1.js index e357c7e..17f6f9f 100644 --- a/tests/semantics/fields-1.js +++ b/tests/semantics/fields-1.js @@ -1,18 +1,24 @@ /* import UnityScript.Tests -public class Fields: +public class Fields(Object): - public FirstName as string + public FirstName as String - public LastName as string + public LastName as String + + public def constructor(): + super() partial public class fields-1(UnityScript.Tests.MonoBehaviour): - public virtual def Awake(): + public virtual def Awake() as void: pass + + public def constructor(): + super() */ class Fields { - var FirstName:string; - var LastName:string; + var FirstName:String; + var LastName:String; } diff --git a/tests/semantics/functions-2.js b/tests/semantics/functions-2.js index 5a74013..39e51d5 100755 --- a/tests/semantics/functions-2.js +++ b/tests/semantics/functions-2.js @@ -3,16 +3,20 @@ import UnityScript.Tests partial public class functions-2(UnityScript.Tests.MonoBehaviour): - public value = 1 + public value as int - private def spam(thirdValue): - return ((value + 2) + thirdValue) + private def spam(thirdValue as Object) as System.Object: + return Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator('op_Addition', (self.value + 2), thirdValue) - private def eggs(): - print(spam(3)) + private def eggs() as void: + Boo.Lang.Builtins.print(self.spam(3)) - public virtual def Awake(): - eggs() + public virtual def Awake() as void: + self.eggs() + + public def constructor(): + super() + self.value = 1 */ var value = 1; diff --git a/tests/semantics/magic-members.js b/tests/semantics/magic-members.js index 6194e7f..74bcdad 100755 --- a/tests/semantics/magic-members.js +++ b/tests/semantics/magic-members.js @@ -3,15 +3,19 @@ import UnityScript.Tests partial public class magic-members(UnityScript.Tests.MonoBehaviour): - public value = 5 + public value as int - public virtual def Awake(): + public virtual def Awake() as void: if 1: otherValue1 = 7 else: otherValue2 = 7 while 0: otherValue3 = 7 + + public def constructor(): + super() + self.value = 5 */ // When a variable declaration is inside of a block it shouldnt become a member variable diff --git a/tests/semantics/single-update-function.js b/tests/semantics/single-update-function.js index 15c9f63..d8986c8 100755 --- a/tests/semantics/single-update-function.js +++ b/tests/semantics/single-update-function.js @@ -3,10 +3,14 @@ import UnityScript.Tests partial public class single-update-function(UnityScript.Tests.MonoBehaviour): - public virtual def Update(): + public virtual def Update() as void: pass - public virtual def Awake(): + public virtual def Awake() as void: pass + + public def constructor(): + super() + */ function Update() {} diff --git a/tests/semantics/variables.js b/tests/semantics/variables.js index 500bb6b..286cc0a 100644 --- a/tests/semantics/variables.js +++ b/tests/semantics/variables.js @@ -3,10 +3,14 @@ import UnityScript.Tests partial public class variables(UnityScript.Tests.MonoBehaviour): - public value = 5 + public value as int - public virtual def Awake(): + public virtual def Awake() as void: otherValue = 7 + + public def constructor(): + super() + self.value = 5 */ var value = 5; From 34bafd4b60624cfbe920a01a8e4cacb1c8f263e3 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 16 Jul 2011 12:03:56 -0300 Subject: [PATCH 173/276] support for preserving comments in the lexer (lexer.PreserveComments = true) --- src/UnityScript/UnityScript.g | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) mode change 100755 => 100644 src/UnityScript/UnityScript.g diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g old mode 100755 new mode 100644 index 9be5d03..7e48b13 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -76,6 +76,7 @@ tokens INPLACE_ADD="+="; INPLACE_SUBTRACT="-="; INPLACE_MULTIPLY="*="; + SL_COMMENT="//"; PRAGMA_ON="pragma on"; PRAGMA_OFF="pragma off"; @@ -1768,6 +1769,8 @@ options } { + property PreserveComments = false + static def IsDigit(ch as char): return ch >= char('0') and ch <= char('9') } @@ -1889,10 +1892,20 @@ INPLACE_SHIFT_RIGHT: ">>="; AT: '@'; DIVISION: - ("/*")=> ML_COMMENT { $setType(Token.SKIP); } | + ("/*")=> ML_COMMENT + { + if not PreserveComments: + $setType(Token.SKIP) + } | // (RE_LITERAL)=> RE_LITERAL { $setType(RE_LITERAL); } | '/' ( - ('/' (~('\r'|'\n'))* { $setType(Token.SKIP); }) | + ('/' (~('\r'|'\n'))* + { + if PreserveComments: + $setType(SL_COMMENT) + else: + $setType(Token.SKIP); + }) | ('=' { $setType(INPLACE_DIVISION); }) | ) ; @@ -1953,7 +1966,6 @@ ML_COMMENT: { LA(2) != char('/') }? '*' )* "*/" - { $setType(Token.SKIP); } ; protected From 4332fe6976cc68c78a79bc51df581ebcba55c935 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 16 Jul 2011 23:10:56 -0300 Subject: [PATCH 174/276] format generic type names correctly; update api to latest boo trunk --- .../Scripting/Pipeline/ProcessScriptingMethods.boo | 2 +- src/UnityScript/Steps/CheckBaseTypes.boo | 5 +++-- src/UnityScript/TypeSystem/UnityScriptEntityFormatter.boo | 7 +++++-- tests/error-messages/generic-type-name.js | 2 +- tests/semantics/coroutine.js | 6 +++--- 5 files changed, 13 insertions(+), 9 deletions(-) mode change 100755 => 100644 src/UnityScript/Scripting/Pipeline/ProcessScriptingMethods.boo mode change 100755 => 100644 src/UnityScript/Steps/CheckBaseTypes.boo mode change 100755 => 100644 tests/error-messages/generic-type-name.js mode change 100755 => 100644 tests/semantics/coroutine.js diff --git a/src/UnityScript/Scripting/Pipeline/ProcessScriptingMethods.boo b/src/UnityScript/Scripting/Pipeline/ProcessScriptingMethods.boo old mode 100755 new mode 100644 index d502a90..ee414b0 --- a/src/UnityScript/Scripting/Pipeline/ProcessScriptingMethods.boo +++ b/src/UnityScript/Scripting/Pipeline/ProcessScriptingMethods.boo @@ -30,7 +30,7 @@ they point to EvaluationContext provided members. if not ValidateContext(entity): member = entity.Delegate - Errors.Add(CompilerErrorFactory.InstanceRequired(node, member.DeclaringType.ToString(), member.Name)) + Errors.Add(CompilerErrorFactory.InstanceRequired(node, member)) node.ParentNode.Replace( node, diff --git a/src/UnityScript/Steps/CheckBaseTypes.boo b/src/UnityScript/Steps/CheckBaseTypes.boo old mode 100755 new mode 100644 index f20254f..e3974b8 --- a/src/UnityScript/Steps/CheckBaseTypes.boo +++ b/src/UnityScript/Steps/CheckBaseTypes.boo @@ -3,6 +3,7 @@ namespace UnityScript.Steps import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.Steps import Boo.Lang.Compiler.TypeSystem +import Boo.Lang.Compiler.TypeSystem.IEntityExtensions import UnityScript.Core @@ -25,13 +26,13 @@ class CheckBaseTypes(AbstractVisitorCompilerStep): type = TypeEntityFor(baseType) if type.IsClass: return - Errors.Add(UnityScriptCompilerErrors.ClassExpected(baseType.LexicalInfo, type.FullName)) + Errors.Add(UnityScriptCompilerErrors.ClassExpected(baseType.LexicalInfo, type.DisplayName())) def CheckIsInterface(baseType as TypeReference): type = TypeEntityFor(baseType) if type.IsInterface: return - Errors.Add(UnityScriptCompilerErrors.InterfaceExpected(baseType.LexicalInfo, type.FullName)) + Errors.Add(UnityScriptCompilerErrors.InterfaceExpected(baseType.LexicalInfo, type.DisplayName())) def TypeEntityFor(baseType as TypeReference) as IType: return GetEntity(baseType) diff --git a/src/UnityScript/TypeSystem/UnityScriptEntityFormatter.boo b/src/UnityScript/TypeSystem/UnityScriptEntityFormatter.boo index fbe44d2..bd53418 100644 --- a/src/UnityScript/TypeSystem/UnityScriptEntityFormatter.boo +++ b/src/UnityScript/TypeSystem/UnityScriptEntityFormatter.boo @@ -6,14 +6,17 @@ import Boo.Lang.PatternMatching class UnityScriptEntityFormatter(EntityFormatter): - def FormatType(type as IType) as string: + override def FormatType(type as IType) as string: match type: case IArrayType(ElementType, Rank): return "$(FormatType(ElementType))[$(',' * (Rank - 1))]" case ICallableType(): return FormatCallableType(type) otherwise: - return type.FullName + return super(type) + + override def FormatGenericArguments(genericArgs as string*): + return ".<$(join(genericArgs, ', '))>" def FormatCallableType(type as ICallableType): signature = type.GetSignature() diff --git a/tests/error-messages/generic-type-name.js b/tests/error-messages/generic-type-name.js old mode 100755 new mode 100644 index a71034c..df8f33c --- a/tests/error-messages/generic-type-name.js +++ b/tests/error-messages/generic-type-name.js @@ -1,5 +1,5 @@ /* -generic-type-name.js(7,3): BCE0019: 'Foo' is not a member of 'System.Collections.Generic.List'. +generic-type-name.js(7,3): BCE0019: 'Foo' is not a member of 'System.Collections.Generic.List.'. */ #pragma strict diff --git a/tests/semantics/coroutine.js b/tests/semantics/coroutine.js old mode 100755 new mode 100644 index be94c86..716375c --- a/tests/semantics/coroutine.js +++ b/tests/semantics/coroutine.js @@ -18,16 +18,16 @@ partial public class coroutine(UnityScript.Tests.MonoBehaviour): super() [System.Runtime.CompilerServices.CompilerGeneratedAttribute] - internal final class $spam$2(Boo.Lang.GenericGenerator): + internal final class $spam$2(Boo.Lang.GenericGenerator[of int]): - public virtual def GetEnumerator() as System.Collections.Generic.IEnumerator: + public virtual def GetEnumerator() as System.Collections.Generic.IEnumerator[of int]: return coroutine.$spam$2.$() public def constructor(): super() [System.Runtime.CompilerServices.CompilerGeneratedAttribute] - final class $(Boo.Lang.GenericGeneratorEnumerator, System.Collections.IEnumerator): + final class $(Boo.Lang.GenericGeneratorEnumerator[of int], System.Collections.IEnumerator): public def constructor(): super() From f5391c6b9647f74d90c21b2e8b70883b799193ad Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 1 Aug 2011 10:24:19 -0300 Subject: [PATCH 175/276] #pragma downcast can be used to allow implicit downcasts in for loops --- src/UnityScript.Tests/PragmaTestFixture.boo | 4 ++++ ...downcast-plus-strict-for-each-in-arrays.js | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100755 tests/pragma/downcast-plus-strict-for-each-in-arrays.js diff --git a/src/UnityScript.Tests/PragmaTestFixture.boo b/src/UnityScript.Tests/PragmaTestFixture.boo index 3189bfc..880c01b 100644 --- a/src/UnityScript.Tests/PragmaTestFixture.boo +++ b/src/UnityScript.Tests/PragmaTestFixture.boo @@ -15,6 +15,10 @@ class PragmaTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/pragma/downcast-plus-strict-for-arrays.js") + [Test] def downcast_plus_strict_for_each_in_arrays(): + RunTestCase("tests/pragma/downcast-plus-strict-for-each-in-arrays.js") + + [Test] def implicit_1(): RunTestCase("tests/pragma/implicit-1.js") diff --git a/tests/pragma/downcast-plus-strict-for-each-in-arrays.js b/tests/pragma/downcast-plus-strict-for-each-in-arrays.js new file mode 100755 index 0000000..af72e7c --- /dev/null +++ b/tests/pragma/downcast-plus-strict-for-each-in-arrays.js @@ -0,0 +1,19 @@ +/* +Bar +*/ +#pragma strict +#pragma downcast + +class Foo { +} + +class Bar extends Foo { +} + +function useBar(bar: Bar) { + print(bar); +} + +var array: Array = [new Bar()]; +for (var b: Bar in array) + useBar(b); \ No newline at end of file From 9c154cc18cb8e3bc684e871ece6dec4e1eb7cb95 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 17 Aug 2011 10:38:59 -0300 Subject: [PATCH 176/276] emit warnings (not errors) for implicit downcasts in strict mode by considering pragma downcast to be on by default, old behaviour can be obtained through "#pragma downcast off" --- .../ErrorMessagesTestFixture.Generated.boo | 24 ++++++++++++------- src/UnityScript/Core/Pragmas.boo | 3 +++ .../Steps/ProcessUnityScriptMethods.boo | 12 +++++++--- .../TypeSystem/UnityDowncastPermissions.boo | 5 ---- .../strict-disallows-downcast.js | 13 ---------- .../strict-disallows-duck-downcast.js | 10 -------- .../strict-warns-about-downcast.js | 18 ++++++++++++++ .../strict-warns-about-duck-downcast.js | 10 ++++++++ ...ct-with-downcast-off-disallows-downcast.js | 14 +++++++++++ ...th-downcast-off-disallows-duck-downcast.js | 11 +++++++++ 10 files changed, 81 insertions(+), 39 deletions(-) delete mode 100644 tests/error-messages/strict-disallows-downcast.js delete mode 100644 tests/error-messages/strict-disallows-duck-downcast.js create mode 100644 tests/error-messages/strict-warns-about-downcast.js create mode 100644 tests/error-messages/strict-warns-about-duck-downcast.js create mode 100644 tests/error-messages/strict-with-downcast-off-disallows-downcast.js create mode 100644 tests/error-messages/strict-with-downcast-off-disallows-duck-downcast.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index 2fe68ef..4f363fa 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -130,14 +130,6 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/strict-conditional-compilation.js") - [Test] def strict_disallows_downcast(): - RunTestCase("tests/error-messages/strict-disallows-downcast.js") - - - [Test] def strict_disallows_duck_downcast(): - RunTestCase("tests/error-messages/strict-disallows-duck-downcast.js") - - [Test] def strict_disallows_dynamic_dispatching(): RunTestCase("tests/error-messages/strict-disallows-dynamic-dispatching.js") @@ -150,6 +142,22 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/strict-nongeneric-GetComponent.js") + [Test] def strict_warns_about_downcast(): + RunTestCase("tests/error-messages/strict-warns-about-downcast.js") + + + [Test] def strict_warns_about_duck_downcast(): + RunTestCase("tests/error-messages/strict-warns-about-duck-downcast.js") + + + [Test] def strict_with_downcast_off_disallows_downcast(): + RunTestCase("tests/error-messages/strict-with-downcast-off-disallows-downcast.js") + + + [Test] def strict_with_downcast_off_disallows_duck_downcast(): + RunTestCase("tests/error-messages/strict-with-downcast-off-disallows-duck-downcast.js") + + [Test] def unused_variable(): RunTestCase("tests/error-messages/unused-variable.js") diff --git a/src/UnityScript/Core/Pragmas.boo b/src/UnityScript/Core/Pragmas.boo index c361b21..243e948 100644 --- a/src/UnityScript/Core/Pragmas.boo +++ b/src/UnityScript/Core/Pragmas.boo @@ -27,6 +27,9 @@ static class Pragmas: def IsEnabledOn(module as Module, pragma as string): return module[pragma] is Enabled + def IsDisabledOn(module as Module, pragma as string): + return module[pragma] is Disabled + def TryToEnableOn(module as Module, pragma as string): if module.ContainsAnnotation(pragma): return false diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index d1a1022..38e90ee 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -71,7 +71,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): return super(d) override def OnModule(module as Module): - preserving _activeModule, Parameters.Strict, _implicit, my(UnityDowncastPermissions).Enabled: + preserving _activeModule, Parameters.Strict, _implicit: EnterModuleContext(module) super(module) @@ -82,7 +82,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): super(node) return - preserving _activeModule, Parameters.Strict, _implicit, my(UnityDowncastPermissions).Enabled: + preserving _activeModule, Parameters.Strict, _implicit: EnterModuleContext(module) super(node) @@ -90,7 +90,13 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): _activeModule = module Parameters.Strict = Pragmas.IsEnabledOn(module, Pragmas.Strict) _implicit = Pragmas.IsEnabledOn(module, Pragmas.Implicit) - my(UnityDowncastPermissions).Enabled = Pragmas.IsEnabledOn(module, Pragmas.Downcast) + if Pragmas.IsDisabledOn(module, Pragmas.Downcast): + Parameters.DisableWarning(ImplicitDowncast) + else: + Parameters.EnableWarning(ImplicitDowncast) + + ImplicitDowncast: + get: return Boo.Lang.Compiler.CompilerWarningFactory.Codes.ImplicitDowncast _activeModule as Module diff --git a/src/UnityScript/TypeSystem/UnityDowncastPermissions.boo b/src/UnityScript/TypeSystem/UnityDowncastPermissions.boo index 844aaf4..7a2fbd5 100755 --- a/src/UnityScript/TypeSystem/UnityDowncastPermissions.boo +++ b/src/UnityScript/TypeSystem/UnityDowncastPermissions.boo @@ -5,16 +5,11 @@ import Boo.Lang.Compiler.TypeSystem.Services class UnityDowncastPermissions(DowncastPermissions): - [property(Enabled)] _enabled = false - override def CanBeReachedByDowncast(expectedType as IType, actualType as IType): if expectedType.IsArray and actualType.IsArray and IsDowncastAllowed(): return CanBeReachedByArrayDowncast(expectedType, actualType) return super(expectedType, actualType) - override protected def IsDowncastAllowed(): - return _enabled or super() - private def CanBeReachedByArrayDowncast(expectedType as IArrayType, actualType as IArrayType): return expectedType.Rank == actualType.Rank \ and CanBeReachedByDowncast(expectedType.ElementType, actualType.ElementType) diff --git a/tests/error-messages/strict-disallows-downcast.js b/tests/error-messages/strict-disallows-downcast.js deleted file mode 100644 index 00bfb19..0000000 --- a/tests/error-messages/strict-disallows-downcast.js +++ /dev/null @@ -1,13 +0,0 @@ -/* -strict-disallows-downcast.js(13,15): BCE0022: Cannot convert 'Foo' to 'Bar'. -*/ -#pragma strict - -class Foo { -} - -class Bar extends Foo { -} - -var foo:Foo = new Bar(); -var bar:Bar = foo; diff --git a/tests/error-messages/strict-disallows-duck-downcast.js b/tests/error-messages/strict-disallows-duck-downcast.js deleted file mode 100644 index c141613..0000000 --- a/tests/error-messages/strict-disallows-duck-downcast.js +++ /dev/null @@ -1,10 +0,0 @@ -/* -strict-disallows-duck-downcast.js(9,5): BCE0022: Cannot convert 'Object' to 'String'. -*/ - -#pragma strict - -var duck; -var s : String; -s = duck; -print(s); diff --git a/tests/error-messages/strict-warns-about-downcast.js b/tests/error-messages/strict-warns-about-downcast.js new file mode 100644 index 0000000..edb8dd9 --- /dev/null +++ b/tests/error-messages/strict-warns-about-downcast.js @@ -0,0 +1,18 @@ +/* +strict-warns-about-downcast.js(14,15): BCW0028: WARNING: Implicit downcast from 'Foo' to 'Bar'. +strict-warns-about-downcast.js(17,10): BCW0028: WARNING: Implicit downcast from 'Foo' to 'Bar'. +*/ +#pragma strict + +class Foo { +} + +class Bar extends Foo { +} + +var foo:Foo = new Bar(); +var bar:Bar = foo; +var foos:Foo[] = []; + +for (var b: Bar in foos) + print(b); diff --git a/tests/error-messages/strict-warns-about-duck-downcast.js b/tests/error-messages/strict-warns-about-duck-downcast.js new file mode 100644 index 0000000..2f54fae --- /dev/null +++ b/tests/error-messages/strict-warns-about-duck-downcast.js @@ -0,0 +1,10 @@ +/* +strict-warns-about-duck-downcast.js(9,5): BCW0028: WARNING: Implicit downcast from 'Object' to 'String'. +*/ + +#pragma strict + +var duck; +var s : String; +s = duck; +print(s); diff --git a/tests/error-messages/strict-with-downcast-off-disallows-downcast.js b/tests/error-messages/strict-with-downcast-off-disallows-downcast.js new file mode 100644 index 0000000..3570672 --- /dev/null +++ b/tests/error-messages/strict-with-downcast-off-disallows-downcast.js @@ -0,0 +1,14 @@ +/* +strict-with-downcast-off-disallows-downcast.js(14,15): BCE0022: Cannot convert 'Foo' to 'Bar'. +*/ +#pragma strict +#pragma downcast off + +class Foo { +} + +class Bar extends Foo { +} + +var foo:Foo = new Bar(); +var bar:Bar = foo; diff --git a/tests/error-messages/strict-with-downcast-off-disallows-duck-downcast.js b/tests/error-messages/strict-with-downcast-off-disallows-duck-downcast.js new file mode 100644 index 0000000..073333d --- /dev/null +++ b/tests/error-messages/strict-with-downcast-off-disallows-duck-downcast.js @@ -0,0 +1,11 @@ +/* +strict-with-downcast-off-disallows-duck-downcast.js(10,5): BCE0022: Cannot convert 'Object' to 'String'. +*/ + +#pragma strict +#pragma downcast off + +var duck; +var s : String; +s = duck; +print(s); From 5bd9b535627f58e07dce0bab6eb5681b2a79e40c Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 18 Aug 2011 11:12:22 -0300 Subject: [PATCH 177/276] prove array downcasts are reported as warnings in strict mode --- .../ErrorMessagesTestFixture.Generated.boo | 4 ++++ .../strict-warns-about-array-downcast.js | 10 ++++++++++ 2 files changed, 14 insertions(+) create mode 100644 tests/error-messages/strict-warns-about-array-downcast.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index 4f363fa..75d5889 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -142,6 +142,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/strict-nongeneric-GetComponent.js") + [Test] def strict_warns_about_array_downcast(): + RunTestCase("tests/error-messages/strict-warns-about-array-downcast.js") + + [Test] def strict_warns_about_downcast(): RunTestCase("tests/error-messages/strict-warns-about-downcast.js") diff --git a/tests/error-messages/strict-warns-about-array-downcast.js b/tests/error-messages/strict-warns-about-array-downcast.js new file mode 100644 index 0000000..0420312 --- /dev/null +++ b/tests/error-messages/strict-warns-about-array-downcast.js @@ -0,0 +1,10 @@ +/* +strict-warns-about-array-downcast.js(10,23): BCW0028: WARNING: Implicit downcast from 'Object[]' to 'String[]'. +*/ +#pragma strict + +function foo(): Object[] { + return new String[1]; +} + +var ss: String[] = foo(); From 99a1f57761bc8db7658424dea0ac8fa63de3c9af Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 18 Aug 2011 11:12:45 -0300 Subject: [PATCH 178/276] unnecessary else --- src/us/us.boo | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/us/us.boo b/src/us/us.boo index 6e79d11..bcc0f87 100755 --- a/src/us/us.boo +++ b/src/us/us.boo @@ -26,15 +26,16 @@ def getAssemblyAttribute(type as System.Type): def compile(options as CommandLineOptions): compiler = UnityScriptCompilerFactory.FromCommandLineOptions(options) results = compiler.Run() + if len(results.Errors): print results.Errors.ToString(options.Verbose) return 255 + + if options.Execute: + execute(results, options.MainMethod) else: - if options.Execute: - execute(results, options.MainMethod) - else: - print results.Warnings.ToString() if len(results.Warnings) - print "Successfully compiled '${len(compiler.Parameters.Input)}' file(s) to '${results.GeneratedAssemblyFileName}'." + print results.Warnings.ToString() if len(results.Warnings) + print "Successfully compiled '${len(compiler.Parameters.Input)}' file(s) to '${results.GeneratedAssemblyFileName}'." return 0 def execute(result as CompilerContext, mainMethod as string): From 1c0e9882b83caa1c2f38386a830017d173a10253 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 18 Aug 2011 11:27:17 -0300 Subject: [PATCH 179/276] more descriptive variable names --- .../Steps/ProcessUnityScriptMethods.boo | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index 38e90ee..cd3bb19 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -199,17 +199,20 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): Error(node) def ApplyImplicitArrayConversion(node as BinaryExpression): - left = GetExpressionType(node.Left) - if not left.IsArray: return + leftType = GetExpressionType(node.Left) + return unless leftType.IsArray - right = GetExpressionType(node.Right) - if right is not TypeSystemServices.Map(UnityScript.Lang.Array): return + rightType = GetExpressionType(node.Right) + return unless rightType is UnityScriptLangArray() - node.Right = CodeBuilder.CreateCast(left, + node.Right = CodeBuilder.CreateCast(leftType, CodeBuilder.CreateMethodInvocation( node.Right, - ResolveMethod(right, "ToBuiltin"), - CodeBuilder.CreateTypeofExpression(left.ElementType))) + ResolveMethod(rightType, "ToBuiltin"), + CodeBuilder.CreateTypeofExpression(leftType.ElementType))) + + def UnityScriptLangArray(): + return TypeSystemServices.Map(UnityScript.Lang.Array) override def OnForStatement(node as ForStatement): assert 1 == len(node.Declarations) From da28d077ad68c9e3d9d659f6477b6516a8d53884 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 18 Aug 2011 11:30:53 -0300 Subject: [PATCH 180/276] ensure warning settings always reflect the active module --- .../Steps/ProcessUnityScriptMethods.boo | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index cd3bb19..b6c732e 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -71,9 +71,8 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): return super(d) override def OnModule(module as Module): - preserving _activeModule, Parameters.Strict, _implicit: - EnterModuleContext(module) - super(module) + EnterModuleContext(module) + super(module) override def VisitMemberPreservingContext(node as TypeMember): @@ -82,23 +81,31 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): super(node) return - preserving _activeModule, Parameters.Strict, _implicit: + preserving Parameters.Strict, _implicit, ActiveModule: EnterModuleContext(module) super(node) private def EnterModuleContext(module as Module): - _activeModule = module Parameters.Strict = Pragmas.IsEnabledOn(module, Pragmas.Strict) - _implicit = Pragmas.IsEnabledOn(module, Pragmas.Implicit) - if Pragmas.IsDisabledOn(module, Pragmas.Downcast): - Parameters.DisableWarning(ImplicitDowncast) - else: - Parameters.EnableWarning(ImplicitDowncast) + _implicit = Pragmas.IsEnabledOn(module, Pragmas.Implicit) + ActiveModule = module ImplicitDowncast: get: return Boo.Lang.Compiler.CompilerWarningFactory.Codes.ImplicitDowncast + + ActiveModule: + get: return _activeModule + set: + _activeModule = value + UpdateWarningSettingsForActiveModule() + + def UpdateWarningSettingsForActiveModule(): + if Pragmas.IsDisabledOn(_activeModule, Pragmas.Downcast): + Parameters.DisableWarning(ImplicitDowncast) + else: + Parameters.EnableWarning(ImplicitDowncast) - _activeModule as Module + _activeModule as Module Strict: get: return Parameters.Strict From d0a5d73204441f5a5fb420dd034034b010f553c2 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 20 Aug 2011 10:23:17 -0300 Subject: [PATCH 181/276] only ever warn about implicit downcasts in strict mode --- src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo | 4 ++++ src/UnityScript/Steps/ProcessUnityScriptMethods.boo | 2 +- .../error-messages/non-strict-does-not-warn-about-downcast.js | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 tests/error-messages/non-strict-does-not-warn-about-downcast.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index 75d5889..eca764b 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -94,6 +94,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/nolinenumber.js") + [Test] def non_strict_does_not_warn_about_downcast(): + RunTestCase("tests/error-messages/non-strict-does-not-warn-about-downcast.js") + + [Test] def obsolete_2(): RunTestCase("tests/error-messages/obsolete-2.js") diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index b6c732e..58bafea 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -100,7 +100,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): UpdateWarningSettingsForActiveModule() def UpdateWarningSettingsForActiveModule(): - if Pragmas.IsDisabledOn(_activeModule, Pragmas.Downcast): + if not Parameters.Strict or Pragmas.IsDisabledOn(_activeModule, Pragmas.Downcast): Parameters.DisableWarning(ImplicitDowncast) else: Parameters.EnableWarning(ImplicitDowncast) diff --git a/tests/error-messages/non-strict-does-not-warn-about-downcast.js b/tests/error-messages/non-strict-does-not-warn-about-downcast.js new file mode 100644 index 0000000..a880887 --- /dev/null +++ b/tests/error-messages/non-strict-does-not-warn-about-downcast.js @@ -0,0 +1,4 @@ +/* +*/ +var o: Object = ""; +var s: String = o; From e80751b99bb713a66198850975a7d45ea17ab86d Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 20 Aug 2011 10:32:37 -0300 Subject: [PATCH 182/276] update build instructions --- README | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/README b/README index 8e05ddf..3065c56 100644 --- a/README +++ b/README @@ -1,22 +1,30 @@ -UnityScript -======== +# UnityScript # A JavaScript implementation based on the Boo programming language. -Building the MonoDevelop addin -======================= +## Building ## -Create a build.properties file and configure the md.bin.dir property to -point to the directory containing the MonoDevelop binaries. For instance: +Checkout boo side-by-side with unityscript. - - - +Build boo: + + pushd ../boo + nant + popd + +Build unityscript (and run the tests): + + nant test + +If the build script can't automatically detect the location of nunit.framework.dll +create a build.properties file in the boo directory with something like: + + ```xml + + + ''' -And then: - nant md -This will build and copy the required assemblies to ~/.config/MonoDevelop/addins/UnityScript. From f271611925679298b7925f3244d486a597032bbd Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 20 Aug 2011 10:33:37 -0300 Subject: [PATCH 183/276] readme uses markdown syntax --- README => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README => README.md (100%) diff --git a/README b/README.md similarity index 100% rename from README rename to README.md From cdf8eaf18da6f715ab463c0ff2bc51d51aceeb3f Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 20 Aug 2011 15:37:52 -0300 Subject: [PATCH 184/276] Edited README.md via GitHub --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3065c56..c4b2a09 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,14 @@ Build unityscript (and run the tests): If the build script can't automatically detect the location of nunit.framework.dll create a build.properties file in the boo directory with something like: - ```xml - - - - ''' +```xml + + + +``` + +With *nunit.framework.dll* pointing to the location of nunit.framework.dll in your system. + From e7264a58ad766e4f6fb503f5e072d11ed51a08bb Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Sat, 20 Aug 2011 11:01:32 -0300 Subject: [PATCH 185/276] don't emit implicit downcast warnings when #pragma downcast is in effect --- .../ErrorMessagesTestFixture.Generated.boo | 4 ++ .../Steps/ProcessUnityScriptMethods.boo | 41 ++++++++++--------- .../TypeSystem/UnityDowncastPermissions.boo | 5 +++ ...a-downcast-does-not-warn-about-downcast.js | 7 ++++ 4 files changed, 37 insertions(+), 20 deletions(-) create mode 100644 tests/error-messages/strict-with-pragma-downcast-does-not-warn-about-downcast.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index eca764b..df8ee59 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -166,6 +166,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/strict-with-downcast-off-disallows-duck-downcast.js") + [Test] def strict_with_pragma_downcast_does_not_warn_about_downcast(): + RunTestCase("tests/error-messages/strict-with-pragma-downcast-does-not-warn-about-downcast.js") + + [Test] def unused_variable(): RunTestCase("tests/error-messages/unused-variable.js") diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index 58bafea..2e87fae 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -71,42 +71,43 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): return super(d) override def OnModule(module as Module): - EnterModuleContext(module) + ActiveModule = module super(module) override def VisitMemberPreservingContext(node as TypeMember): module = node.EnclosingModule - if module is _activeModule: + if module is ActiveModule: super(node) return - preserving Parameters.Strict, _implicit, ActiveModule: - EnterModuleContext(module) + preserving ActiveModule: + ActiveModule = module super(node) - private def EnterModuleContext(module as Module): - Parameters.Strict = Pragmas.IsEnabledOn(module, Pragmas.Strict) - _implicit = Pragmas.IsEnabledOn(module, Pragmas.Implicit) - ActiveModule = module - - ImplicitDowncast: - get: return Boo.Lang.Compiler.CompilerWarningFactory.Codes.ImplicitDowncast - ActiveModule: get: return _activeModule set: - _activeModule = value - UpdateWarningSettingsForActiveModule() + _activeModule = value + UpdateSettingsForActiveModule() - def UpdateWarningSettingsForActiveModule(): - if not Parameters.Strict or Pragmas.IsDisabledOn(_activeModule, Pragmas.Downcast): + _activeModule as Module + + def UpdateSettingsForActiveModule(): + Parameters.Strict = Pragmas.IsEnabledOn(ActiveModule, Pragmas.Strict) + _implicit = Pragmas.IsEnabledOn(ActiveModule, Pragmas.Implicit) + my(UnityDowncastPermissions).Enabled = Pragmas.IsEnabledOn(ActiveModule, Pragmas.Downcast) + if ShouldDisableImplicitDowncastWarning(): Parameters.DisableWarning(ImplicitDowncast) else: - Parameters.EnableWarning(ImplicitDowncast) - - _activeModule as Module - + Parameters.EnableWarning(ImplicitDowncast) + + def ShouldDisableImplicitDowncastWarning(): + return not Parameters.Strict or ActiveModule.ContainsAnnotation(Pragmas.Downcast) + + ImplicitDowncast: + get: return Boo.Lang.Compiler.CompilerWarningFactory.Codes.ImplicitDowncast + Strict: get: return Parameters.Strict diff --git a/src/UnityScript/TypeSystem/UnityDowncastPermissions.boo b/src/UnityScript/TypeSystem/UnityDowncastPermissions.boo index 7a2fbd5..e8f5544 100755 --- a/src/UnityScript/TypeSystem/UnityDowncastPermissions.boo +++ b/src/UnityScript/TypeSystem/UnityDowncastPermissions.boo @@ -5,10 +5,15 @@ import Boo.Lang.Compiler.TypeSystem.Services class UnityDowncastPermissions(DowncastPermissions): + property Enabled = false + override def CanBeReachedByDowncast(expectedType as IType, actualType as IType): if expectedType.IsArray and actualType.IsArray and IsDowncastAllowed(): return CanBeReachedByArrayDowncast(expectedType, actualType) return super(expectedType, actualType) + + override def IsDowncastAllowed(): + return Enabled or super() private def CanBeReachedByArrayDowncast(expectedType as IArrayType, actualType as IArrayType): return expectedType.Rank == actualType.Rank \ diff --git a/tests/error-messages/strict-with-pragma-downcast-does-not-warn-about-downcast.js b/tests/error-messages/strict-with-pragma-downcast-does-not-warn-about-downcast.js new file mode 100644 index 0000000..2bee619 --- /dev/null +++ b/tests/error-messages/strict-with-pragma-downcast-does-not-warn-about-downcast.js @@ -0,0 +1,7 @@ +/* +*/ +#pragma strict +#pragma downcast + +var o: Object = ""; +var s: String = o; From d7d11f053b2b98c2fa108772d901d7038ba9dea8 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 22 Aug 2011 14:22:20 +0200 Subject: [PATCH 186/276] static evaluation domain provider must be public so it can be accessed by the dynamic eval assemblies --- src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo diff --git a/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo b/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo old mode 100644 new mode 100755 index fdb2fa1..164c84c --- a/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo +++ b/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo @@ -45,7 +45,7 @@ class EvaluationDomainProviderImplementor(AbstractCompilerComponent): private def CreateStaticEvaluationDomainProviderReferenceOn(node as ClassDefinition): evaluationDomainProviderImpl = [| - internal class StaticEvaluationDomainProvider($SimpleEvaluationDomainProvider): + public class StaticEvaluationDomainProvider($SimpleEvaluationDomainProvider): public static final Instance = StaticEvaluationDomainProvider() From 854bdbd8868188ca801c5e0ebfc1effdbd668adb Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 25 Aug 2011 11:44:43 -0300 Subject: [PATCH 187/276] better handling of empty switch statements - warning instead of cryptic index out of range error --- .../ErrorMessagesTestFixture.Generated.boo | 4 ++++ src/UnityScript/Macros/SwitchMacro.boo | 13 ++++++++++--- tests/error-messages/switch-has-no-cases.js | 7 +++++++ 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 tests/error-messages/switch-has-no-cases.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index df8ee59..b3c36e0 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -170,6 +170,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/strict-with-pragma-downcast-does-not-warn-about-downcast.js") + [Test] def switch_has_no_cases(): + RunTestCase("tests/error-messages/switch-has-no-cases.js") + + [Test] def unused_variable(): RunTestCase("tests/error-messages/unused-variable.js") diff --git a/src/UnityScript/Macros/SwitchMacro.boo b/src/UnityScript/Macros/SwitchMacro.boo index 0cf96cf..a193807 100755 --- a/src/UnityScript/Macros/SwitchMacro.boo +++ b/src/UnityScript/Macros/SwitchMacro.boo @@ -13,7 +13,14 @@ class DefaultStatement(CustomStatement): macro switch: - assert len(switch.Arguments) == 1 + if len(switch.Arguments) != 1: + Errors.Add(CompilerErrorFactory.CustomError(switch, "switch requires an expression.")) + return null + + statements = switch.Body.Statements + if len(statements) == 0: + Warnings.Add(CompilerWarningFactory.CustomWarning(switch, "switch statement has no cases.")) + return null macro case: return CaseStatement(Expressions: case.Arguments, Body: case.Body) @@ -36,8 +43,8 @@ macro switch: passThrough as LabelStatement - lastItem = switch.Body.Statements[-1] - for item in switch.Body.Statements: + lastItem = statements[-1] + for item in statements: match item: case CaseStatement(Expressions: expressions, Body: body): diff --git a/tests/error-messages/switch-has-no-cases.js b/tests/error-messages/switch-has-no-cases.js new file mode 100644 index 0000000..f23afb5 --- /dev/null +++ b/tests/error-messages/switch-has-no-cases.js @@ -0,0 +1,7 @@ +/* +switch-has-no-cases.js(5,9): BCW0000: WARNING: switch statement has no cases. +*/ +function foo(f) { + switch (f) { + } +} From d6c58dbe50c21f34f56ed4cb425d09e38b8df1de Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 1 Sep 2011 11:19:22 -0300 Subject: [PATCH 188/276] use a fresh ReflectionTypeSystemProvider for each compilation request --- src/UnityScript/UnityScriptCompilerParameters.boo | 1 + 1 file changed, 1 insertion(+) diff --git a/src/UnityScript/UnityScriptCompilerParameters.boo b/src/UnityScript/UnityScriptCompilerParameters.boo index 57b4a2d..d471b16 100755 --- a/src/UnityScript/UnityScriptCompilerParameters.boo +++ b/src/UnityScript/UnityScriptCompilerParameters.boo @@ -23,6 +23,7 @@ class UnityScriptCompilerParameters(CompilerParameters): property DisableEval as string def constructor(): + super(Boo.Lang.Compiler.TypeSystem.Reflection.ReflectionTypeSystemProvider()) self.OutputType = CompilerOutputType.Library self.References.Add(typeof(UnityScript.Lang.Array).Assembly) self.References.Add(GetType().Assembly) From 1805119197db54b07bd5bdb466cb48fc1eff002b Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 2 Sep 2011 14:30:27 -0300 Subject: [PATCH 189/276] ability to have the lexer preserve single line comment tokens --- src/UnityScript/Parser/UnityScriptLexer.boo | 240 +++++++++--------- src/UnityScript/Parser/UnityScriptParser.boo | 240 +++++++++--------- .../Parser/UnityScriptTokenTypes.boo | 135 +++++----- .../Parser/UnityScriptTokenTypes.txt | 135 +++++----- 4 files changed, 380 insertions(+), 370 deletions(-) diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index e0f90f1..5a2d01a 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -82,74 +82,77 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): public static final INPLACE_ADD = 51 public static final INPLACE_SUBTRACT = 52 public static final INPLACE_MULTIPLY = 53 - public static final PRAGMA_ON = 54 - public static final PRAGMA_OFF = 55 - public static final ID = 56 - public static final DOUBLE_QUOTED_STRING = 57 - public static final LBRACE = 58 - public static final RBRACE = 59 - public static final LPAREN = 60 - public static final RPAREN = 61 - public static final DOT = 62 - public static final COLON = 63 - public static final COMMA = 64 - public static final LBRACK = 65 - public static final RBRACK = 66 - public static final BITWISE_OR = 67 - public static final INPLACE_BITWISE_OR = 68 - public static final BITWISE_AND = 69 - public static final BITWISE_XOR = 70 - public static final INPLACE_BITWISE_AND = 71 - public static final LOGICAL_OR = 72 - public static final LOGICAL_AND = 73 - public static final EOS = 74 - public static final ASSIGN = 75 - public static final INCREMENT = 76 - public static final DECREMENT = 77 - public static final ADD = 78 - public static final SUBTRACT = 79 - public static final MODULUS = 80 - public static final MULTIPLY = 81 - public static final EQUALITY = 82 - public static final INEQUALITY = 83 - public static final QUESTION_MARK = 84 - public static final BITWISE_NOT = 85 - public static final REFERENCE_EQUALITY = 86 - public static final REFERENCE_INEQUALITY = 87 - public static final LESS_THAN = 88 - public static final LESS_THAN_OR_EQUAL = 89 - public static final SHIFT_LEFT = 90 - public static final INPLACE_SHIFT_LEFT = 91 - public static final GREATER_THAN = 92 - public static final GREATER_THAN_OR_EQUAL = 93 - public static final SHIFT_RIGHT = 94 - public static final INPLACE_SHIFT_RIGHT = 95 - public static final AT = 96 - public static final SCRIPT_ATTRIBUTE_MARKER = 97 - public static final ASSEMBLY_ATTRIBUTE_MARKER = 98 - public static final INPLACE_BITWISE_XOR = 99 - public static final NOT = 100 - public static final DIVISION = 101 - public static final RE_LITERAL = 102 - public static final DOUBLE = 103 - public static final INT = 104 - public static final LONG = 105 - public static final SINGLE_QUOTED_STRING = 106 - public static final DOUBLE_SUFFIX = 107 - public static final EXPONENT = 108 - public static final PRAGMA_WHITE_SPACE = 109 - public static final WHITE_SPACE = 110 - public static final DQS_ESC = 111 - public static final SQS_ESC = 112 - public static final SESC = 113 - public static final ML_COMMENT = 114 - public static final RE_CHAR = 115 - public static final RE_ESC = 116 - public static final NEWLINE = 117 - public static final ID_LETTER = 118 - public static final DIGIT = 119 - public static final HEXDIGIT = 120 - + public static final SL_COMMENT = 54 + public static final PRAGMA_ON = 55 + public static final PRAGMA_OFF = 56 + public static final ID = 57 + public static final DOUBLE_QUOTED_STRING = 58 + public static final LBRACE = 59 + public static final RBRACE = 60 + public static final LPAREN = 61 + public static final RPAREN = 62 + public static final DOT = 63 + public static final COLON = 64 + public static final COMMA = 65 + public static final LBRACK = 66 + public static final RBRACK = 67 + public static final BITWISE_OR = 68 + public static final INPLACE_BITWISE_OR = 69 + public static final BITWISE_AND = 70 + public static final BITWISE_XOR = 71 + public static final INPLACE_BITWISE_AND = 72 + public static final LOGICAL_OR = 73 + public static final LOGICAL_AND = 74 + public static final EOS = 75 + public static final ASSIGN = 76 + public static final INCREMENT = 77 + public static final DECREMENT = 78 + public static final ADD = 79 + public static final SUBTRACT = 80 + public static final MODULUS = 81 + public static final MULTIPLY = 82 + public static final EQUALITY = 83 + public static final INEQUALITY = 84 + public static final QUESTION_MARK = 85 + public static final BITWISE_NOT = 86 + public static final REFERENCE_EQUALITY = 87 + public static final REFERENCE_INEQUALITY = 88 + public static final LESS_THAN = 89 + public static final LESS_THAN_OR_EQUAL = 90 + public static final SHIFT_LEFT = 91 + public static final INPLACE_SHIFT_LEFT = 92 + public static final GREATER_THAN = 93 + public static final GREATER_THAN_OR_EQUAL = 94 + public static final SHIFT_RIGHT = 95 + public static final INPLACE_SHIFT_RIGHT = 96 + public static final AT = 97 + public static final SCRIPT_ATTRIBUTE_MARKER = 98 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 99 + public static final INPLACE_BITWISE_XOR = 100 + public static final NOT = 101 + public static final DIVISION = 102 + public static final RE_LITERAL = 103 + public static final DOUBLE = 104 + public static final INT = 105 + public static final LONG = 106 + public static final SINGLE_QUOTED_STRING = 107 + public static final DOUBLE_SUFFIX = 108 + public static final EXPONENT = 109 + public static final PRAGMA_WHITE_SPACE = 110 + public static final WHITE_SPACE = 111 + public static final DQS_ESC = 112 + public static final SQS_ESC = 113 + public static final SESC = 114 + public static final ML_COMMENT = 115 + public static final RE_CHAR = 116 + public static final RE_ESC = 117 + public static final NEWLINE = 118 + public static final ID_LETTER = 119 + public static final DIGIT = 120 + public static final HEXDIGIT = 121 + + + property PreserveComments = false static def IsDigit(ch as char): return ch >= char('0') and ch <= char('9') @@ -170,101 +173,102 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): caseSensitiveLiterals = true setCaseSensitive(true) literals = Hashtable(100, 0.4, null, Comparer.Default) - literals.Add(",", 64) + literals.Add(",", 65) literals.Add("public", 29) - literals.Add("a string", 57) - literals.Add("an identifier", 56) - literals.Add("]", 66) + literals.Add("a string", 58) + literals.Add("an identifier", 57) + literals.Add("]", 67) literals.Add("case", 48) literals.Add("break", 5) literals.Add("while", 45) literals.Add("new", 26) - literals.Add("||", 72) - literals.Add("+", 78) + literals.Add("||", 73) + literals.Add("+", 79) literals.Add("instanceof", 25) literals.Add("implements", 22) - literals.Add("*", 81) - literals.Add("|=", 68) + literals.Add("*", 82) + literals.Add("|=", 69) literals.Add("typeof", 42) - literals.Add("@assembly", 98) - literals.Add("[", 65) - literals.Add(">>=", 95) + literals.Add("@assembly", 99) + literals.Add("[", 66) + literals.Add(">>=", 96) literals.Add("return", 28) literals.Add("throw", 39) literals.Add("var", 43) - literals.Add(")", 61) - literals.Add("==", 82) + literals.Add(")", 62) + literals.Add("==", 83) literals.Add("null", 27) literals.Add("protected", 30) - literals.Add("pragma off", 55) - literals.Add("@script", 97) + literals.Add("pragma off", 56) + literals.Add("@script", 98) literals.Add("class", 8) - literals.Add("(", 60) + literals.Add("(", 61) literals.Add("do", 10) - literals.Add("~", 85) + literals.Add("~", 86) literals.Add("function", 18) literals.Add("/=", 50) literals.Add("super", 37) - literals.Add("@", 96) + literals.Add("@", 97) literals.Add("-=", 52) literals.Add("set", 35) literals.Add("+=", 51) - literals.Add("!==", 87) - literals.Add("}", 59) + literals.Add("!==", 88) + literals.Add("}", 60) literals.Add("interface", 24) - literals.Add("?", 84) - literals.Add("&", 69) + literals.Add("?", 85) + literals.Add("&", 70) literals.Add("internal", 31) literals.Add("final", 15) literals.Add("yield", 46) - literals.Add("!=", 83) - literals.Add("===", 86) + literals.Add("!=", 84) + literals.Add("//", 54) + literals.Add("===", 87) literals.Add("if", 20) - literals.Add("|", 67) + literals.Add("|", 68) literals.Add("override", 32) - literals.Add(">", 92) + literals.Add(">", 93) literals.Add("as", 4) - literals.Add("%", 80) + literals.Add("%", 81) literals.Add("catch", 7) literals.Add("try", 41) - literals.Add("{", 58) - literals.Add("=", 75) + literals.Add("{", 59) + literals.Add("=", 76) literals.Add("enum", 12) literals.Add("for", 17) - literals.Add(">>", 94) + literals.Add(">>", 95) literals.Add("extends", 13) literals.Add("private", 34) literals.Add("default", 49) - literals.Add("--", 77) - literals.Add("<", 88) + literals.Add("--", 78) + literals.Add("<", 89) literals.Add("false", 14) literals.Add("this", 38) literals.Add("static", 36) - literals.Add(">=", 93) - literals.Add("<=", 89) + literals.Add(">=", 94) + literals.Add("<=", 90) literals.Add("partial", 33) - literals.Add(";", 74) + literals.Add(";", 75) literals.Add("get", 19) - literals.Add("<<=", 91) + literals.Add("<<=", 92) literals.Add("continue", 9) - literals.Add("&&", 73) + literals.Add("&&", 74) literals.Add("cast", 6) - literals.Add("<<", 90) - literals.Add("pragma on", 54) - literals.Add(".", 62) + literals.Add("<<", 91) + literals.Add("pragma on", 55) + literals.Add(".", 63) literals.Add("finally", 16) literals.Add("else", 11) literals.Add("import", 21) - literals.Add("++", 76) - literals.Add(":", 63) + literals.Add("++", 77) + literals.Add(":", 64) literals.Add("in", 23) literals.Add("switch", 47) literals.Add("true", 40) - literals.Add("-", 79) + literals.Add("-", 80) literals.Add("*=", 53) literals.Add("virtual", 44) - literals.Add("^", 70) - literals.Add("&=", 71) + literals.Add("^", 71) + literals.Add("&=", 72) override def nextToken() as IToken: theRetToken as IToken @@ -1460,7 +1464,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if synPredMatched396: mML_COMMENT(false) if 0 == inputState.guessing: - _ttype = Token.SKIP; + if not PreserveComments: + _ttype = Token.SKIP elif ((cached_LA1==char('/')) and (true)): // line 2102 match('/') _givenValue = cached_LA1 @@ -1473,7 +1478,10 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): goto _loop401_breakloop :_loop401_breakloop if 0 == inputState.guessing: - _ttype = Token.SKIP; + if PreserveComments: + _ttype = SL_COMMENT + else: + _ttype = Token.SKIP; elif ((_givenValue == char('='))): // 1831 match('=') if 0 == inputState.guessing: @@ -1503,8 +1511,6 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): goto _loop430_breakloop :_loop430_breakloop match("*/") - if 0 == inputState.guessing: - _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 19c1dbc..83b038f 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -80,73 +80,74 @@ class UnityScriptParser(antlr.LLkParser): public static final INPLACE_ADD = 51 public static final INPLACE_SUBTRACT = 52 public static final INPLACE_MULTIPLY = 53 - public static final PRAGMA_ON = 54 - public static final PRAGMA_OFF = 55 - public static final ID = 56 - public static final DOUBLE_QUOTED_STRING = 57 - public static final LBRACE = 58 - public static final RBRACE = 59 - public static final LPAREN = 60 - public static final RPAREN = 61 - public static final DOT = 62 - public static final COLON = 63 - public static final COMMA = 64 - public static final LBRACK = 65 - public static final RBRACK = 66 - public static final BITWISE_OR = 67 - public static final INPLACE_BITWISE_OR = 68 - public static final BITWISE_AND = 69 - public static final BITWISE_XOR = 70 - public static final INPLACE_BITWISE_AND = 71 - public static final LOGICAL_OR = 72 - public static final LOGICAL_AND = 73 - public static final EOS = 74 - public static final ASSIGN = 75 - public static final INCREMENT = 76 - public static final DECREMENT = 77 - public static final ADD = 78 - public static final SUBTRACT = 79 - public static final MODULUS = 80 - public static final MULTIPLY = 81 - public static final EQUALITY = 82 - public static final INEQUALITY = 83 - public static final QUESTION_MARK = 84 - public static final BITWISE_NOT = 85 - public static final REFERENCE_EQUALITY = 86 - public static final REFERENCE_INEQUALITY = 87 - public static final LESS_THAN = 88 - public static final LESS_THAN_OR_EQUAL = 89 - public static final SHIFT_LEFT = 90 - public static final INPLACE_SHIFT_LEFT = 91 - public static final GREATER_THAN = 92 - public static final GREATER_THAN_OR_EQUAL = 93 - public static final SHIFT_RIGHT = 94 - public static final INPLACE_SHIFT_RIGHT = 95 - public static final AT = 96 - public static final SCRIPT_ATTRIBUTE_MARKER = 97 - public static final ASSEMBLY_ATTRIBUTE_MARKER = 98 - public static final INPLACE_BITWISE_XOR = 99 - public static final NOT = 100 - public static final DIVISION = 101 - public static final RE_LITERAL = 102 - public static final DOUBLE = 103 - public static final INT = 104 - public static final LONG = 105 - public static final SINGLE_QUOTED_STRING = 106 - public static final DOUBLE_SUFFIX = 107 - public static final EXPONENT = 108 - public static final PRAGMA_WHITE_SPACE = 109 - public static final WHITE_SPACE = 110 - public static final DQS_ESC = 111 - public static final SQS_ESC = 112 - public static final SESC = 113 - public static final ML_COMMENT = 114 - public static final RE_CHAR = 115 - public static final RE_ESC = 116 - public static final NEWLINE = 117 - public static final ID_LETTER = 118 - public static final DIGIT = 119 - public static final HEXDIGIT = 120 + public static final SL_COMMENT = 54 + public static final PRAGMA_ON = 55 + public static final PRAGMA_OFF = 56 + public static final ID = 57 + public static final DOUBLE_QUOTED_STRING = 58 + public static final LBRACE = 59 + public static final RBRACE = 60 + public static final LPAREN = 61 + public static final RPAREN = 62 + public static final DOT = 63 + public static final COLON = 64 + public static final COMMA = 65 + public static final LBRACK = 66 + public static final RBRACK = 67 + public static final BITWISE_OR = 68 + public static final INPLACE_BITWISE_OR = 69 + public static final BITWISE_AND = 70 + public static final BITWISE_XOR = 71 + public static final INPLACE_BITWISE_AND = 72 + public static final LOGICAL_OR = 73 + public static final LOGICAL_AND = 74 + public static final EOS = 75 + public static final ASSIGN = 76 + public static final INCREMENT = 77 + public static final DECREMENT = 78 + public static final ADD = 79 + public static final SUBTRACT = 80 + public static final MODULUS = 81 + public static final MULTIPLY = 82 + public static final EQUALITY = 83 + public static final INEQUALITY = 84 + public static final QUESTION_MARK = 85 + public static final BITWISE_NOT = 86 + public static final REFERENCE_EQUALITY = 87 + public static final REFERENCE_INEQUALITY = 88 + public static final LESS_THAN = 89 + public static final LESS_THAN_OR_EQUAL = 90 + public static final SHIFT_LEFT = 91 + public static final INPLACE_SHIFT_LEFT = 92 + public static final GREATER_THAN = 93 + public static final GREATER_THAN_OR_EQUAL = 94 + public static final SHIFT_RIGHT = 95 + public static final INPLACE_SHIFT_RIGHT = 96 + public static final AT = 97 + public static final SCRIPT_ATTRIBUTE_MARKER = 98 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 99 + public static final INPLACE_BITWISE_XOR = 100 + public static final NOT = 101 + public static final DIVISION = 102 + public static final RE_LITERAL = 103 + public static final DOUBLE = 104 + public static final INT = 105 + public static final LONG = 106 + public static final SINGLE_QUOTED_STRING = 107 + public static final DOUBLE_SUFFIX = 108 + public static final EXPONENT = 109 + public static final PRAGMA_WHITE_SPACE = 110 + public static final WHITE_SPACE = 111 + public static final DQS_ESC = 112 + public static final SQS_ESC = 113 + public static final SESC = 114 + public static final ML_COMMENT = 115 + public static final RE_CHAR = 116 + public static final RE_ESC = 117 + public static final NEWLINE = 118 + public static final ID_LETTER = 119 + public static final DIGIT = 120 + public static final HEXDIGIT = 121 [property(CompilerContext)] @@ -4428,6 +4429,7 @@ class UnityScriptParser(antlr.LLkParser): '+=', '-=', '*=', + '//', 'pragma on', 'pragma off', 'an identifier', @@ -4502,15 +4504,15 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_0_ = BitSet(mk_tokenSet_0_()) private static def mk_tokenSet_1_() as (long): - data = (72084080581447936L, 0L, ) + data = (144141674619375872L, 0L, ) return data public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) private static def mk_tokenSet_2_() as (long): - data = (1657588408695277088L, 8589936735234L, 0L, 0L, ) + data = (3314913071567619616L, 17179873470468L, 0L, 0L, ) return data public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) private static def mk_tokenSet_3_() as (long): - data = (6862641368520906610L, 8770323218430L, 0L, 0L, ) + data = (-4738631271585491086L, 17540646436860L, 0L, 0L, ) return data public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) private static def mk_tokenSet_4_() as (long): @@ -4518,15 +4520,15 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) private static def mk_tokenSet_5_() as (long): - data = (1711649294676055842L, 8594231702530L, 0L, 0L, ) + data = (3423017153076844322L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) private static def mk_tokenSet_6_() as (long): - data = (1657606099145512738L, 8594231702530L, 0L, 0L, ) + data = (3314930762017855266L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) private static def mk_tokenSet_7_() as (long): - data = (72084084943524096L, 0L, ) + data = (144141678981452032L, 0L, ) return data public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) private static def mk_tokenSet_8_() as (long): @@ -4534,7 +4536,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_8_ = BitSet(mk_tokenSet_8_()) private static def mk_tokenSet_9_() as (long): - data = (72084071974469632L, 0L, ) + data = (144141666012397568L, 0L, ) return data public static final tokenSet_9_ = BitSet(mk_tokenSet_9_()) private static def mk_tokenSet_10_() as (long): @@ -4542,51 +4544,51 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_10_ = BitSet(mk_tokenSet_10_()) private static def mk_tokenSet_11_() as (long): - data = (72075284488425728L, 0L, ) + data = (144132878526353664L, 0L, ) return data public static final tokenSet_11_ = BitSet(mk_tokenSet_11_()) private static def mk_tokenSet_12_() as (long): - data = (2234911276379135906L, 8594231702530L, 0L, 0L, ) + data = (4468696691554901922L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_12_ = BitSet(mk_tokenSet_12_()) private static def mk_tokenSet_13_() as (long): - data = (1657330572948946944L, 8589936734210L, 0L, 0L, ) + data = (3314655235821289472L, 17179873468420L, 0L, 0L, ) return data public static final tokenSet_13_ = BitSet(mk_tokenSet_13_()) private static def mk_tokenSet_14_() as (long): - data = (9151320352935395408L, 8729386808175L, 0L, 0L, ) + data = (-144109277957308336L, 17458773616350L, 0L, 0L, ) return data public static final tokenSet_14_ = BitSet(mk_tokenSet_14_()) private static def mk_tokenSet_15_() as (long): - data = (2305843009213693952L, 1L, 0L, 0L, ) + data = (4611686018427387904L, 2L, 0L, 0L, ) return data public static final tokenSet_15_ = BitSet(mk_tokenSet_15_()) private static def mk_tokenSet_16_() as (long): - data = (1152921504606846976L, 2048L, 0L, 0L, ) + data = (2305843009213693952L, 4096L, 0L, 0L, ) return data public static final tokenSet_16_ = BitSet(mk_tokenSet_16_()) private static def mk_tokenSet_17_() as (long): - data = (-54043229895008270L, 8770323218431L, 0L, 0L, ) + data = (-126100823932936206L, 17540646436863L, 0L, 0L, ) return data public static final tokenSet_17_ = BitSet(mk_tokenSet_17_()) private static def mk_tokenSet_18_() as (long): - data = (72084084943524096L, 4294967296L, 0L, 0L, ) + data = (144141678981452032L, 8589934592L, 0L, 0L, ) return data public static final tokenSet_18_ = BitSet(mk_tokenSet_18_()) private static def mk_tokenSet_19_() as (long): - data = (3963173582162640896L, 8589936734210L, 0L, 0L, ) + data = (7926341254248677376L, 17179873468420L, 0L, 0L, ) return data public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) private static def mk_tokenSet_20_() as (long): - data = (1657606103440480034L, 8594231702530L, 0L, 0L, ) + data = (3314930766312822562L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) private static def mk_tokenSet_21_() as (long): - data = (-54887620464945294L, 8770323218431L, 0L, 0L, ) + data = (-126945214502873230L, 17540646436863L, 0L, 0L, ) return data public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) private static def mk_tokenSet_22_() as (long): - data = (-34360270862L, 8770323218431L, 0L, 0L, ) + data = (-18014432869752846L, 17540646436863L, 0L, 0L, ) return data public static final tokenSet_22_ = BitSet(mk_tokenSet_22_()) private static def mk_tokenSet_23_() as (long): @@ -4594,15 +4596,15 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_23_ = BitSet(mk_tokenSet_23_()) private static def mk_tokenSet_24_() as (long): - data = (2288954476204646306L, 8594231702530L, 0L, 0L, ) + data = (4576783086908858274L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_24_ = BitSet(mk_tokenSet_24_()) private static def mk_tokenSet_25_() as (long): - data = (-4202510L, 8770323218431L, 0L, 0L, ) + data = (-18014398513684494L, 17540646436863L, 0L, 0L, ) return data public static final tokenSet_25_ = BitSet(mk_tokenSet_25_()) private static def mk_tokenSet_26_() as (long): - data = (26490905596160L, 4294967296L, 0L, 0L, ) + data = (26490905596160L, 8589934592L, 0L, 0L, ) return data public static final tokenSet_26_ = BitSet(mk_tokenSet_26_()) private static def mk_tokenSet_27_() as (long): @@ -4610,123 +4612,123 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_27_ = BitSet(mk_tokenSet_27_()) private static def mk_tokenSet_28_() as (long): - data = (72084119303786752L, 0L, ) + data = (144141713341714688L, 0L, ) return data public static final tokenSet_28_ = BitSet(mk_tokenSet_28_()) private static def mk_tokenSet_29_() as (long): - data = (72057630545707264L, 0L, ) + data = (144115224583635200L, 0L, ) return data public static final tokenSet_29_ = BitSet(mk_tokenSet_29_()) private static def mk_tokenSet_30_() as (long): - data = (2234066855743903522L, 8594231702530L, 0L, 0L, ) + data = (4467852270919669538L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) private static def mk_tokenSet_31_() as (long): - data = (-54043229890813966L, 8770323218431L, 0L, 0L, ) + data = (-126100823928741902L, 17540646436863L, 0L, 0L, ) return data public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) private static def mk_tokenSet_32_() as (long): - data = (-54043195530551310L, 8770323218431L, 0L, 0L, ) + data = (-126100789568479246L, 17540646436863L, 0L, 0L, ) return data public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) private static def mk_tokenSet_33_() as (long): - data = (288230376151711744L, 268435456L, 0L, 0L, ) + data = (576460752303423488L, 536870912L, 0L, 0L, ) return data public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) private static def mk_tokenSet_34_() as (long): - data = (576487243209019648L, 4294967296L, 0L, 0L, ) + data = (1152947995512443136L, 8589934592L, 0L, 0L, ) return data public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) private static def mk_tokenSet_35_() as (long): - data = (576460752303685632L, 4294967296L, 0L, 0L, ) + data = (1152921504607109120L, 8589934592L, 0L, 0L, ) return data public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) private static def mk_tokenSet_36_() as (long): - data = (2305843009213693952L, 0L, ) + data = (4611686018427387904L, 0L, ) return data public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) private static def mk_tokenSet_37_() as (long): - data = (576460752303423488L, 1L, 0L, 0L, ) + data = (1152921504606846976L, 2L, 0L, 0L, ) return data public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) private static def mk_tokenSet_38_() as (long): - data = (-4682617746958590046L, 8594231704579L, 0L, 0L, ) + data = (9080382714285645730L, 17188463409159L, 0L, 0L, ) return data public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) private static def mk_tokenSet_39_() as (long): - data = (2234911280674103202L, 8594231702530L, 0L, 0L, ) + data = (4468696695849869218L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) private static def mk_tokenSet_40_() as (long): - data = (2234049160998700576L, 8589936735234L, 0L, 0L, ) + data = (4467834576174466592L, 17179873470468L, 0L, 0L, ) return data public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) private static def mk_tokenSet_41_() as (long): - data = (6863485793451106290L, 8770323218430L, 0L, 0L, ) + data = (-4737786846655291406L, 17540646436860L, 0L, 0L, ) return data public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) private static def mk_tokenSet_42_() as (long): - data = (72066392278466560L, 0L, ) + data = (144123986316394496L, 0L, ) return data public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) private static def mk_tokenSet_43_() as (long): - data = (72057596193832960L, 0L, ) + data = (144115190231760896L, 0L, ) return data public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) private static def mk_tokenSet_44_() as (long): - data = (1657339369041969152L, 8589936735234L, 0L, 0L, ) + data = (3314664031914311680L, 17179873470468L, 0L, 0L, ) return data public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) private static def mk_tokenSet_45_() as (long): - data = (6862365844471857232L, 8766028251134L, 0L, 0L, ) + data = (-4738906795634540464L, 17532056502268L, 0L, 0L, ) return data public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) private static def mk_tokenSet_46_() as (long): - data = (6846597294848466930L, 8733681776494L, 0L, 0L, ) + data = (-4754675345257930766L, 17467363552988L, 0L, 0L, ) return data public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) private static def mk_tokenSet_47_() as (long): - data = (2234911276387524514L, 8594231704578L, 0L, 0L, ) + data = (4468696691563290530L, 17188463409156L, 0L, 0L, ) return data public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) private static def mk_tokenSet_48_() as (long): - data = (4540754285592829858L, 8594231702530L, 0L, 0L, ) + data = (9080382709982289826L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) private static def mk_tokenSet_49_() as (long): - data = (-54043195534745614L, 8770323218431L, 0L, 0L, ) + data = (-126100789572673550L, 17540646436863L, 0L, 0L, ) return data public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) private static def mk_tokenSet_50_() as (long): - data = (2305843009213693952L, 4L, 0L, 0L, ) + data = (4611686018427387904L, 8L, 0L, 0L, ) return data public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) private static def mk_tokenSet_51_() as (long): - data = (0L, 5L, 0L, 0L, ) + data = (0L, 10L, 0L, 0L, ) return data public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) private static def mk_tokenSet_52_() as (long): - data = (-7566041463905828864L, 8589936734210L, 0L, 0L, ) + data = (3314655235821289472L, 17179873468421L, 0L, 0L, ) return data public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) private static def mk_tokenSet_53_() as (long): - data = (72057628398190592L, 16777216L, 0L, 0L, ) + data = (144115222436118528L, 33554432L, 0L, 0L, ) return data public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) private static def mk_tokenSet_54_() as (long): - data = (41943040L, 855638016L, 0L, 0L, ) + data = (41943040L, 1711276032L, 0L, 0L, ) return data public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) private static def mk_tokenSet_55_() as (long): - data = (0L, 13369344L, 0L, 0L, ) + data = (0L, 26738688L, 0L, 0L, ) return data public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) private static def mk_tokenSet_56_() as (long): - data = (6845477343721832528L, 8729386808174L, 0L, 0L, ) + data = (-4755795296384565168L, 17458773616348L, 0L, 0L, ) return data public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) private static def mk_tokenSet_57_() as (long): - data = (1657330572948946944L, 8589936734214L, 0L, 0L, ) + data = (3314655235821289472L, 17179873468428L, 0L, 0L, ) return data public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.boo b/src/UnityScript/Parser/UnityScriptTokenTypes.boo index 7a2cf28..34e5f3c 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.boo +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.boo @@ -54,71 +54,72 @@ class UnityScriptTokenTypes: public static final INPLACE_ADD = 51 public static final INPLACE_SUBTRACT = 52 public static final INPLACE_MULTIPLY = 53 - public static final PRAGMA_ON = 54 - public static final PRAGMA_OFF = 55 - public static final ID = 56 - public static final DOUBLE_QUOTED_STRING = 57 - public static final LBRACE = 58 - public static final RBRACE = 59 - public static final LPAREN = 60 - public static final RPAREN = 61 - public static final DOT = 62 - public static final COLON = 63 - public static final COMMA = 64 - public static final LBRACK = 65 - public static final RBRACK = 66 - public static final BITWISE_OR = 67 - public static final INPLACE_BITWISE_OR = 68 - public static final BITWISE_AND = 69 - public static final BITWISE_XOR = 70 - public static final INPLACE_BITWISE_AND = 71 - public static final LOGICAL_OR = 72 - public static final LOGICAL_AND = 73 - public static final EOS = 74 - public static final ASSIGN = 75 - public static final INCREMENT = 76 - public static final DECREMENT = 77 - public static final ADD = 78 - public static final SUBTRACT = 79 - public static final MODULUS = 80 - public static final MULTIPLY = 81 - public static final EQUALITY = 82 - public static final INEQUALITY = 83 - public static final QUESTION_MARK = 84 - public static final BITWISE_NOT = 85 - public static final REFERENCE_EQUALITY = 86 - public static final REFERENCE_INEQUALITY = 87 - public static final LESS_THAN = 88 - public static final LESS_THAN_OR_EQUAL = 89 - public static final SHIFT_LEFT = 90 - public static final INPLACE_SHIFT_LEFT = 91 - public static final GREATER_THAN = 92 - public static final GREATER_THAN_OR_EQUAL = 93 - public static final SHIFT_RIGHT = 94 - public static final INPLACE_SHIFT_RIGHT = 95 - public static final AT = 96 - public static final SCRIPT_ATTRIBUTE_MARKER = 97 - public static final ASSEMBLY_ATTRIBUTE_MARKER = 98 - public static final INPLACE_BITWISE_XOR = 99 - public static final NOT = 100 - public static final DIVISION = 101 - public static final RE_LITERAL = 102 - public static final DOUBLE = 103 - public static final INT = 104 - public static final LONG = 105 - public static final SINGLE_QUOTED_STRING = 106 - public static final DOUBLE_SUFFIX = 107 - public static final EXPONENT = 108 - public static final PRAGMA_WHITE_SPACE = 109 - public static final WHITE_SPACE = 110 - public static final DQS_ESC = 111 - public static final SQS_ESC = 112 - public static final SESC = 113 - public static final ML_COMMENT = 114 - public static final RE_CHAR = 115 - public static final RE_ESC = 116 - public static final NEWLINE = 117 - public static final ID_LETTER = 118 - public static final DIGIT = 119 - public static final HEXDIGIT = 120 + public static final SL_COMMENT = 54 + public static final PRAGMA_ON = 55 + public static final PRAGMA_OFF = 56 + public static final ID = 57 + public static final DOUBLE_QUOTED_STRING = 58 + public static final LBRACE = 59 + public static final RBRACE = 60 + public static final LPAREN = 61 + public static final RPAREN = 62 + public static final DOT = 63 + public static final COLON = 64 + public static final COMMA = 65 + public static final LBRACK = 66 + public static final RBRACK = 67 + public static final BITWISE_OR = 68 + public static final INPLACE_BITWISE_OR = 69 + public static final BITWISE_AND = 70 + public static final BITWISE_XOR = 71 + public static final INPLACE_BITWISE_AND = 72 + public static final LOGICAL_OR = 73 + public static final LOGICAL_AND = 74 + public static final EOS = 75 + public static final ASSIGN = 76 + public static final INCREMENT = 77 + public static final DECREMENT = 78 + public static final ADD = 79 + public static final SUBTRACT = 80 + public static final MODULUS = 81 + public static final MULTIPLY = 82 + public static final EQUALITY = 83 + public static final INEQUALITY = 84 + public static final QUESTION_MARK = 85 + public static final BITWISE_NOT = 86 + public static final REFERENCE_EQUALITY = 87 + public static final REFERENCE_INEQUALITY = 88 + public static final LESS_THAN = 89 + public static final LESS_THAN_OR_EQUAL = 90 + public static final SHIFT_LEFT = 91 + public static final INPLACE_SHIFT_LEFT = 92 + public static final GREATER_THAN = 93 + public static final GREATER_THAN_OR_EQUAL = 94 + public static final SHIFT_RIGHT = 95 + public static final INPLACE_SHIFT_RIGHT = 96 + public static final AT = 97 + public static final SCRIPT_ATTRIBUTE_MARKER = 98 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 99 + public static final INPLACE_BITWISE_XOR = 100 + public static final NOT = 101 + public static final DIVISION = 102 + public static final RE_LITERAL = 103 + public static final DOUBLE = 104 + public static final INT = 105 + public static final LONG = 106 + public static final SINGLE_QUOTED_STRING = 107 + public static final DOUBLE_SUFFIX = 108 + public static final EXPONENT = 109 + public static final PRAGMA_WHITE_SPACE = 110 + public static final WHITE_SPACE = 111 + public static final DQS_ESC = 112 + public static final SQS_ESC = 113 + public static final SESC = 114 + public static final ML_COMMENT = 115 + public static final RE_CHAR = 116 + public static final RE_ESC = 117 + public static final NEWLINE = 118 + public static final ID_LETTER = 119 + public static final DIGIT = 120 + public static final HEXDIGIT = 121 diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.txt b/src/UnityScript/Parser/UnityScriptTokenTypes.txt index 9a5bdd2..97a883f 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.txt +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.txt @@ -50,70 +50,71 @@ INPLACE_DIVISION="/="=50 INPLACE_ADD="+="=51 INPLACE_SUBTRACT="-="=52 INPLACE_MULTIPLY="*="=53 -PRAGMA_ON="pragma on"=54 -PRAGMA_OFF="pragma off"=55 -ID="an identifier"=56 -DOUBLE_QUOTED_STRING="a string"=57 -LBRACE="{"=58 -RBRACE="}"=59 -LPAREN="("=60 -RPAREN=")"=61 -DOT="."=62 -COLON=":"=63 -COMMA=","=64 -LBRACK="["=65 -RBRACK="]"=66 -BITWISE_OR="|"=67 -INPLACE_BITWISE_OR="|="=68 -BITWISE_AND="&"=69 -BITWISE_XOR="^"=70 -INPLACE_BITWISE_AND="&="=71 -LOGICAL_OR="||"=72 -LOGICAL_AND="&&"=73 -EOS=";"=74 -ASSIGN="="=75 -INCREMENT="++"=76 -DECREMENT="--"=77 -ADD="+"=78 -SUBTRACT="-"=79 -MODULUS="%"=80 -MULTIPLY="*"=81 -EQUALITY="=="=82 -INEQUALITY="!="=83 -QUESTION_MARK="?"=84 -BITWISE_NOT="~"=85 -REFERENCE_EQUALITY="==="=86 -REFERENCE_INEQUALITY="!=="=87 -LESS_THAN="<"=88 -LESS_THAN_OR_EQUAL="<="=89 -SHIFT_LEFT="<<"=90 -INPLACE_SHIFT_LEFT="<<="=91 -GREATER_THAN=">"=92 -GREATER_THAN_OR_EQUAL=">="=93 -SHIFT_RIGHT=">>"=94 -INPLACE_SHIFT_RIGHT=">>="=95 -AT="@"=96 -SCRIPT_ATTRIBUTE_MARKER="@script"=97 -ASSEMBLY_ATTRIBUTE_MARKER="@assembly"=98 -INPLACE_BITWISE_XOR=99 -NOT=100 -DIVISION=101 -RE_LITERAL=102 -DOUBLE=103 -INT=104 -LONG=105 -SINGLE_QUOTED_STRING=106 -DOUBLE_SUFFIX=107 -EXPONENT=108 -PRAGMA_WHITE_SPACE=109 -WHITE_SPACE=110 -DQS_ESC=111 -SQS_ESC=112 -SESC=113 -ML_COMMENT=114 -RE_CHAR=115 -RE_ESC=116 -NEWLINE=117 -ID_LETTER=118 -DIGIT=119 -HEXDIGIT=120 +SL_COMMENT="//"=54 +PRAGMA_ON="pragma on"=55 +PRAGMA_OFF="pragma off"=56 +ID="an identifier"=57 +DOUBLE_QUOTED_STRING="a string"=58 +LBRACE="{"=59 +RBRACE="}"=60 +LPAREN="("=61 +RPAREN=")"=62 +DOT="."=63 +COLON=":"=64 +COMMA=","=65 +LBRACK="["=66 +RBRACK="]"=67 +BITWISE_OR="|"=68 +INPLACE_BITWISE_OR="|="=69 +BITWISE_AND="&"=70 +BITWISE_XOR="^"=71 +INPLACE_BITWISE_AND="&="=72 +LOGICAL_OR="||"=73 +LOGICAL_AND="&&"=74 +EOS=";"=75 +ASSIGN="="=76 +INCREMENT="++"=77 +DECREMENT="--"=78 +ADD="+"=79 +SUBTRACT="-"=80 +MODULUS="%"=81 +MULTIPLY="*"=82 +EQUALITY="=="=83 +INEQUALITY="!="=84 +QUESTION_MARK="?"=85 +BITWISE_NOT="~"=86 +REFERENCE_EQUALITY="==="=87 +REFERENCE_INEQUALITY="!=="=88 +LESS_THAN="<"=89 +LESS_THAN_OR_EQUAL="<="=90 +SHIFT_LEFT="<<"=91 +INPLACE_SHIFT_LEFT="<<="=92 +GREATER_THAN=">"=93 +GREATER_THAN_OR_EQUAL=">="=94 +SHIFT_RIGHT=">>"=95 +INPLACE_SHIFT_RIGHT=">>="=96 +AT="@"=97 +SCRIPT_ATTRIBUTE_MARKER="@script"=98 +ASSEMBLY_ATTRIBUTE_MARKER="@assembly"=99 +INPLACE_BITWISE_XOR=100 +NOT=101 +DIVISION=102 +RE_LITERAL=103 +DOUBLE=104 +INT=105 +LONG=106 +SINGLE_QUOTED_STRING=107 +DOUBLE_SUFFIX=108 +EXPONENT=109 +PRAGMA_WHITE_SPACE=110 +WHITE_SPACE=111 +DQS_ESC=112 +SQS_ESC=113 +SESC=114 +ML_COMMENT=115 +RE_CHAR=116 +RE_ESC=117 +NEWLINE=118 +ID_LETTER=119 +DIGIT=120 +HEXDIGIT=121 From a397d5ed5e4db2ab9526b6cbab3f73a1171a1b7a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 7 Sep 2011 07:47:00 -0700 Subject: [PATCH 190/276] nunit-2.5 compatibility --- src/UnityScript.Tests/CommandLineOptionsTestFixture.boo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo b/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo index 4ac3883..e0625ee 100755 --- a/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo +++ b/src/UnityScript.Tests/CommandLineOptionsTestFixture.boo @@ -40,7 +40,7 @@ class CommandLineOptionsTestFixture: options = us.CommandLineOptions("-srcdir:${dir}") - actualFiles = List of string() + actualFiles = Boo.Lang.List of string() options.ForEachSourceFile(actualFiles.Add) Assert.AreEqual( From 7906ee14575d1c35965952db2cd15798c38b1fea Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 8 Sep 2011 14:40:13 -0300 Subject: [PATCH 191/276] enumerator has the same visibility of enumerable --- tests/semantics/coroutine.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/semantics/coroutine.js b/tests/semantics/coroutine.js index 716375c..219d24e 100644 --- a/tests/semantics/coroutine.js +++ b/tests/semantics/coroutine.js @@ -27,7 +27,7 @@ partial public class coroutine(UnityScript.Tests.MonoBehaviour): super() [System.Runtime.CompilerServices.CompilerGeneratedAttribute] - final class $(Boo.Lang.GenericGeneratorEnumerator[of int], System.Collections.IEnumerator): + internal final class $(Boo.Lang.GenericGeneratorEnumerator[of int], System.Collections.IEnumerator): public def constructor(): super() From 16ac57752029d2118d0b1c6ac0cecdea47bc3862 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 9 Sep 2011 00:50:49 +0200 Subject: [PATCH 192/276] make Extensions class static so it can be more easily converted to actionscript --- src/UnityScript.Lang/Extensions.boo | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) mode change 100644 => 100755 src/UnityScript.Lang/Extensions.boo diff --git a/src/UnityScript.Lang/Extensions.boo b/src/UnityScript.Lang/Extensions.boo old mode 100644 new mode 100755 index 1a15099..cfdfe98 --- a/src/UnityScript.Lang/Extensions.boo +++ b/src/UnityScript.Lang/Extensions.boo @@ -1,33 +1,31 @@ namespace UnityScript.Lang -class Extensions: +static class Extensions: [Extension] - static def op_Equality(lhs as System.Char, rhs as System.String): + def op_Equality(lhs as System.Char, rhs as System.String): return 1 == len(rhs) and lhs == rhs[0] [Extension] - static def op_Equality(lhs as System.String, rhs as System.Char): + def op_Equality(lhs as System.String, rhs as System.Char): return rhs == lhs [Extension] - static def op_Inequality(lhs as System.Char, rhs as System.String): + def op_Inequality(lhs as System.Char, rhs as System.String): return 1 != len(rhs) or lhs != rhs[0] [Extension] - static def op_Inequality(lhs as System.String, rhs as System.Char): + def op_Inequality(lhs as System.String, rhs as System.Char): return rhs != lhs [Extension] - static length[a as System.Array]: - get: - return a.Length + length[a as System.Array]: + get: return a.Length [Extension] - static length[s as string]: - get: - return s.Length + length[s as string]: + get: return s.Length [Extension] - static def op_Implicit(e as System.Enum) as bool: - return cast(System.IConvertible, e).ToInt32(null) != 0 + def op_Implicit(e as System.Enum) as bool: + return (e cast System.IConvertible).ToInt32(null) != 0 From cc4568d3dec94f153664f9f742be372f473c6735 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 13 Sep 2011 15:54:05 -0300 Subject: [PATCH 193/276] keep precise EndSourceLocation for fields --- src/UnityScript/Parser/UnityScriptParser.boo | 11 +++++++++-- src/UnityScript/UnityScript.g | 11 +++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 83b038f..db68ef6 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -939,15 +939,20 @@ class UnityScriptParser(antlr.LLkParser): else: raise - public def eos() as void: //throws RecognitionException, TokenStreamException + public def eos() as antlr.IToken : //throws RecognitionException, TokenStreamException + firstEOS as antlr.IToken + t as IToken = null try: // for error handling if ((LA(1)==EOS) and (tokenSet_24_.member(cast(int, LA(2))))): _cnt41 as int = 0 while true: if ((LA(1)==EOS) and (tokenSet_24_.member(cast(int, LA(2))))): + t = LT(1) match(EOS) + if 0 == inputState.guessing: + if firstEOS is null: firstEOS = t else: if (_cnt41 >= 1): goto _loop41_breakloop @@ -966,6 +971,7 @@ class UnityScriptParser(antlr.LLkParser): recover(ex,tokenSet_24_) else: raise + return firstEOS public def class_declaration( parent as TypeDefinition @@ -1397,12 +1403,13 @@ class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - eos() + finalToken=eos() if 0 == inputState.guessing: member = Field(ToLexicalInfo(name), Name: name.getText(), Type: tr, Initializer: initializer) + if finalToken is not null: SetEndSourceLocation(member, finalToken) FlushAttributes(member) cd.Members.Add(member) except ex as RecognitionException: diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 7e48b13..6ab4959 100644 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -416,10 +416,12 @@ import_directive[Module container] } ; -eos: +eos returns [antlr.IToken firstEOS]: ( - (options { greedy = true; }: EOS)+ | - { SemicolonExpected() } + (options { greedy = true; }: + t:EOS { if firstEOS is null: firstEOS = t } + )+ + | { SemicolonExpected() } ) ; @@ -579,12 +581,13 @@ identifier returns [antlr.IToken token] field_member[TypeDefinition cd] returns [TypeMember member] { }: - VAR name=identifier (COLON tr=type_reference)? (ASSIGN initializer=expression)? eos + VAR name=identifier (COLON tr=type_reference)? (ASSIGN initializer=expression)? finalToken=eos { member = Field(ToLexicalInfo(name), Name: name.getText(), Type: tr, Initializer: initializer) + if finalToken is not null: SetEndSourceLocation(member, finalToken) FlushAttributes(member) cd.Members.Add(member) } From 306938d186720880f0744495db1faa05971ffdb3 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 11 Oct 2011 12:29:30 -0300 Subject: [PATCH 194/276] test case for variable reuse in for statement --- .../DuckyIntegrationTestFixture.boo | 4 ++++ .../StrictIntegrationTestFixture.Generated.boo | 4 ++++ tests/integration/for-var-reuse.js | 16 ++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 tests/integration/for-var-reuse.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 878d878..87e7abc 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -358,6 +358,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/for-over-null.js") + [Test] def for_var_reuse(): + RunTestCase("tests/integration/for-var-reuse.js") + + [Test] def functions_1(): RunTestCase("tests/integration/functions-1.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo index b00596d..f2eaaf7 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo @@ -356,6 +356,10 @@ partial class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/for-over-null.js") + [Test] def for_var_reuse(): + RunTestCase("tests/integration/for-var-reuse.js") + + [Test] def functions_1(): RunTestCase("tests/integration/functions-1.js") diff --git a/tests/integration/for-var-reuse.js b/tests/integration/for-var-reuse.js new file mode 100644 index 0000000..0ff2f3b --- /dev/null +++ b/tests/integration/for-var-reuse.js @@ -0,0 +1,16 @@ +/* +FOO +BAR +after: bar +*/ +#pragma strict + +function test() { + var array: Array = new Array("foo", "bar"); + var s: String; + for (s in array) + print(s.ToUpper()); + print("after: " + s); +} + +test(); From ca28388c197db1d85783580227c1d45a6aaf1ac9 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 14 Oct 2011 10:37:33 -0300 Subject: [PATCH 195/276] adapt to Boo.Lang.Compiler.Ast.Import change --- src/UnityScript/Scripting/Pipeline/IntroduceImports.boo | 2 +- src/UnityScript/Steps/ApplySemantics.boo | 3 +-- src/UnityScript/UnityScript.g | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) mode change 100755 => 100644 src/UnityScript/Scripting/Pipeline/IntroduceImports.boo mode change 100755 => 100644 src/UnityScript/Steps/ApplySemantics.boo diff --git a/src/UnityScript/Scripting/Pipeline/IntroduceImports.boo b/src/UnityScript/Scripting/Pipeline/IntroduceImports.boo old mode 100755 new mode 100644 index fac9196..a43100e --- a/src/UnityScript/Scripting/Pipeline/IntroduceImports.boo +++ b/src/UnityScript/Scripting/Pipeline/IntroduceImports.boo @@ -18,6 +18,6 @@ class IntroduceImports(AbstractCompilerStep): def AddImports(imports as (string)): for m in CompileUnit.Modules: for i in imports: - m.Imports.Add(Import(Namespace: i)) + m.Imports.Add(Import(i)) \ No newline at end of file diff --git a/src/UnityScript/Steps/ApplySemantics.boo b/src/UnityScript/Steps/ApplySemantics.boo old mode 100755 new mode 100644 index c499ec4..aa91e14 --- a/src/UnityScript/Steps/ApplySemantics.boo +++ b/src/UnityScript/Steps/ApplySemantics.boo @@ -80,8 +80,7 @@ class ApplySemantics(AbstractVisitorCompilerStep): def SetUpDefaultImports(module as Module): for ns as string in self.UnityScriptParameters.Imports: - module.Imports.Add( - Import(LexicalInfo: module.LexicalInfo, Namespace: ns)) + module.Imports.Add(Import(ns)) def MoveAttributes(fromType as TypeDefinition, toType as TypeDefinition): toType.Attributes.Extend(fromType.Attributes) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 6ab4959..14c87ef 100644 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -409,10 +409,10 @@ pragma_directive[Module container] import_directive[Module container] { }: - IMPORT ns=qname eos + imp:IMPORT ns=qname eos { container.Imports.Add( - Import(ToLexicalInfo(ns), Namespace: ns.getText())) + Import(ToLexicalInfo(imp), ReferenceExpression(ToLexicalInfo(ns), ns.getText()))) } ; From 70a40ea5bc91ca1fe27b14e502813ea46e849d42 Mon Sep 17 00:00:00 2001 From: Tak Date: Tue, 18 Oct 2011 16:56:04 +0200 Subject: [PATCH 196/276] Don't sign unityscript assemblies. Unbreaks us compilation on .net. --- default.build | 3 --- 1 file changed, 3 deletions(-) diff --git a/default.build b/default.build index c199ee1..c5cf12c 100755 --- a/default.build +++ b/default.build @@ -16,7 +16,6 @@ - @@ -142,7 +141,6 @@ - - From bf1907207cc970e6cff1fb7da6e62a7804d449ba Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 24 Oct 2011 18:00:22 -0200 Subject: [PATCH 197/276] antlr generated file for latest changes --- src/UnityScript/Parser/UnityScriptParser.boo | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index db68ef6..9f14d3f 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -340,14 +340,16 @@ class UnityScriptParser(antlr.LLkParser): container as Module ) as void: //throws RecognitionException, TokenStreamException + imp as IToken = null try: // for error handling + imp = LT(1) match(IMPORT) ns=qname() eos() if 0 == inputState.guessing: container.Imports.Add( - Import(ToLexicalInfo(ns), Namespace: ns.getText())) + Import(ToLexicalInfo(imp), ReferenceExpression(ToLexicalInfo(ns), ns.getText()))) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) From 3f48a9bf34796a6fc4a706ec42e9659a53e6bfef Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 26 Oct 2011 11:15:57 -0200 Subject: [PATCH 198/276] prove multidimensional arrays of struct work --- .../DuckyIntegrationTestFixture.boo | 4 ++++ .../StrictIntegrationTestFixture.Generated.boo | 4 ++++ .../multidimensional-array-of-struct.js | 15 +++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 tests/integration/multidimensional-array-of-struct.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 87e7abc..ff25a75 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -434,6 +434,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/magicconstructor_2.js") + [Test] def multidimensional_array_of_struct(): + RunTestCase("tests/integration/multidimensional-array-of-struct.js") + + [Test] def multidimensional_arrays_1(): RunTestCase("tests/integration/multidimensional-arrays-1.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo index f2eaaf7..8bbd64f 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo @@ -432,6 +432,10 @@ partial class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/magicconstructor_2.js") + [Test] def multidimensional_array_of_struct(): + RunTestCase("tests/integration/multidimensional-array-of-struct.js") + + [Test] def multidimensional_arrays_1(): RunTestCase("tests/integration/multidimensional-arrays-1.js") diff --git a/tests/integration/multidimensional-array-of-struct.js b/tests/integration/multidimensional-array-of-struct.js new file mode 100644 index 0000000..cf544f2 --- /dev/null +++ b/tests/integration/multidimensional-array-of-struct.js @@ -0,0 +1,15 @@ +/* +5 +5 +*/ +class TStruc extends System.ValueType { + var blub : int; +} + +var oneDim = new TStruc[5]; +var multiDim = new TStruc[5,5]; +oneDim[0].blub = 5; +print(oneDim[0].blub); + +multiDim[0,0].blub = 5; +print(multiDim[0,0].blub); From a1681793feed5ebaea68578e364e910e0bde7dea Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 26 Oct 2011 15:56:45 -0200 Subject: [PATCH 199/276] remove unused method --- src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo | 4 ---- 1 file changed, 4 deletions(-) mode change 100755 => 100644 src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo diff --git a/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo b/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo old mode 100755 new mode 100644 index 755a0a3..80c6552 --- a/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo +++ b/src/UnityScript/TypeSystem/UnityScriptTypeSystem.boo @@ -25,13 +25,9 @@ class UnityScriptTypeSystem(TypeSystemServices): def IsGenerator(method as IMethod): rt = method.ReturnType if rt is IEnumeratorType: return true - // for backwards compatibility return rt.IsSubclassOf(self._AbstractGenerator) - override def IsModule(type as System.Type): - return false - override def CanBeReachedByPromotion(expected as IType, actual as IType): result = super(expected, actual) if result: return true From b9975f6a7f55da3dbf1aa092740bc9e4162b4732 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 26 Oct 2011 16:15:57 -0200 Subject: [PATCH 200/276] Types.IEnumerable and Types.IEnumerator are no more --- src/UnityScript/Steps/ProcessUnityScriptMethods.boo | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) mode change 100755 => 100644 src/UnityScript/Steps/ProcessUnityScriptMethods.boo diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo old mode 100755 new mode 100644 index 2e87fae..48ce875 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -14,11 +14,11 @@ import UnityScript.TypeSystem class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): - deferred IEnumerable_GetEnumerator = Types.IEnumerable.GetMethod("GetEnumerator"); + deferred IEnumerable_GetEnumerator = typeof(System.Collections.IEnumerable).GetMethod("GetEnumerator"); - deferred IEnumerator_MoveNext = Types.IEnumerator.GetMethod("MoveNext"); + deferred IEnumerator_MoveNext = typeof(System.Collections.IEnumerator).GetMethod("MoveNext"); - deferred IEnumerator_get_Current = Types.IEnumerator.GetProperty("Current").GetGetMethod(); + deferred IEnumerator_get_Current = typeof(System.Collections.IEnumerator).GetProperty("Current").GetGetMethod(); deferred _StartCoroutine = NameResolutionService.ResolveMethod(UnityScriptTypeSystem.ScriptBaseType, "StartCoroutine_Auto") From 956e5e9e12c816f41dc149eb1ee405e0a470216a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 31 Oct 2011 16:24:04 -0200 Subject: [PATCH 201/276] unnecessary comments removed --- src/UnityScript.Tests.CSharp/AssemblyInfo.cs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/UnityScript.Tests.CSharp/AssemblyInfo.cs b/src/UnityScript.Tests.CSharp/AssemblyInfo.cs index f8ee868..cbbb021 100755 --- a/src/UnityScript.Tests.CSharp/AssemblyInfo.cs +++ b/src/UnityScript.Tests.CSharp/AssemblyInfo.cs @@ -1,12 +1,6 @@ using System.Reflection; using System.Runtime.CompilerServices; -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - [assembly: AssemblyTitle("")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] @@ -15,13 +9,4 @@ [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly: AssemblyVersion("1.0.*")] - +[assembly: AssemblyVersion("1.0.*")] \ No newline at end of file From 789d3421903cc02ec33db2289514498ce2d14252 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 31 Oct 2011 16:25:23 -0200 Subject: [PATCH 202/276] fix monolipse references --- src/UnityScript.Tests.CSharp/.monolipse | 6 +++--- src/UnityScript/.monolipse | 24 +++++++++++++++--------- src/us/.monolipse | 6 +++--- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/UnityScript.Tests.CSharp/.monolipse b/src/UnityScript.Tests.CSharp/.monolipse index 85f11ad..83e7aea 100755 --- a/src/UnityScript.Tests.CSharp/.monolipse +++ b/src/UnityScript.Tests.CSharp/.monolipse @@ -2,9 +2,9 @@ cs library - - /UnityScript/lib/net-2.0/bin/Boo.Lang.dll - + + Boo.Lang + /UnityScript/bin diff --git a/src/UnityScript/.monolipse b/src/UnityScript/.monolipse index 5922ac3..97f9fd5 100755 --- a/src/UnityScript/.monolipse +++ b/src/UnityScript/.monolipse @@ -2,18 +2,24 @@ boo library - - /UnityScript/lib/net-2.0/bin/Boo.Lang.Compiler.dll - - - /UnityScript/lib/net-2.0/bin/Boo.Lang.Parser.dll - /UnityScript/src/UnityScript.Lang - - /UnityScript/lib/net-2.0/bin/Boo.Lang.PatternMatching.dll - + + Boo.Lang + + + Boo.Lang.PatternMatching + + + Boo.Lang.Useful + + + Boo.Lang.Parser + + + Boo.Lang.Compiler + /UnityScript/bin diff --git a/src/us/.monolipse b/src/us/.monolipse index 04dc6ec..d04b424 100644 --- a/src/us/.monolipse +++ b/src/us/.monolipse @@ -5,9 +5,9 @@ /UnityScript/src/UnityScript - - /UnityScript/lib/net-2.0/bin/Boo.Lang.Useful.dll - + + Boo.Lang.Useful + /UnityScript/bin From 04daee9a0194a4ed241385db7599cf00a75f2f47 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 31 Oct 2011 16:25:53 -0200 Subject: [PATCH 203/276] warn when bitwise operators are applied to boolean operands --- .../ErrorMessagesTestFixture.Generated.boo | 4 ++++ src/UnityScript/Core/UnityScriptWarnings.boo | 3 +++ src/UnityScript/Steps/Lint.boo | 22 +++++++++++++++++++ src/UnityScript/UnityScriptCompiler.boo | 3 +++ .../bitwise-with-bool-operands-warning.js | 9 ++++++++ 5 files changed, 41 insertions(+) create mode 100644 src/UnityScript/Steps/Lint.boo create mode 100644 tests/error-messages/bitwise-with-bool-operands-warning.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index b3c36e0..93b808f 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -22,6 +22,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/array-type-name.js") + [Test] def bitwise_with_bool_operands_warning(): + RunTestCase("tests/error-messages/bitwise-with-bool-operands-warning.js") + + [Test] def builtins(): RunTestCase("tests/error-messages/builtins.js") diff --git a/src/UnityScript/Core/UnityScriptWarnings.boo b/src/UnityScript/Core/UnityScriptWarnings.boo index 68276d6..5c3452a 100755 --- a/src/UnityScript/Core/UnityScriptWarnings.boo +++ b/src/UnityScript/Core/UnityScriptWarnings.boo @@ -10,6 +10,9 @@ static class UnityScriptWarnings: def ScriptMainMethodIsImplicitlyDefined(location as LexicalInfo, functionName as string): return CreateWarning("UCW0002", location, "WARNING: Function '${functionName}()' is already implicitly defined to contain global script code. Global code will be merged at the end. Either rename the function, change its signature or remove any global code if that's not what you intended.") + def BitwiseOperatorWithBooleanOperands(location as LexicalInfo, expectedOperator as string, actualOperator as string): + return CreateWarning("UCW0003", location, "WARNING: Bitwise operation '$actualOperator' on boolean values won't shortcut. Did you mean '$expectedOperator'?") + private def CreateWarning(code as string, location as LexicalInfo, message as string): return Boo.Lang.Compiler.CompilerWarning(location, message, code) diff --git a/src/UnityScript/Steps/Lint.boo b/src/UnityScript/Steps/Lint.boo new file mode 100644 index 0000000..dda4798 --- /dev/null +++ b/src/UnityScript/Steps/Lint.boo @@ -0,0 +1,22 @@ +namespace UnityScript.Steps + +import Boo.Lang.Compiler.Ast +import Boo.Lang.Compiler.Steps + +import PatternMatching +import UnityScript.Core.UnityScriptWarnings + +class Lint(AbstractFastVisitorCompilerStep): + + override def OnBinaryExpression(node as BinaryExpression): + super(node) + match node.Operator: + case BinaryOperatorType.BitwiseAnd | BinaryOperatorType.BitwiseOr: + if IsBoolean(node.Left) and IsBoolean(node.Right): + expected, actual = (("&&", "&") if node.Operator == BinaryOperatorType.BitwiseAnd else ("||", "|")) + Warnings.Add(BitwiseOperatorWithBooleanOperands(node.LexicalInfo, expected, actual)) + otherwise: + pass + + def IsBoolean(e as Expression): + return e.ExpressionType is TypeSystemServices.BoolType \ No newline at end of file diff --git a/src/UnityScript/UnityScriptCompiler.boo b/src/UnityScript/UnityScriptCompiler.boo index 3534ea2..b08b739 100755 --- a/src/UnityScript/UnityScriptCompiler.boo +++ b/src/UnityScript/UnityScriptCompiler.boo @@ -65,6 +65,9 @@ class UnityScriptCompiler: pipeline.ReplaceOptional(Boo.Lang.Compiler.Steps.ExpandDuckTypedExpressions, UnityScript.Steps.ExpandUnityDuckTypedExpressions()) + pipeline.InsertBefore(Boo.Lang.Compiler.Steps.EmitAssembly, + UnityScript.Steps.Lint()) + pipeline.InsertBefore(Boo.Lang.Compiler.Steps.EmitAssembly, UnityScript.Steps.EnableRawArrayIndexing()) diff --git a/tests/error-messages/bitwise-with-bool-operands-warning.js b/tests/error-messages/bitwise-with-bool-operands-warning.js new file mode 100644 index 0000000..98b1107 --- /dev/null +++ b/tests/error-messages/bitwise-with-bool-operands-warning.js @@ -0,0 +1,9 @@ +/* +bitwise-with-bool-operands-warning.js(8,10): UCW0003: WARNING: Bitwise operation '|' on boolean values won't shortcut. Did you mean '||'? +bitwise-with-bool-operands-warning.js(9,10): UCW0003: WARNING: Bitwise operation '&' on boolean values won't shortcut. Did you mean '&&'? +*/ +function b(arg): boolean { + return true; +} +if (b(1) | b(2)) {} +if (b(1) & b(2)) {} \ No newline at end of file From 146707c2b6eb68bea53c8a57ff103ae8fee018fb Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 27 Oct 2011 09:23:46 -0200 Subject: [PATCH 204/276] allow @script and @assembly attributes to appear before import (case #409462) --- .../ParserTestFixture.Generated.boo | 4 + src/UnityScript/Parser/UnityScriptLexer.boo | 126 +++--- src/UnityScript/Parser/UnityScriptParser.boo | 392 +++++++++--------- src/UnityScript/UnityScript.g | 1 + ...s-for-script-and-assembly-before-import.js | 17 + 5 files changed, 287 insertions(+), 253 deletions(-) create mode 100644 tests/parser/attributes-for-script-and-assembly-before-import.js diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index 16ad66b..58f213e 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -18,6 +18,10 @@ partial class ParserTestFixture: RunTestCase("tests/parser/attributes-1.js") + [Test] def attributes_for_script_and_assembly_before_import(): + RunTestCase("tests/parser/attributes-for-script-and-assembly-before-import.js") + + [Test] def attributes_for_script_and_assembly(): RunTestCase("tests/parser/attributes-for-script-and-assembly.js") diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index 5a2d01a..038afcc 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -594,8 +594,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mDIGIT(false) else: // line 1969 - goto _loop315_breakloop - :_loop315_breakloop + goto _loop317_breakloop + :_loop317_breakloop _ttype = testLiteralsTable(_ttype) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -688,17 +688,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): match("0x") - _cnt319 as int = 0 + _cnt321 as int = 0 while true: if ((tokenSet_0_.member(cast(int, cached_LA1)))): mHEXDIGIT(false) else: - if (_cnt319 >= 1): - goto _loop319_breakloop + if (_cnt321 >= 1): + goto _loop321_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt319 - :_loop319_breakloop + ++_cnt321 + :_loop321_breakloop if ((cached_LA1==char('L') or cached_LA1==char('l'))): _givenValue = cached_LA1 if ((_givenValue == char('l'))): // 1831 @@ -712,17 +712,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): else: // line 2053 pass // 947 elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt323 as int = 0 + _cnt325 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt323 >= 1): - goto _loop323_breakloop + if (_cnt325 >= 1): + goto _loop325_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt323 - :_loop323_breakloop + ++_cnt325 + :_loop325_breakloop _givenValue = cached_LA1 if ((_givenValue == char('L')) or (_givenValue ==char('l')) @@ -818,17 +818,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_SUFFIX - _cnt332 as int = 0 + _cnt334 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt332 >= 1): - goto _loop332_breakloop + if (_cnt334 >= 1): + goto _loop334_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt332 - :_loop332_breakloop + ++_cnt334 + :_loop334_breakloop if ((cached_LA1==char('E') or cached_LA1==char('e'))): mEXPONENT(false) else: // line 2053 @@ -879,17 +879,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt339 as int = 0 + _cnt341 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt339 >= 1): - goto _loop339_breakloop + if (_cnt341 >= 1): + goto _loop341_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt339 - :_loop339_breakloop + ++_cnt341 + :_loop341_breakloop if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1129,31 +1129,31 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _saveIndex = text.Length match("#pragma") text.Length = _saveIndex - _cnt363 as int = 0 + _cnt365 as int = 0 while true: if ((cached_LA1==char('\t') or cached_LA1==char(' '))): mPRAGMA_WHITE_SPACE(false) else: - if (_cnt363 >= 1): - goto _loop363_breakloop + if (_cnt365 >= 1): + goto _loop365_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt363 - :_loop363_breakloop + ++_cnt365 + :_loop365_breakloop mID(true) id = returnToken_ if ((cached_LA1==char('\t') or cached_LA1==char(' ')) and (cached_LA2==char('\t') or cached_LA2==char(' ') or cached_LA2==char('o')) and (LA(3)==char('\t') or LA(3)==char(' ') or LA(3)==char('f') or LA(3)==char('n') or LA(3)==char('o'))): - _cnt366 as int = 0 + _cnt368 as int = 0 while true: if ((cached_LA1==char('\t') or cached_LA1==char(' '))): mPRAGMA_WHITE_SPACE(false) else: - if (_cnt366 >= 1): - goto _loop366_breakloop + if (_cnt368 >= 1): + goto _loop368_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt366 - :_loop366_breakloop + ++_cnt368 + :_loop368_breakloop if ((cached_LA1==char('o')) and (cached_LA2==char('f'))): _saveIndex = text.Length match("off") @@ -1174,8 +1174,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('\t') or cached_LA1==char(' '))): mPRAGMA_WHITE_SPACE(false) else: - goto _loop369_breakloop - :_loop369_breakloop + goto _loop371_breakloop + :_loop371_breakloop _saveIndex = text.Length mNEWLINE(false) text.Length = _saveIndex @@ -1450,18 +1450,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched396 as bool = false + synPredMatched398 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m396 as int = mark() - synPredMatched396 = true + _m398 as int = mark() + synPredMatched398 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched396 = false - rewind(_m396) + synPredMatched398 = false + rewind(_m398) --inputState.guessing - if synPredMatched396: + if synPredMatched398: mML_COMMENT(false) if 0 == inputState.guessing: if not PreserveComments: @@ -1475,8 +1475,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop401_breakloop - :_loop401_breakloop + goto _loop403_breakloop + :_loop403_breakloop if 0 == inputState.guessing: if PreserveComments: _ttype = SL_COMMENT @@ -1508,8 +1508,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop430_breakloop - :_loop430_breakloop + goto _loop432_breakloop + :_loop432_breakloop match("*/") if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1520,7 +1520,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt405 as int = 0 + _cnt407 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1534,12 +1534,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt405 >= 1): - goto _loop405_breakloop + if (_cnt407 >= 1): + goto _loop407_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt405 - :_loop405_breakloop + ++_cnt407 + :_loop407_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1560,8 +1560,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop409_breakloop - :_loop409_breakloop + goto _loop411_breakloop + :_loop411_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1610,8 +1610,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_4_) else: - goto _loop413_breakloop - :_loop413_breakloop + goto _loop415_breakloop + :_loop415_breakloop _saveIndex = text.Length match('\'') text.Length = _saveIndex @@ -1712,17 +1712,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt433 as int = 0 + _cnt435 as int = 0 while true: if ((tokenSet_5_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt433 >= 1): - goto _loop433_breakloop + if (_cnt435 >= 1): + goto _loop435_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt433 - :_loop433_breakloop + ++_cnt435 + :_loop435_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1780,17 +1780,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt439 as int = 0 + _cnt441 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt439 >= 1): - goto _loop439_breakloop + if (_cnt441 >= 1): + goto _loop441_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt439 - :_loop439_breakloop + ++_cnt441 + :_loop441_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 9f14d3f..47b4e63 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -297,23 +297,39 @@ class UnityScriptParser(antlr.LLkParser): ): // 1827 pragma_directive(module) else: // line 1969 - goto _loop3_breakloop - :_loop3_breakloop + synPredMatched4 as bool = false + if ((LA(1)==AT) and (LA(2)==ID)): + _m4 as int = mark() + synPredMatched4 = true + ++inputState.guessing + try: + match(AT) + match(ID) + match(ID) + except x as RecognitionException: + synPredMatched4 = false + rewind(_m4) + --inputState.guessing + if synPredMatched4: + script_or_assembly_attribute(module) + else: + goto _loop5_breakloop + :_loop5_breakloop while true: - synPredMatched6 as bool = false + synPredMatched8 as bool = false if ((LA(1)==AT) and (LA(2)==ID)): - _m6 as int = mark() - synPredMatched6 = true + _m8 as int = mark() + synPredMatched8 = true ++inputState.guessing try: match(AT) match(ID) match(ID) except x as RecognitionException: - synPredMatched6 = false - rewind(_m6) + synPredMatched8 = false + rewind(_m8) --inputState.guessing - if synPredMatched6: + if synPredMatched8: script_or_assembly_attribute(module) elif ((LA(1)==AT) and (LA(2)==ID)): // line 2102 attributes() @@ -323,8 +339,8 @@ class UnityScriptParser(antlr.LLkParser): elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_3_.member(cast(int, LA(2))))): // line 2102 statement(globals) else: - goto _loop8_breakloop - :_loop8_breakloop + goto _loop10_breakloop + :_loop10_breakloop eof = LT(1) match(Token.EOF_TYPE) if 0 == inputState.guessing: @@ -416,7 +432,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_6_) + recover(ex,tokenSet_5_) else: raise @@ -425,21 +441,21 @@ class UnityScriptParser(antlr.LLkParser): _attributes.Clear() try: // for error handling - _cnt16 as int = 0 + _cnt18 as int = 0 while true: if ((LA(1)==AT)): attribute() else: - if (_cnt16 >= 1): - goto _loop16_breakloop + if (_cnt18 >= 1): + goto _loop18_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt16 - :_loop16_breakloop + ++_cnt18 + :_loop18_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_7_) + recover(ex,tokenSet_6_) else: raise @@ -450,24 +466,24 @@ class UnityScriptParser(antlr.LLkParser): globals = module.Globals try: // for error handling - synPredMatched25 as bool = false - if (((tokenSet_8_.member(cast(int, LA(1)))) and (tokenSet_9_.member(cast(int, LA(2))))) and (GlobalVariablesBecomeFields())): - _m25 as int = mark() - synPredMatched25 = true + synPredMatched27 as bool = false + if (((tokenSet_7_.member(cast(int, LA(1)))) and (tokenSet_8_.member(cast(int, LA(2))))) and (GlobalVariablesBecomeFields())): + _m27 as int = mark() + synPredMatched27 = true ++inputState.guessing try: module_member_modifiers() match(VAR) except x as RecognitionException: - synPredMatched25 = false - rewind(_m25) + synPredMatched27 = false + rewind(_m27) --inputState.guessing - if synPredMatched25: + if synPredMatched27: module_field(module) elif ((LA(1)==VAR) and (LA(2)==FINAL or LA(2)==INTERNAL or LA(2)==ID)): // line 2102 declaration_statement(globals) eos() - elif ((tokenSet_10_.member(cast(int, LA(1)))) and (tokenSet_11_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_9_.member(cast(int, LA(1)))) and (tokenSet_10_.member(cast(int, LA(2))))): // line 2102 mod=module_member_modifiers() _givenValue = LA(1) if ((_givenValue == CLASS) @@ -489,7 +505,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_6_) + recover(ex,tokenSet_11_) else: raise @@ -594,17 +610,17 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) eos() elif ((_givenValue == EOS)): // 1831 - _cnt109 as int = 0 + _cnt111 as int = 0 while true: if ((LA(1)==EOS) and (tokenSet_12_.member(cast(int, LA(2))))): match(EOS) else: - if (_cnt109 >= 1): - goto _loop109_breakloop + if (_cnt111 >= 1): + goto _loop111_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt109 - :_loop109_breakloop + ++_cnt111 + :_loop111_breakloop else: // line 1969 raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: @@ -620,19 +636,19 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched11 as bool = false + synPredMatched13 as bool = false if ((LA(1)==ID) and (LA(2)==DOT or LA(2)==ASSIGN)): - _m11 as int = mark() - synPredMatched11 = true + _m13 as int = mark() + synPredMatched13 = true ++inputState.guessing try: match(ID) match(ASSIGN) except x as RecognitionException: - synPredMatched11 = false - rewind(_m11) + synPredMatched13 = false + rewind(_m13) --inputState.guessing - if synPredMatched11: + if synPredMatched13: name=reference_expression() match(ASSIGN) value=expression() @@ -662,8 +678,8 @@ class UnityScriptParser(antlr.LLkParser): match(DOT) e=member_reference_expression(e) else: - goto _loop195_breakloop - :_loop195_breakloop + goto _loop197_breakloop + :_loop197_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -742,8 +758,8 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) attribute_parameter(attr) else: - goto _loop22_breakloop - :_loop22_breakloop + goto _loop24_breakloop + :_loop24_breakloop elif ((_givenValue == RPAREN)): // 1831 pass // 947 else: // line 1969 @@ -783,8 +799,8 @@ class UnityScriptParser(antlr.LLkParser): buffer.Append(".") buffer.Append(other.getText()) else: - goto _loop34_breakloop - :_loop34_breakloop + goto _loop36_breakloop + :_loop36_breakloop if 0 == inputState.guessing: id.setText(buffer.ToString()) except ex as RecognitionException: @@ -834,8 +850,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: VirtualKeywordHasNoEffect(v) else: // line 1969 - goto _loop44_breakloop - :_loop44_breakloop + goto _loop46_breakloop + :_loop46_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -857,7 +873,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_6_) + recover(ex,tokenSet_11_) else: raise @@ -948,7 +964,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling if ((LA(1)==EOS) and (tokenSet_24_.member(cast(int, LA(2))))): - _cnt41 as int = 0 + _cnt43 as int = 0 while true: if ((LA(1)==EOS) and (tokenSet_24_.member(cast(int, LA(2))))): t = LT(1) @@ -956,12 +972,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: if firstEOS is null: firstEOS = t else: - if (_cnt41 >= 1): - goto _loop41_breakloop + if (_cnt43 >= 1): + goto _loop43_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt41 - :_loop41_breakloop + ++_cnt43 + :_loop43_breakloop elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: SemicolonExpected() @@ -1079,8 +1095,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: m.Modifiers |= mod if m is not null else: - goto _loop56_breakloop - :_loop56_breakloop + goto _loop58_breakloop + :_loop58_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: @@ -1089,8 +1105,8 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS) and (tokenSet_30_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop58_breakloop - :_loop58_breakloop + goto _loop60_breakloop + :_loop60_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1136,8 +1152,8 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) interface_member(td) else: - goto _loop63_breakloop - :_loop63_breakloop + goto _loop65_breakloop + :_loop65_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: @@ -1146,8 +1162,8 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS) and (tokenSet_30_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop65_breakloop - :_loop65_breakloop + goto _loop67_breakloop + :_loop67_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1183,8 +1199,8 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) enum_member(ed) else: - goto _loop74_breakloop - :_loop74_breakloop + goto _loop76_breakloop + :_loop76_breakloop _givenValue = LA(1) if ((_givenValue == COMMA)): // 1831 match(COMMA) @@ -1204,8 +1220,8 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS) and (tokenSet_30_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop77_breakloop - :_loop77_breakloop + goto _loop79_breakloop + :_loop79_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1233,7 +1249,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_6_) + recover(ex,tokenSet_11_) else: raise return member @@ -1469,8 +1485,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: VirtualKeywordHasNoEffect(v) else: // line 1969 - goto _loop47_breakloop - :_loop47_breakloop + goto _loop49_breakloop + :_loop49_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1502,8 +1518,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ++rank else: - goto _loop164_breakloop - :_loop164_breakloop + goto _loop166_breakloop + :_loop166_breakloop match(RBRACK) if 0 == inputState.guessing: tr = ArrayTypeReference(tr.LexicalInfo, tr, IntegerLiteralExpression(ToLexicalInfo(lbrack), rank)) @@ -1535,8 +1551,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: typeReferences.Add(tr) else: - goto _loop180_breakloop - :_loop180_breakloop + goto _loop182_breakloop + :_loop182_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1653,8 +1669,8 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS)): match(EOS) else: - goto _loop70_breakloop - :_loop70_breakloop + goto _loop72_breakloop + :_loop72_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1674,8 +1690,8 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) parameter_declaration(m) else: - goto _loop92_breakloop - :_loop92_breakloop + goto _loop94_breakloop + :_loop94_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1794,8 +1810,8 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS) and (tokenSet_39_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop99_breakloop - :_loop99_breakloop + goto _loop101_breakloop + :_loop101_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1872,8 +1888,8 @@ class UnityScriptParser(antlr.LLkParser): if ((tokenSet_2_.member(cast(int, LA(1))))): statement(b) else: - goto _loop102_breakloop - :_loop102_breakloop + goto _loop104_breakloop + :_loop104_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: @@ -1950,10 +1966,10 @@ class UnityScriptParser(antlr.LLkParser): f = LT(1) match(FOR) match(LPAREN) - synPredMatched125 as bool = false + synPredMatched127 as bool = false if ((tokenSet_42_.member(cast(int, LA(1)))) and (tokenSet_43_.member(cast(int, LA(2))))): - _m125 as int = mark() - synPredMatched125 = true + _m127 as int = mark() + synPredMatched127 = true ++inputState.guessing try: _givenValue = LA(1) @@ -1968,10 +1984,10 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) match(IN) except x as RecognitionException: - synPredMatched125 = false - rewind(_m125) + synPredMatched127 = false + rewind(_m127) --inputState.guessing - if synPredMatched125: + if synPredMatched127: stmt=for_in(container) elif ((tokenSet_44_.member(cast(int, LA(1)))) and (tokenSet_45_.member(cast(int, LA(2))))): // line 2102 stmt=for_c(container) @@ -2061,8 +2077,8 @@ class UnityScriptParser(antlr.LLkParser): tr = null compound_or_single_stmt(b) else: - goto _loop152_breakloop - :_loop152_breakloop + goto _loop154_breakloop + :_loop154_breakloop if ((LA(1)==FINALLY) and (tokenSet_2_.member(cast(int, LA(2))))): finally_block(s) elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 @@ -2115,22 +2131,22 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: item.Arguments.Add(e); else: - goto _loop140_breakloop - :_loop140_breakloop - _cnt142 as int = 0 + goto _loop142_breakloop + :_loop142_breakloop + _cnt144 as int = 0 while true: if ((tokenSet_2_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt142 >= 1): - goto _loop142_breakloop + if (_cnt144 >= 1): + goto _loop144_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt142 - :_loop142_breakloop + ++_cnt144 + :_loop144_breakloop else: - goto _loop143_breakloop - :_loop143_breakloop + goto _loop145_breakloop + :_loop145_breakloop _givenValue = LA(1) if ((_givenValue == DEFAULT)): // 1831 d = LT(1) @@ -2140,17 +2156,17 @@ class UnityScriptParser(antlr.LLkParser): item = MacroStatement(ToLexicalInfo(d), Name: d.getText()) itemBlock = item.Body switchBlock.Add(item) - _cnt146 as int = 0 + _cnt148 as int = 0 while true: if ((tokenSet_2_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt146 >= 1): - goto _loop146_breakloop + if (_cnt148 >= 1): + goto _loop148_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt146 - :_loop146_breakloop + ++_cnt148 + :_loop148_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 @@ -2160,8 +2176,8 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS) and (tokenSet_12_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop148_breakloop - :_loop148_breakloop + goto _loop150_breakloop + :_loop150_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -2760,7 +2776,7 @@ class UnityScriptParser(antlr.LLkParser): Condition: e, TrueValue: trueValue, FalseValue: falseValue) - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -2883,8 +2899,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) else: - goto _loop170_breakloop - :_loop170_breakloop + goto _loop172_breakloop + :_loop172_breakloop elif ((_givenValue == RPAREN)): // 1831 pass // 947 else: // line 1969 @@ -2915,8 +2931,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dimensions.Add(size) else: - goto _loop173_breakloop - :_loop173_breakloop + goto _loop175_breakloop + :_loop175_breakloop match(RBRACK) if 0 == inputState.guessing: e = CodeFactory.NewArrayInitializer(tr.LexicalInfo, tr, dimensions) @@ -2960,8 +2976,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop247_breakloop - :_loop247_breakloop + goto _loop249_breakloop + :_loop249_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -2990,18 +3006,18 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched184 as bool = false + synPredMatched186 as bool = false if ((LA(1)==NEW) and (LA(2)==ID)): - _m184 as int = mark() - synPredMatched184 = true + _m186 as int = mark() + synPredMatched186 = true ++inputState.guessing try: new_array_expression() except x as RecognitionException: - synPredMatched184 = false - rewind(_m184) + synPredMatched186 = false + rewind(_m186) --inputState.guessing - if synPredMatched184: + if synPredMatched186: e=new_array_expression() elif ((LA(1)==NEW) and (LA(2)==ID)): // line 2102 match(NEW) @@ -3063,8 +3079,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ec.Add(e); else: - goto _loop213_breakloop - :_loop213_breakloop + goto _loop215_breakloop + :_loop215_breakloop elif ((_givenValue == RPAREN) or (_givenValue ==RBRACK) ): // 1827 @@ -3074,7 +3090,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_50_) + recover(ex,tokenSet_49_) else: raise @@ -3258,10 +3274,10 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched202 as bool = false + synPredMatched204 as bool = false if ((LA(1)==TYPEOF) and (tokenSet_13_.member(cast(int, LA(2))))): - _m202 as int = mark() - synPredMatched202 = true + _m204 as int = mark() + synPredMatched204 = true ++inputState.guessing try: match(TYPEOF) @@ -3269,10 +3285,10 @@ class UnityScriptParser(antlr.LLkParser): expression() match(RPAREN) except x as RecognitionException: - synPredMatched202 = false - rewind(_m202) + synPredMatched204 = false + rewind(_m204) --inputState.guessing - if synPredMatched202: + if synPredMatched204: e=typeof_with_expression() elif ((LA(1)==TYPEOF) and (tokenSet_13_.member(cast(int, LA(2))))): // line 2102 e=typeof_expression_alt() @@ -3355,10 +3371,10 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched205 as bool = false + synPredMatched207 as bool = false if ((LA(1)==TYPEOF) and (LA(2)==LPAREN)): - _m205 as int = mark() - synPredMatched205 = true + _m207 as int = mark() + synPredMatched207 = true ++inputState.guessing try: match(TYPEOF) @@ -3366,10 +3382,10 @@ class UnityScriptParser(antlr.LLkParser): type_reference() match(RPAREN) except x as RecognitionException: - synPredMatched205 = false - rewind(_m205) + synPredMatched207 = false + rewind(_m207) --inputState.guessing - if synPredMatched205: + if synPredMatched207: e=typeof_with_typeref() elif ((LA(1)==TYPEOF) and (tokenSet_13_.member(cast(int, LA(2))))): // line 2102 e=typeof_with_expression() @@ -3540,7 +3556,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_51_) + recover(ex,tokenSet_50_) else: raise @@ -3556,7 +3572,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=atom() while true: - if ((LA(1)==LBRACK) and (tokenSet_52_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACK) and (tokenSet_51_.member(cast(int, LA(2))))): lbrack = LT(1) match(LBRACK) if 0 == inputState.guessing: @@ -3569,10 +3585,10 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) slice(se) else: - goto _loop229_breakloop - :_loop229_breakloop + goto _loop231_breakloop + :_loop231_breakloop match(RBRACK) - elif ((LA(1)==DOT) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DOT) and (tokenSet_52_.member(cast(int, LA(2))))): // line 2102 match(DOT) e=member_reference_expression(e) elif ((LA(1)==LPAREN) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 @@ -3586,8 +3602,8 @@ class UnityScriptParser(antlr.LLkParser): expression_list(args) match(RPAREN) else: - goto _loop232_breakloop - :_loop232_breakloop + goto _loop234_breakloop + :_loop234_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3614,7 +3630,7 @@ class UnityScriptParser(antlr.LLkParser): match(DECREMENT) if 0 == inputState.guessing: token = preinc; operator= UnaryOperatorType.PostDecrement; - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3677,7 +3693,7 @@ class UnityScriptParser(antlr.LLkParser): tr=type_reference() if 0 == inputState.guessing: e = CastExpression(ToLexicalInfo(c), Target: e, Type: tr) - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3777,8 +3793,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop243_breakloop - :_loop243_breakloop + goto _loop245_breakloop + :_loop245_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3814,8 +3830,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop251_breakloop - :_loop251_breakloop + goto _loop253_breakloop + :_loop253_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3840,7 +3856,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=shift() while true: - if ((tokenSet_54_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((tokenSet_53_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == IN) or (_givenValue ==LESS_THAN) @@ -3894,8 +3910,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop263_breakloop - :_loop263_breakloop + goto _loop265_breakloop + :_loop265_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3915,7 +3931,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=comparison() while true: - if ((tokenSet_55_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((tokenSet_54_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == EQUALITY)): // 1831 te = LT(1) @@ -3943,8 +3959,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), op, e, r) else: - goto _loop271_breakloop - :_loop271_breakloop + goto _loop273_breakloop + :_loop273_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3970,8 +3986,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop274_breakloop - :_loop274_breakloop + goto _loop276_breakloop + :_loop276_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3997,8 +4013,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop277_breakloop - :_loop277_breakloop + goto _loop279_breakloop + :_loop279_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4024,8 +4040,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop280_breakloop - :_loop280_breakloop + goto _loop282_breakloop + :_loop282_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4052,8 +4068,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop283_breakloop - :_loop283_breakloop + goto _loop285_breakloop + :_loop285_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4080,8 +4096,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop286_breakloop - :_loop286_breakloop + goto _loop288_breakloop + :_loop288_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4128,19 +4144,19 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling lbrack = LT(1) match(LBRACK) - synPredMatched294 as bool = false - if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_56_.member(cast(int, LA(2))))): - _m294 as int = mark() - synPredMatched294 = true + synPredMatched296 as bool = false + if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_55_.member(cast(int, LA(2))))): + _m296 as int = mark() + synPredMatched296 = true ++inputState.guessing try: expression() match(FOR) except x as RecognitionException: - synPredMatched294 = false - rewind(_m294) + synPredMatched296 = false + rewind(_m296) --inputState.guessing - if synPredMatched294: + if synPredMatched296: projection=expression() match(FOR) match(LPAREN) @@ -4168,7 +4184,7 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) - elif ((tokenSet_57_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_56_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)); items = ale.Items; expression_list(items) @@ -4229,8 +4245,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dle.Items.Add(pair); else: - goto _loop302_breakloop - :_loop302_breakloop + goto _loop304_breakloop + :_loop304_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 @@ -4533,27 +4549,27 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) private static def mk_tokenSet_6_() as (long): - data = (3314930762017855266L, 17188463405060L, 0L, 0L, ) + data = (144141678981452032L, 0L, ) return data public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) private static def mk_tokenSet_7_() as (long): - data = (144141678981452032L, 0L, ) + data = (26477936541696L, 0L, ) return data public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) private static def mk_tokenSet_8_() as (long): - data = (26477936541696L, 0L, ) + data = (144141666012397568L, 0L, ) return data public static final tokenSet_8_ = BitSet(mk_tokenSet_8_()) private static def mk_tokenSet_9_() as (long): - data = (144141666012397568L, 0L, ) + data = (17690450497792L, 0L, ) return data public static final tokenSet_9_ = BitSet(mk_tokenSet_9_()) private static def mk_tokenSet_10_() as (long): - data = (17690450497792L, 0L, ) + data = (144132878526353664L, 0L, ) return data public static final tokenSet_10_ = BitSet(mk_tokenSet_10_()) private static def mk_tokenSet_11_() as (long): - data = (144132878526353664L, 0L, ) + data = (3314930762017855266L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_11_ = BitSet(mk_tokenSet_11_()) private static def mk_tokenSet_12_() as (long): @@ -4589,11 +4605,11 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) private static def mk_tokenSet_20_() as (long): - data = (3314930766312822562L, 17188463405060L, 0L, 0L, ) + data = (3423017157371811618L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) private static def mk_tokenSet_21_() as (long): - data = (-126945214502873230L, 17540646436863L, 0L, 0L, ) + data = (-18858823443884174L, 17540646436863L, 0L, 0L, ) return data public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) private static def mk_tokenSet_22_() as (long): @@ -4637,7 +4653,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) private static def mk_tokenSet_32_() as (long): - data = (-126100789568479246L, 17540646436863L, 0L, 0L, ) + data = (-18014398509490190L, 17540646436863L, 0L, 0L, ) return data public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) private static def mk_tokenSet_33_() as (long): @@ -4705,39 +4721,35 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) private static def mk_tokenSet_49_() as (long): - data = (-126100789572673550L, 17540646436863L, 0L, 0L, ) + data = (4611686018427387904L, 8L, 0L, 0L, ) return data public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) private static def mk_tokenSet_50_() as (long): - data = (4611686018427387904L, 8L, 0L, 0L, ) + data = (0L, 10L, 0L, 0L, ) return data public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) private static def mk_tokenSet_51_() as (long): - data = (0L, 10L, 0L, 0L, ) + data = (3314655235821289472L, 17179873468421L, 0L, 0L, ) return data public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) private static def mk_tokenSet_52_() as (long): - data = (3314655235821289472L, 17179873468421L, 0L, 0L, ) + data = (144115222436118528L, 33554432L, 0L, 0L, ) return data public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) private static def mk_tokenSet_53_() as (long): - data = (144115222436118528L, 33554432L, 0L, 0L, ) + data = (41943040L, 1711276032L, 0L, 0L, ) return data public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) private static def mk_tokenSet_54_() as (long): - data = (41943040L, 1711276032L, 0L, 0L, ) + data = (0L, 26738688L, 0L, 0L, ) return data public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) private static def mk_tokenSet_55_() as (long): - data = (0L, 26738688L, 0L, 0L, ) + data = (-4755795296384565168L, 17458773616348L, 0L, 0L, ) return data public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) private static def mk_tokenSet_56_() as (long): - data = (-4755795296384565168L, 17458773616348L, 0L, 0L, ) - return data - public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) - private static def mk_tokenSet_57_() as (long): data = (3314655235821289472L, 17179873468428L, 0L, 0L, ) return data - public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) + public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 14c87ef..a60a964 100644 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -243,6 +243,7 @@ start[CompileUnit cu] ( import_directive[module] | pragma_directive[module] + | (AT ID ID)=> script_or_assembly_attribute[module] )* ( (AT ID ID)=> script_or_assembly_attribute[module] diff --git a/tests/parser/attributes-for-script-and-assembly-before-import.js b/tests/parser/attributes-for-script-and-assembly-before-import.js new file mode 100644 index 0000000..b031dd7 --- /dev/null +++ b/tests/parser/attributes-for-script-and-assembly-before-import.js @@ -0,0 +1,17 @@ +/* +import Foo + +[AttributeForField] +f as float + +[module: SomeScriptAttribute] +[assembly: SomeAssemblyAttribute] +*/ +@script SomeScriptAttribute() +@assembly SomeAssemblyAttribute() + +import Foo; + +@AttributeForField var f:float; + + From c6c1d25d382e7265041e00e8e06803a1ac46ac1a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 8 Nov 2011 12:35:50 -0200 Subject: [PATCH 205/276] prefer string* over (string) --- refresh-tests.boo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refresh-tests.boo b/refresh-tests.boo index 898e8b3..4507c6b 100755 --- a/refresh-tests.boo +++ b/refresh-tests.boo @@ -54,7 +54,7 @@ Normalize string. def GenerateTestFixtureSource( header as string, - srcDirs as (string), + srcDirs as string*, testCaseProducer as callable(string) as string*, categoryProducer as callable(string) as string): From a7152d6c6cd75d073b44444bfaa7a59af039b00b Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 8 Nov 2011 12:36:25 -0200 Subject: [PATCH 206/276] update benchmark after virtual/final semantic changes (all functions are virtual by default now). --- resources/function-call-performance.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/function-call-performance.js b/resources/function-call-performance.js index 8323d30..c4ea3d5 100755 --- a/resources/function-call-performance.js +++ b/resources/function-call-performance.js @@ -2,12 +2,12 @@ import System; class Foo { public var counter = 0; - function Bar() { ++counter; } + final function Bar() { ++counter; } } class VirtualFoo { public var counter = 0; - virtual function Bar() { ++counter; } + function Bar() { ++counter; } } class VirtualFoo2 extends VirtualFoo { From 9550a0faa43ea7cb18273cfb3faa067015d52337 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 8 Nov 2011 13:08:25 -0200 Subject: [PATCH 207/276] unreachable code test cases --- tests/error-messages/for-with-unreachable-update.js | 9 +++++++++ ...p-with-no-unreacheable-code-shouldnt-cause-warning.js | 8 ++++++++ 2 files changed, 17 insertions(+) create mode 100644 tests/error-messages/for-with-unreachable-update.js create mode 100644 tests/error-messages/loop-with-no-unreacheable-code-shouldnt-cause-warning.js diff --git a/tests/error-messages/for-with-unreachable-update.js b/tests/error-messages/for-with-unreachable-update.js new file mode 100644 index 0000000..3d42d4b --- /dev/null +++ b/tests/error-messages/for-with-unreachable-update.js @@ -0,0 +1,9 @@ +/* +for-with-unreachable-update.js(5,32): BCW0015: WARNING: Unreachable code detected. +*/ +function Positive(n: int): boolean { + for (var i = 0; i < n; ++i) { // ++i is unreachable + return true; + } + return false; +} diff --git a/tests/error-messages/loop-with-no-unreacheable-code-shouldnt-cause-warning.js b/tests/error-messages/loop-with-no-unreacheable-code-shouldnt-cause-warning.js new file mode 100644 index 0000000..53906c7 --- /dev/null +++ b/tests/error-messages/loop-with-no-unreacheable-code-shouldnt-cause-warning.js @@ -0,0 +1,8 @@ +/* +*/ +function Positive(n: int[]): boolean { + for (var i in n) { + return true; + } + return false; +} From 74c3c78c3546da79aec3b087441b888f78863f7a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 8 Nov 2011 16:39:56 -0200 Subject: [PATCH 208/276] interface properties --- .../DuckyIntegrationTestFixture.boo | 4 + ...StrictIntegrationTestFixture.Generated.boo | 4 + src/UnityScript/Parser/UnityScriptLexer.boo | 126 +++--- src/UnityScript/Parser/UnityScriptParser.boo | 391 +++++++++--------- src/UnityScript/UnityScript.g | 93 ++--- tests/integration/interface-properties.js | 22 + 6 files changed, 347 insertions(+), 293 deletions(-) create mode 100644 tests/integration/interface-properties.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index ff25a75..5106f79 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -394,6 +394,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/initializeorder.js") + [Test] def interface_properties(): + RunTestCase("tests/integration/interface-properties.js") + + [Test] def interfaces_1(): RunTestCase("tests/integration/interfaces-1.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo index 8bbd64f..81356f7 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo @@ -392,6 +392,10 @@ partial class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/initializeorder.js") + [Test] def interface_properties(): + RunTestCase("tests/integration/interface-properties.js") + + [Test] def interfaces_1(): RunTestCase("tests/integration/interfaces-1.js") diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index 038afcc..f17567b 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -594,8 +594,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mDIGIT(false) else: // line 1969 - goto _loop317_breakloop - :_loop317_breakloop + goto _loop318_breakloop + :_loop318_breakloop _ttype = testLiteralsTable(_ttype) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -688,17 +688,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): match("0x") - _cnt321 as int = 0 + _cnt322 as int = 0 while true: if ((tokenSet_0_.member(cast(int, cached_LA1)))): mHEXDIGIT(false) else: - if (_cnt321 >= 1): - goto _loop321_breakloop + if (_cnt322 >= 1): + goto _loop322_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt321 - :_loop321_breakloop + ++_cnt322 + :_loop322_breakloop if ((cached_LA1==char('L') or cached_LA1==char('l'))): _givenValue = cached_LA1 if ((_givenValue == char('l'))): // 1831 @@ -712,17 +712,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): else: // line 2053 pass // 947 elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt325 as int = 0 + _cnt326 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt325 >= 1): - goto _loop325_breakloop + if (_cnt326 >= 1): + goto _loop326_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt325 - :_loop325_breakloop + ++_cnt326 + :_loop326_breakloop _givenValue = cached_LA1 if ((_givenValue == char('L')) or (_givenValue ==char('l')) @@ -818,17 +818,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_SUFFIX - _cnt334 as int = 0 + _cnt335 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt334 >= 1): - goto _loop334_breakloop + if (_cnt335 >= 1): + goto _loop335_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt334 - :_loop334_breakloop + ++_cnt335 + :_loop335_breakloop if ((cached_LA1==char('E') or cached_LA1==char('e'))): mEXPONENT(false) else: // line 2053 @@ -879,17 +879,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt341 as int = 0 + _cnt342 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt341 >= 1): - goto _loop341_breakloop + if (_cnt342 >= 1): + goto _loop342_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt341 - :_loop341_breakloop + ++_cnt342 + :_loop342_breakloop if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1129,31 +1129,31 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _saveIndex = text.Length match("#pragma") text.Length = _saveIndex - _cnt365 as int = 0 + _cnt366 as int = 0 while true: if ((cached_LA1==char('\t') or cached_LA1==char(' '))): mPRAGMA_WHITE_SPACE(false) else: - if (_cnt365 >= 1): - goto _loop365_breakloop + if (_cnt366 >= 1): + goto _loop366_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt365 - :_loop365_breakloop + ++_cnt366 + :_loop366_breakloop mID(true) id = returnToken_ if ((cached_LA1==char('\t') or cached_LA1==char(' ')) and (cached_LA2==char('\t') or cached_LA2==char(' ') or cached_LA2==char('o')) and (LA(3)==char('\t') or LA(3)==char(' ') or LA(3)==char('f') or LA(3)==char('n') or LA(3)==char('o'))): - _cnt368 as int = 0 + _cnt369 as int = 0 while true: if ((cached_LA1==char('\t') or cached_LA1==char(' '))): mPRAGMA_WHITE_SPACE(false) else: - if (_cnt368 >= 1): - goto _loop368_breakloop + if (_cnt369 >= 1): + goto _loop369_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt368 - :_loop368_breakloop + ++_cnt369 + :_loop369_breakloop if ((cached_LA1==char('o')) and (cached_LA2==char('f'))): _saveIndex = text.Length match("off") @@ -1174,8 +1174,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('\t') or cached_LA1==char(' '))): mPRAGMA_WHITE_SPACE(false) else: - goto _loop371_breakloop - :_loop371_breakloop + goto _loop372_breakloop + :_loop372_breakloop _saveIndex = text.Length mNEWLINE(false) text.Length = _saveIndex @@ -1450,18 +1450,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched398 as bool = false + synPredMatched399 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m398 as int = mark() - synPredMatched398 = true + _m399 as int = mark() + synPredMatched399 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched398 = false - rewind(_m398) + synPredMatched399 = false + rewind(_m399) --inputState.guessing - if synPredMatched398: + if synPredMatched399: mML_COMMENT(false) if 0 == inputState.guessing: if not PreserveComments: @@ -1475,8 +1475,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop403_breakloop - :_loop403_breakloop + goto _loop404_breakloop + :_loop404_breakloop if 0 == inputState.guessing: if PreserveComments: _ttype = SL_COMMENT @@ -1508,8 +1508,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop432_breakloop - :_loop432_breakloop + goto _loop433_breakloop + :_loop433_breakloop match("*/") if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1520,7 +1520,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt407 as int = 0 + _cnt408 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1534,12 +1534,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt407 >= 1): - goto _loop407_breakloop + if (_cnt408 >= 1): + goto _loop408_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt407 - :_loop407_breakloop + ++_cnt408 + :_loop408_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1560,8 +1560,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop411_breakloop - :_loop411_breakloop + goto _loop412_breakloop + :_loop412_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1610,8 +1610,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_4_) else: - goto _loop415_breakloop - :_loop415_breakloop + goto _loop416_breakloop + :_loop416_breakloop _saveIndex = text.Length match('\'') text.Length = _saveIndex @@ -1712,17 +1712,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt435 as int = 0 + _cnt436 as int = 0 while true: if ((tokenSet_5_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt435 >= 1): - goto _loop435_breakloop + if (_cnt436 >= 1): + goto _loop436_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt435 - :_loop435_breakloop + ++_cnt436 + :_loop436_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1780,17 +1780,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt441 as int = 0 + _cnt442 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt441 >= 1): - goto _loop441_breakloop + if (_cnt442 >= 1): + goto _loop442_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt441 - :_loop441_breakloop + ++_cnt442 + :_loop442_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 47b4e63..1501080 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -195,9 +195,6 @@ class UnityScriptParser(antlr.LLkParser): UnityScriptParameters as UnityScriptCompilerParameters: get: return _context.Parameters - static def ToLexicalInfo(token as antlr.IToken): - return LexicalInfo(token.getFilename(), token.getLine(), token.getColumn()) - static def SetEndSourceLocation(node as Node, token as antlr.IToken): node.EndSourceLocation = ToSourceLocation(token) @@ -205,6 +202,9 @@ class UnityScriptParser(antlr.LLkParser): text = token.getText() tokenLength = (0 if text is null else len(text)-1) return SourceLocation(token.getLine(), token.getColumn()+tokenLength) + + static def ToLexicalInfo(token as antlr.IToken): + return LexicalInfo(token.getFilename(), token.getLine(), token.getColumn()) static def ParseIntegerLiteralExpression(token as antlr.IToken, s as string, @@ -253,7 +253,42 @@ class UnityScriptParser(antlr.LLkParser): static def CreateModuleName(fname as string): return System.IO.Path.GetFileNameWithoutExtension(fname) - + + def AddFunctionTo(type as TypeDefinition, nameToken as IToken, getter as IToken, setter as IToken): + + name = nameToken.getText() + location = ToLexicalInfo(nameToken) + + function as Method = (Constructor(location) if name == type.Name else Method(location, Name: name)) + if getter is not null or setter is not null: + p = type.Members[name] as Property + if p is null: + p = Property(location, Name: name) + type.Members.Add(p) + if getter is not null: + assert p.Getter is null + p.Getter = function + else: + assert p.Setter is null + p.Setter = function + FlushAttributes(p) + else: + type.Members.Add(function) + FlushAttributes(function) + return function + + def ValidateFunctionDeclaration(function as Method, getter as IToken, setter as IToken): + // TODO: move this error checking to a compiler step + // as well as properly checking the type of the accessors + // against the type of the property + if setter is not null: + if function.Parameters.Count != 1 or function.Parameters[0].Name != "value": + ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(function.LexicalInfo)) + function.Parameters.Clear() + return + if getter is not null: + if function.Parameters.Count > 0: + ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(function.LexicalInfo)) protected def initialize(): tokenNames = tokenNames_ @@ -610,17 +645,17 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) eos() elif ((_givenValue == EOS)): // 1831 - _cnt111 as int = 0 + _cnt112 as int = 0 while true: if ((LA(1)==EOS) and (tokenSet_12_.member(cast(int, LA(2))))): match(EOS) else: - if (_cnt111 >= 1): - goto _loop111_breakloop + if (_cnt112 >= 1): + goto _loop112_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt111 - :_loop111_breakloop + ++_cnt112 + :_loop112_breakloop else: // line 1969 raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: @@ -678,8 +713,8 @@ class UnityScriptParser(antlr.LLkParser): match(DOT) e=member_reference_expression(e) else: - goto _loop197_breakloop - :_loop197_breakloop + goto _loop198_breakloop + :_loop198_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1199,8 +1234,8 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) enum_member(ed) else: - goto _loop76_breakloop - :_loop76_breakloop + goto _loop77_breakloop + :_loop77_breakloop _givenValue = LA(1) if ((_givenValue == COMMA)): // 1831 match(COMMA) @@ -1220,8 +1255,8 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS) and (tokenSet_30_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop79_breakloop - :_loop79_breakloop + goto _loop80_breakloop + :_loop80_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1518,8 +1553,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ++rank else: - goto _loop166_breakloop - :_loop166_breakloop + goto _loop167_breakloop + :_loop167_breakloop match(RBRACK) if 0 == inputState.guessing: tr = ArrayTypeReference(tr.LexicalInfo, tr, IntegerLiteralExpression(ToLexicalInfo(lbrack), rank)) @@ -1551,8 +1586,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: typeReferences.Add(tr) else: - goto _loop182_breakloop - :_loop182_breakloop + goto _loop183_breakloop + :_loop183_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1586,36 +1621,10 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) memberName=identifier() if 0 == inputState.guessing: - method as Method - if memberName.getText() == cd.Name: - member = method = Constructor(ToLexicalInfo(memberName)) - else: - member = method = Method(ToLexicalInfo(memberName), Name: memberName.getText()) - if getter is not null or setter is not null: - p = cd.Members[memberName.getText()] as Property - if p is null: - p = Property(ToLexicalInfo(memberName), Name: memberName.getText()) - cd.Members.Add(p) - if getter is not null: - p.Getter = method - else: - p.Setter = method - FlushAttributes(p) - else: - cd.Members.Add(method) - FlushAttributes(method) - function_body(method) + member = function = AddFunctionTo(cd, memberName, getter, setter) + function_body(function) if 0 == inputState.guessing: - // TODO: move this error checking to a compiler step - // as well as properly checking the type of the accessors - // against the type of the property - if setter is not null: - if method.Parameters.Count != 1 or method.Parameters[0].Name != "value": - ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(ToLexicalInfo(memberName))) - method.Parameters.Clear() - if getter is not null: - if method.Parameters.Count > 0: - ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(ToLexicalInfo(memberName))) + ValidateFunctionDeclaration(function, getter, setter) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1628,16 +1637,28 @@ class UnityScriptParser(antlr.LLkParser): parent as TypeDefinition ) as void: //throws RecognitionException, TokenStreamException - name as IToken = null + getter as IToken = null + setter as IToken = null try: // for error handling match(FUNCTION) - name = LT(1) - match(ID) + _givenValue = LA(1) + if ((_givenValue == GET)): // 1831 + getter = LT(1) + match(GET) + elif ((_givenValue == SET)): // 1831 + setter = LT(1) + match(SET) + elif ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + memberName=identifier() if 0 == inputState.guessing: - method = Method(ToLexicalInfo(name), Name: name.getText()) - FlushAttributes(method) - parent.Members.Add(method) + function = AddFunctionTo(parent, memberName, getter, setter) match(LPAREN) _givenValue = LA(1) if ((_givenValue == FINAL) @@ -1645,18 +1666,20 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==ID) or (_givenValue ==AT) ): // 1827 - parameter_declaration_list(method) + parameter_declaration_list(function) elif ((_givenValue == RPAREN)): // 1831 pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) match(RPAREN) + if 0 == inputState.guessing: + ValidateFunctionDeclaration(function, getter, setter) _givenValue = LA(1) if ((_givenValue == COLON)): // 1831 match(COLON) tr=type_reference() if 0 == inputState.guessing: - method.ReturnType = tr; + function.ReturnType = tr; elif ((_givenValue == FUNCTION) or (_givenValue ==RBRACE) or (_givenValue ==EOS) @@ -1669,8 +1692,8 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS)): match(EOS) else: - goto _loop72_breakloop - :_loop72_breakloop + goto _loop73_breakloop + :_loop73_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1678,6 +1701,40 @@ class UnityScriptParser(antlr.LLkParser): else: raise + public def identifier() as antlr.IToken : //throws RecognitionException, TokenStreamException + token as antlr.IToken + + name as IToken = null + f as IToken = null + i as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + name = LT(1) + match(ID) + if 0 == inputState.guessing: + token = name; + elif ((_givenValue == FINAL)): // 1831 + f = LT(1) + match(FINAL) + if 0 == inputState.guessing: + token = f; KeywordCannotBeUsedAsAnIdentifier(token); + elif ((_givenValue == INTERNAL)): // 1831 + i = LT(1) + match(INTERNAL) + if 0 == inputState.guessing: + token = i; KeywordCannotBeUsedAsAnIdentifier(token); + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_36_) + else: + raise + return token + public def parameter_declaration_list( m as INodeWithParameters ) as void: //throws RecognitionException, TokenStreamException @@ -1690,12 +1747,12 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) parameter_declaration(m) else: - goto _loop94_breakloop - :_loop94_breakloop + goto _loop95_breakloop + :_loop95_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_37_) else: raise @@ -1732,7 +1789,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_37_) + recover(ex,tokenSet_38_) else: raise @@ -1765,40 +1822,6 @@ class UnityScriptParser(antlr.LLkParser): raise return e - public def identifier() as antlr.IToken : //throws RecognitionException, TokenStreamException - token as antlr.IToken - - name as IToken = null - f as IToken = null - i as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - name = LT(1) - match(ID) - if 0 == inputState.guessing: - token = name; - elif ((_givenValue == FINAL)): // 1831 - f = LT(1) - match(FINAL) - if 0 == inputState.guessing: - token = f; KeywordCannotBeUsedAsAnIdentifier(token); - elif ((_givenValue == INTERNAL)): // 1831 - i = LT(1) - match(INTERNAL) - if 0 == inputState.guessing: - token = i; KeywordCannotBeUsedAsAnIdentifier(token); - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_38_) - else: - raise - return token - public def compound_statement( b as Block ) as void: //throws RecognitionException, TokenStreamException @@ -1810,8 +1833,8 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS) and (tokenSet_39_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop101_breakloop - :_loop101_breakloop + goto _loop102_breakloop + :_loop102_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1888,8 +1911,8 @@ class UnityScriptParser(antlr.LLkParser): if ((tokenSet_2_.member(cast(int, LA(1))))): statement(b) else: - goto _loop104_breakloop - :_loop104_breakloop + goto _loop105_breakloop + :_loop105_breakloop rbrace = LT(1) match(RBRACE) if 0 == inputState.guessing: @@ -1966,10 +1989,10 @@ class UnityScriptParser(antlr.LLkParser): f = LT(1) match(FOR) match(LPAREN) - synPredMatched127 as bool = false + synPredMatched128 as bool = false if ((tokenSet_42_.member(cast(int, LA(1)))) and (tokenSet_43_.member(cast(int, LA(2))))): - _m127 as int = mark() - synPredMatched127 = true + _m128 as int = mark() + synPredMatched128 = true ++inputState.guessing try: _givenValue = LA(1) @@ -1984,10 +2007,10 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) match(IN) except x as RecognitionException: - synPredMatched127 = false - rewind(_m127) + synPredMatched128 = false + rewind(_m128) --inputState.guessing - if synPredMatched127: + if synPredMatched128: stmt=for_in(container) elif ((tokenSet_44_.member(cast(int, LA(1)))) and (tokenSet_45_.member(cast(int, LA(2))))): // line 2102 stmt=for_c(container) @@ -2077,8 +2100,8 @@ class UnityScriptParser(antlr.LLkParser): tr = null compound_or_single_stmt(b) else: - goto _loop154_breakloop - :_loop154_breakloop + goto _loop155_breakloop + :_loop155_breakloop if ((LA(1)==FINALLY) and (tokenSet_2_.member(cast(int, LA(2))))): finally_block(s) elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 @@ -2131,22 +2154,22 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: item.Arguments.Add(e); else: - goto _loop142_breakloop - :_loop142_breakloop - _cnt144 as int = 0 + goto _loop143_breakloop + :_loop143_breakloop + _cnt145 as int = 0 while true: if ((tokenSet_2_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt144 >= 1): - goto _loop144_breakloop + if (_cnt145 >= 1): + goto _loop145_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt144 - :_loop144_breakloop + ++_cnt145 + :_loop145_breakloop else: - goto _loop145_breakloop - :_loop145_breakloop + goto _loop146_breakloop + :_loop146_breakloop _givenValue = LA(1) if ((_givenValue == DEFAULT)): // 1831 d = LT(1) @@ -2156,17 +2179,17 @@ class UnityScriptParser(antlr.LLkParser): item = MacroStatement(ToLexicalInfo(d), Name: d.getText()) itemBlock = item.Body switchBlock.Add(item) - _cnt148 as int = 0 + _cnt149 as int = 0 while true: if ((tokenSet_2_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt148 >= 1): - goto _loop148_breakloop + if (_cnt149 >= 1): + goto _loop149_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt148 - :_loop148_breakloop + ++_cnt149 + :_loop149_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 @@ -2176,8 +2199,8 @@ class UnityScriptParser(antlr.LLkParser): if ((LA(1)==EOS) and (tokenSet_12_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop150_breakloop - :_loop150_breakloop + goto _loop151_breakloop + :_loop151_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -2899,8 +2922,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) else: - goto _loop172_breakloop - :_loop172_breakloop + goto _loop173_breakloop + :_loop173_breakloop elif ((_givenValue == RPAREN)): // 1831 pass // 947 else: // line 1969 @@ -2931,8 +2954,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dimensions.Add(size) else: - goto _loop175_breakloop - :_loop175_breakloop + goto _loop176_breakloop + :_loop176_breakloop match(RBRACK) if 0 == inputState.guessing: e = CodeFactory.NewArrayInitializer(tr.LexicalInfo, tr, dimensions) @@ -2976,8 +2999,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop249_breakloop - :_loop249_breakloop + goto _loop250_breakloop + :_loop250_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3006,18 +3029,18 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched186 as bool = false + synPredMatched187 as bool = false if ((LA(1)==NEW) and (LA(2)==ID)): - _m186 as int = mark() - synPredMatched186 = true + _m187 as int = mark() + synPredMatched187 = true ++inputState.guessing try: new_array_expression() except x as RecognitionException: - synPredMatched186 = false - rewind(_m186) + synPredMatched187 = false + rewind(_m187) --inputState.guessing - if synPredMatched186: + if synPredMatched187: e=new_array_expression() elif ((LA(1)==NEW) and (LA(2)==ID)): // line 2102 match(NEW) @@ -3079,8 +3102,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ec.Add(e); else: - goto _loop215_breakloop - :_loop215_breakloop + goto _loop216_breakloop + :_loop216_breakloop elif ((_givenValue == RPAREN) or (_givenValue ==RBRACK) ): // 1827 @@ -3274,10 +3297,10 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched204 as bool = false + synPredMatched205 as bool = false if ((LA(1)==TYPEOF) and (tokenSet_13_.member(cast(int, LA(2))))): - _m204 as int = mark() - synPredMatched204 = true + _m205 as int = mark() + synPredMatched205 = true ++inputState.guessing try: match(TYPEOF) @@ -3285,10 +3308,10 @@ class UnityScriptParser(antlr.LLkParser): expression() match(RPAREN) except x as RecognitionException: - synPredMatched204 = false - rewind(_m204) + synPredMatched205 = false + rewind(_m205) --inputState.guessing - if synPredMatched204: + if synPredMatched205: e=typeof_with_expression() elif ((LA(1)==TYPEOF) and (tokenSet_13_.member(cast(int, LA(2))))): // line 2102 e=typeof_expression_alt() @@ -3371,10 +3394,10 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched207 as bool = false + synPredMatched208 as bool = false if ((LA(1)==TYPEOF) and (LA(2)==LPAREN)): - _m207 as int = mark() - synPredMatched207 = true + _m208 as int = mark() + synPredMatched208 = true ++inputState.guessing try: match(TYPEOF) @@ -3382,10 +3405,10 @@ class UnityScriptParser(antlr.LLkParser): type_reference() match(RPAREN) except x as RecognitionException: - synPredMatched207 = false - rewind(_m207) + synPredMatched208 = false + rewind(_m208) --inputState.guessing - if synPredMatched207: + if synPredMatched208: e=typeof_with_typeref() elif ((LA(1)==TYPEOF) and (tokenSet_13_.member(cast(int, LA(2))))): // line 2102 e=typeof_with_expression() @@ -3585,8 +3608,8 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) slice(se) else: - goto _loop231_breakloop - :_loop231_breakloop + goto _loop232_breakloop + :_loop232_breakloop match(RBRACK) elif ((LA(1)==DOT) and (tokenSet_52_.member(cast(int, LA(2))))): // line 2102 match(DOT) @@ -3602,8 +3625,8 @@ class UnityScriptParser(antlr.LLkParser): expression_list(args) match(RPAREN) else: - goto _loop234_breakloop - :_loop234_breakloop + goto _loop235_breakloop + :_loop235_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3793,8 +3816,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop245_breakloop - :_loop245_breakloop + goto _loop246_breakloop + :_loop246_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3830,8 +3853,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop253_breakloop - :_loop253_breakloop + goto _loop254_breakloop + :_loop254_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3910,8 +3933,8 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop265_breakloop - :_loop265_breakloop + goto _loop266_breakloop + :_loop266_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3959,8 +3982,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), op, e, r) else: - goto _loop273_breakloop - :_loop273_breakloop + goto _loop274_breakloop + :_loop274_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -3986,8 +4009,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop276_breakloop - :_loop276_breakloop + goto _loop277_breakloop + :_loop277_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4013,8 +4036,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop279_breakloop - :_loop279_breakloop + goto _loop280_breakloop + :_loop280_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4040,8 +4063,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop282_breakloop - :_loop282_breakloop + goto _loop283_breakloop + :_loop283_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4068,8 +4091,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop285_breakloop - :_loop285_breakloop + goto _loop286_breakloop + :_loop286_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4096,8 +4119,8 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop288_breakloop - :_loop288_breakloop + goto _loop289_breakloop + :_loop289_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -4144,19 +4167,19 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling lbrack = LT(1) match(LBRACK) - synPredMatched296 as bool = false + synPredMatched297 as bool = false if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_55_.member(cast(int, LA(2))))): - _m296 as int = mark() - synPredMatched296 = true + _m297 as int = mark() + synPredMatched297 = true ++inputState.guessing try: expression() match(FOR) except x as RecognitionException: - synPredMatched296 = false - rewind(_m296) + synPredMatched297 = false + rewind(_m297) --inputState.guessing - if synPredMatched296: + if synPredMatched297: projection=expression() match(FOR) match(LPAREN) @@ -4245,8 +4268,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dle.Items.Add(pair); else: - goto _loop304_breakloop - :_loop304_breakloop + goto _loop305_breakloop + :_loop305_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 @@ -4393,7 +4416,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_37_) + recover(ex,tokenSet_38_) else: raise return ep @@ -4669,15 +4692,15 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) private static def mk_tokenSet_36_() as (long): - data = (4611686018427387904L, 0L, ) + data = (9080382714285645730L, 17188463409159L, 0L, 0L, ) return data public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) private static def mk_tokenSet_37_() as (long): - data = (1152921504606846976L, 2L, 0L, 0L, ) + data = (4611686018427387904L, 0L, ) return data public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) private static def mk_tokenSet_38_() as (long): - data = (9080382714285645730L, 17188463409159L, 0L, 0L, ) + data = (1152921504606846976L, 2L, 0L, 0L, ) return data public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) private static def mk_tokenSet_39_() as (long): diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index a60a964..3a3d0b3 100644 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -172,9 +172,6 @@ tokens UnityScriptParameters as UnityScriptCompilerParameters: get: return _context.Parameters - static def ToLexicalInfo(token as antlr.IToken): - return LexicalInfo(token.getFilename(), token.getLine(), token.getColumn()) - static def SetEndSourceLocation(node as Node, token as antlr.IToken): node.EndSourceLocation = ToSourceLocation(token) @@ -182,6 +179,9 @@ tokens text = token.getText() tokenLength = (0 if text is null else len(text)-1) return SourceLocation(token.getLine(), token.getColumn()+tokenLength) + + static def ToLexicalInfo(token as antlr.IToken): + return LexicalInfo(token.getFilename(), token.getLine(), token.getColumn()) static def ParseIntegerLiteralExpression(token as antlr.IToken, s as string, @@ -230,7 +230,42 @@ tokens static def CreateModuleName(fname as string): return System.IO.Path.GetFileNameWithoutExtension(fname) - + + def AddFunctionTo(type as TypeDefinition, nameToken as IToken, getter as IToken, setter as IToken): + + name = nameToken.getText() + location = ToLexicalInfo(nameToken) + + function as Method = (Constructor(location) if name == type.Name else Method(location, Name: name)) + if getter is not null or setter is not null: + p = type.Members[name] as Property + if p is null: + p = Property(location, Name: name) + type.Members.Add(p) + if getter is not null: + assert p.Getter is null + p.Getter = function + else: + assert p.Setter is null + p.Setter = function + FlushAttributes(p) + else: + type.Members.Add(function) + FlushAttributes(function) + return function + + def ValidateFunctionDeclaration(function as Method, getter as IToken, setter as IToken): + // TODO: move this error checking to a compiler step + // as well as properly checking the type of the accessors + // against the type of the property + if setter is not null: + if function.Parameters.Count != 1 or function.Parameters[0].Name != "value": + ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(function.LexicalInfo)) + function.Parameters.Clear() + return + if getter is not null: + if function.Parameters.Count > 0: + ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(function.LexicalInfo)) } start[CompileUnit cu] @@ -524,15 +559,14 @@ interface_declaration[TypeDefinition parent] returns [TypeMember member] interface_member[TypeDefinition parent] { }: - FUNCTION name:ID + FUNCTION (getter:GET | setter:SET)? memberName=identifier { - method = Method(ToLexicalInfo(name), Name: name.getText()) - FlushAttributes(method) - parent.Members.Add(method) + function = AddFunctionTo(parent, memberName, getter, setter) } - LPAREN (parameter_declaration_list[method])? RPAREN + LPAREN (parameter_declaration_list[function])? RPAREN + { ValidateFunctionDeclaration(function, getter, setter) } ( - COLON tr=type_reference { method.ReturnType = tr; } + COLON tr=type_reference { function.ReturnType = tr; } )? (EOS)* ; @@ -598,42 +632,9 @@ function_member[ClassDefinition cd] returns [TypeMember member] { }: FUNCTION (getter:GET | setter:SET)? memberName=identifier - { - method as Method - if memberName.getText() == cd.Name: - member = method = Constructor(ToLexicalInfo(memberName)) - else: - member = method = Method(ToLexicalInfo(memberName), Name: memberName.getText()) - - if getter is not null or setter is not null: - p = cd.Members[memberName.getText()] as Property - if p is null: - p = Property(ToLexicalInfo(memberName), Name: memberName.getText()) - cd.Members.Add(p) - if getter is not null: - p.Getter = method - else: - p.Setter = method - FlushAttributes(p) - else: - cd.Members.Add(method) - FlushAttributes(method) - } - - function_body[method] - - { - // TODO: move this error checking to a compiler step - // as well as properly checking the type of the accessors - // against the type of the property - if setter is not null: - if method.Parameters.Count != 1 or method.Parameters[0].Name != "value": - ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(ToLexicalInfo(memberName))) - method.Parameters.Clear() - if getter is not null: - if method.Parameters.Count > 0: - ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(ToLexicalInfo(memberName))) - } + { member = function = AddFunctionTo(cd, memberName, getter, setter) } + function_body[function] + { ValidateFunctionDeclaration(function, getter, setter) } ; function_body[Method method] diff --git a/tests/integration/interface-properties.js b/tests/integration/interface-properties.js new file mode 100644 index 0000000..86c2920 --- /dev/null +++ b/tests/integration/interface-properties.js @@ -0,0 +1,22 @@ +/* +foo +bar +*/ +interface I { + function get message(): String; +} + +class Foo implements I { + function get message() { return "foo"; } +} + +class Bar implements I { + function get message() { return "bar"; } +} + +function doIt(i: I) { + print(i.message); +} + +doIt(new Foo()); +doIt(new Bar()); From 01c49b94c39c02034427f9a9fc626f64932f75b2 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 8 Nov 2011 16:40:50 -0200 Subject: [PATCH 209/276] test case methods missing from a previous commit --- .../ErrorMessagesTestFixture.Generated.boo | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index 93b808f..72380ec 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -54,6 +54,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/for-variable-already-defined.js") + [Test] def for_with_unreachable_update(): + RunTestCase("tests/error-messages/for-with-unreachable-update.js") + + [Test] def function_type_name(): RunTestCase("tests/error-messages/function-type-name.js") @@ -90,6 +94,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/iterator-warning.js") + [Test] def loop_with_no_unreacheable_code_shouldnt_cause_warning(): + RunTestCase("tests/error-messages/loop-with-no-unreacheable-code-shouldnt-cause-warning.js") + + [Test] def missing_brace(): RunTestCase("tests/error-messages/missing-brace.js") From d1e745c982010eabe44ebfd984f179158bed348e Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 8 Nov 2011 16:42:19 -0200 Subject: [PATCH 210/276] don't generate a behaviour class when the file contains only type definitions --- .../ProjectIntegrationTestFixture.Generated.boo | 4 ++++ src/UnityScript/Steps/ApplySemantics.boo | 6 ++++++ tests/projects/interfaces/1-main.js | 10 ++++++++++ tests/projects/interfaces/Interface.js | 3 +++ tests/semantics/fields-1.js | 8 -------- 5 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 tests/projects/interfaces/1-main.js create mode 100644 tests/projects/interfaces/Interface.js diff --git a/src/UnityScript.Tests/ProjectIntegrationTestFixture.Generated.boo b/src/UnityScript.Tests/ProjectIntegrationTestFixture.Generated.boo index 43c4988..40e81c3 100644 --- a/src/UnityScript.Tests/ProjectIntegrationTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ProjectIntegrationTestFixture.Generated.boo @@ -8,4 +8,8 @@ partial class ProjectIntegrationTestFixture: [Test] def ducky_mixed_with_pragma_strict(): RunTestCase("tests/projects/ducky-mixed-with-pragma-strict") + + + [Test] def interfaces(): + RunTestCase("tests/projects/interfaces") \ No newline at end of file diff --git a/src/UnityScript/Steps/ApplySemantics.boo b/src/UnityScript/Steps/ApplySemantics.boo index aa91e14..e6cb8ee 100644 --- a/src/UnityScript/Steps/ApplySemantics.boo +++ b/src/UnityScript/Steps/ApplySemantics.boo @@ -4,6 +4,7 @@ import UnityScript.Core import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.Steps +import System.Linq class ApplySemantics(AbstractVisitorCompilerStep): @@ -39,6 +40,8 @@ class ApplySemantics(AbstractVisitorCompilerStep): override def OnModule(module as Module): SetUpDefaultImports(module) + if ModuleContainsOnlyTypeDefinitions(module): + return script = FindOrCreateScriptClass(module) MakeItPartial(script) @@ -48,6 +51,9 @@ class ApplySemantics(AbstractVisitorCompilerStep): module.Members.Add(script) SetScriptClass(Context, script) + def ModuleContainsOnlyTypeDefinitions(module as Module): + return module.Globals.IsEmpty and module.Attributes.IsEmpty and module.Members.All({ m | m isa TypeDefinition }) + def SetUpMainMethod(module as Module, script as TypeDefinition): TransformGlobalVariablesIntoFields(module, script) diff --git a/tests/projects/interfaces/1-main.js b/tests/projects/interfaces/1-main.js new file mode 100644 index 0000000..612c177 --- /dev/null +++ b/tests/projects/interfaces/1-main.js @@ -0,0 +1,10 @@ +/* +42 +*/ +class Impl implements Interface { + function get value() { return 42; } +} + +function dump(itf: Interface) { print(itf.value); } + +dump(new Impl()); diff --git a/tests/projects/interfaces/Interface.js b/tests/projects/interfaces/Interface.js new file mode 100644 index 0000000..e4d4765 --- /dev/null +++ b/tests/projects/interfaces/Interface.js @@ -0,0 +1,3 @@ +interface Interface { + function get value(): int; +} diff --git a/tests/semantics/fields-1.js b/tests/semantics/fields-1.js index 17f6f9f..528770b 100644 --- a/tests/semantics/fields-1.js +++ b/tests/semantics/fields-1.js @@ -9,14 +9,6 @@ public class Fields(Object): public def constructor(): super() - -partial public class fields-1(UnityScript.Tests.MonoBehaviour): - - public virtual def Awake() as void: - pass - - public def constructor(): - super() */ class Fields { var FirstName:String; From 75147700c3b3978091938ca30e9ce75356afb3b3 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 8 Nov 2011 17:19:26 -0200 Subject: [PATCH 211/276] use different names for each main script in tests/projects to avoid assembly name conflicts on windows (the main/first script gives name to the assembly) --- .../{1-main.js => 1-ducky-operators-main.js} | 0 tests/projects/interfaces/{1-main.js => 1-interfaces-main.js} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename tests/projects/ducky-mixed-with-pragma-strict/{1-main.js => 1-ducky-operators-main.js} (100%) rename tests/projects/interfaces/{1-main.js => 1-interfaces-main.js} (100%) diff --git a/tests/projects/ducky-mixed-with-pragma-strict/1-main.js b/tests/projects/ducky-mixed-with-pragma-strict/1-ducky-operators-main.js similarity index 100% rename from tests/projects/ducky-mixed-with-pragma-strict/1-main.js rename to tests/projects/ducky-mixed-with-pragma-strict/1-ducky-operators-main.js diff --git a/tests/projects/interfaces/1-main.js b/tests/projects/interfaces/1-interfaces-main.js similarity index 100% rename from tests/projects/interfaces/1-main.js rename to tests/projects/interfaces/1-interfaces-main.js From 3537c739013558e9c6b63e8f1fc34180724925ef Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 30 Nov 2011 16:09:50 -0200 Subject: [PATCH 212/276] prefer single line blocks --- src/UnityScript/UnityScript.g | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 3a3d0b3..99a44d7 100644 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -733,30 +733,23 @@ yield_statement[Block b] { }: yt:YIELD (e=expression)? - { - b.Add(YieldStatement(ToLexicalInfo(yt), Expression: e)) - } + { b.Add(YieldStatement(ToLexicalInfo(yt), Expression: e)) } ; return_statement[Block b] { }: ret:RETURN (e=expression)? - { - b.Add(ReturnStatement(ToLexicalInfo(ret), Expression: e)) - } + { b.Add(ReturnStatement(ToLexicalInfo(ret), Expression: e)) } ; break_statement[Block b] { }: t:BREAK - { - b.Add(BreakStatement(ToLexicalInfo(t))) - } + { b.Add(BreakStatement(ToLexicalInfo(t))) } ; - continue_statement[Block b] { }: @@ -776,9 +769,7 @@ throw_statement[Block b] { }: t:THROW (e=expression)? - { - b.Add(RaiseStatement(ToLexicalInfo(t), Exception: e)) - } + { b.Add(RaiseStatement(ToLexicalInfo(t), Exception: e)) } ; @@ -786,9 +777,7 @@ expression_statement[Block b] { }: e=assignment_expression - { - b.Add(ExpressionStatement(e)) - } + { b.Add(ExpressionStatement(e)) } ; for_statement [Block container] From d4f1037c5c1cd80bdd40be3c01c61d0feca7a7bf Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 30 Nov 2011 16:18:24 -0200 Subject: [PATCH 213/276] initial support for macro applications --- .../ParserTestFixture.Generated.boo | 4 + src/UnityScript/Parser/UnityScriptLexer.boo | 126 +- src/UnityScript/Parser/UnityScriptParser.boo | 1027 +++++++++-------- src/UnityScript/UnityScript.g | 36 +- tests/parser/macro-application-blocks.js | 26 + 5 files changed, 678 insertions(+), 541 deletions(-) create mode 100644 tests/parser/macro-application-blocks.js diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index 58f213e..7694223 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -166,6 +166,10 @@ partial class ParserTestFixture: RunTestCase("tests/parser/lambdas.js") + [Test] def macro_application_blocks(): + RunTestCase("tests/parser/macro-application-blocks.js") + + [Test] def nested_classes(): RunTestCase("tests/parser/nested-classes.js") diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index f17567b..464adef 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -594,8 +594,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mDIGIT(false) else: // line 1969 - goto _loop318_breakloop - :_loop318_breakloop + goto _loop328_breakloop + :_loop328_breakloop _ttype = testLiteralsTable(_ttype) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -688,17 +688,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): match("0x") - _cnt322 as int = 0 + _cnt332 as int = 0 while true: if ((tokenSet_0_.member(cast(int, cached_LA1)))): mHEXDIGIT(false) else: - if (_cnt322 >= 1): - goto _loop322_breakloop + if (_cnt332 >= 1): + goto _loop332_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt322 - :_loop322_breakloop + ++_cnt332 + :_loop332_breakloop if ((cached_LA1==char('L') or cached_LA1==char('l'))): _givenValue = cached_LA1 if ((_givenValue == char('l'))): // 1831 @@ -712,17 +712,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): else: // line 2053 pass // 947 elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt326 as int = 0 + _cnt336 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt326 >= 1): - goto _loop326_breakloop + if (_cnt336 >= 1): + goto _loop336_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt326 - :_loop326_breakloop + ++_cnt336 + :_loop336_breakloop _givenValue = cached_LA1 if ((_givenValue == char('L')) or (_givenValue ==char('l')) @@ -818,17 +818,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_SUFFIX - _cnt335 as int = 0 + _cnt345 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt335 >= 1): - goto _loop335_breakloop + if (_cnt345 >= 1): + goto _loop345_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt335 - :_loop335_breakloop + ++_cnt345 + :_loop345_breakloop if ((cached_LA1==char('E') or cached_LA1==char('e'))): mEXPONENT(false) else: // line 2053 @@ -879,17 +879,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt342 as int = 0 + _cnt352 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt342 >= 1): - goto _loop342_breakloop + if (_cnt352 >= 1): + goto _loop352_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt342 - :_loop342_breakloop + ++_cnt352 + :_loop352_breakloop if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1129,31 +1129,31 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _saveIndex = text.Length match("#pragma") text.Length = _saveIndex - _cnt366 as int = 0 + _cnt376 as int = 0 while true: if ((cached_LA1==char('\t') or cached_LA1==char(' '))): mPRAGMA_WHITE_SPACE(false) else: - if (_cnt366 >= 1): - goto _loop366_breakloop + if (_cnt376 >= 1): + goto _loop376_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt366 - :_loop366_breakloop + ++_cnt376 + :_loop376_breakloop mID(true) id = returnToken_ if ((cached_LA1==char('\t') or cached_LA1==char(' ')) and (cached_LA2==char('\t') or cached_LA2==char(' ') or cached_LA2==char('o')) and (LA(3)==char('\t') or LA(3)==char(' ') or LA(3)==char('f') or LA(3)==char('n') or LA(3)==char('o'))): - _cnt369 as int = 0 + _cnt379 as int = 0 while true: if ((cached_LA1==char('\t') or cached_LA1==char(' '))): mPRAGMA_WHITE_SPACE(false) else: - if (_cnt369 >= 1): - goto _loop369_breakloop + if (_cnt379 >= 1): + goto _loop379_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt369 - :_loop369_breakloop + ++_cnt379 + :_loop379_breakloop if ((cached_LA1==char('o')) and (cached_LA2==char('f'))): _saveIndex = text.Length match("off") @@ -1174,8 +1174,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('\t') or cached_LA1==char(' '))): mPRAGMA_WHITE_SPACE(false) else: - goto _loop372_breakloop - :_loop372_breakloop + goto _loop382_breakloop + :_loop382_breakloop _saveIndex = text.Length mNEWLINE(false) text.Length = _saveIndex @@ -1450,18 +1450,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched399 as bool = false + synPredMatched409 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m399 as int = mark() - synPredMatched399 = true + _m409 as int = mark() + synPredMatched409 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched399 = false - rewind(_m399) + synPredMatched409 = false + rewind(_m409) --inputState.guessing - if synPredMatched399: + if synPredMatched409: mML_COMMENT(false) if 0 == inputState.guessing: if not PreserveComments: @@ -1475,8 +1475,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop404_breakloop - :_loop404_breakloop + goto _loop414_breakloop + :_loop414_breakloop if 0 == inputState.guessing: if PreserveComments: _ttype = SL_COMMENT @@ -1508,8 +1508,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop433_breakloop - :_loop433_breakloop + goto _loop443_breakloop + :_loop443_breakloop match("*/") if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1520,7 +1520,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt408 as int = 0 + _cnt418 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1534,12 +1534,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt408 >= 1): - goto _loop408_breakloop + if (_cnt418 >= 1): + goto _loop418_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt408 - :_loop408_breakloop + ++_cnt418 + :_loop418_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1560,8 +1560,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop412_breakloop - :_loop412_breakloop + goto _loop422_breakloop + :_loop422_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1610,8 +1610,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_4_) else: - goto _loop416_breakloop - :_loop416_breakloop + goto _loop426_breakloop + :_loop426_breakloop _saveIndex = text.Length match('\'') text.Length = _saveIndex @@ -1712,17 +1712,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt436 as int = 0 + _cnt446 as int = 0 while true: if ((tokenSet_5_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt436 >= 1): - goto _loop436_breakloop + if (_cnt446 >= 1): + goto _loop446_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt436 - :_loop436_breakloop + ++_cnt446 + :_loop446_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1780,17 +1780,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt442 as int = 0 + _cnt452 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt442 >= 1): - goto _loop442_breakloop + if (_cnt452 >= 1): + goto _loop452_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt442 - :_loop442_breakloop + ++_cnt452 + :_loop452_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 1501080..bd27338 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -550,118 +550,39 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - _givenValue = LA(1) - if ((_givenValue == DO) - or (_givenValue ==FOR) - or (_givenValue ==IF) - or (_givenValue ==TRY) - or (_givenValue ==WHILE) - or (_givenValue ==SWITCH) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == DO)): // 1831 - do_while_statement(b) - elif ((_givenValue == WHILE)): // 1831 - while_statement(b) - elif ((_givenValue == FOR)): // 1831 - for_statement(b) - elif ((_givenValue == IF)): // 1831 - if_statement(b) - elif ((_givenValue == TRY)): // 1831 - try_statement(b) - elif ((_givenValue == SWITCH)): // 1831 - switch_statement(b) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - elif ((_givenValue == BREAK) - or (_givenValue ==CONTINUE) - or (_givenValue ==FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==RETURN) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==THROW) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==VAR) - or (_givenValue ==YIELD) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - expression_statement(b) - elif ((_givenValue == YIELD)): // 1831 - yield_statement(b) - elif ((_givenValue == RETURN)): // 1831 - return_statement(b) - elif ((_givenValue == BREAK)): // 1831 - break_statement(b) - elif ((_givenValue == CONTINUE)): // 1831 - continue_statement(b) - elif ((_givenValue == THROW)): // 1831 - throw_statement(b) - elif ((_givenValue == VAR)): // 1831 - declaration_statement(b) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - eos() - elif ((_givenValue == EOS)): // 1831 - _cnt112 as int = 0 + synPredMatched108 as bool = false + if ((LA(1)==GET or LA(1)==SET or LA(1)==ID) and (tokenSet_12_.member(cast(int, LA(2))))): + _m108 as int = mark() + synPredMatched108 = true + ++inputState.guessing + try: + macro_application_test() + except x as RecognitionException: + synPredMatched108 = false + rewind(_m108) + --inputState.guessing + if synPredMatched108: + macro_application_block(b) + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + builtin_statement(b) + elif ((LA(1)==EOS)): // line 2102 + _cnt110 as int = 0 while true: - if ((LA(1)==EOS) and (tokenSet_12_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_15_.member(cast(int, LA(2))))): match(EOS) else: - if (_cnt112 >= 1): - goto _loop112_breakloop + if (_cnt110 >= 1): + goto _loop110_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt112 - :_loop112_breakloop - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) + ++_cnt110 + :_loop110_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise @@ -689,7 +610,7 @@ class UnityScriptParser(antlr.LLkParser): value=expression() if 0 == inputState.guessing: attr.NamedArguments.Add(ExpressionPair(name, value)) - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 value=expression() if 0 == inputState.guessing: attr.Arguments.Add(value) @@ -698,7 +619,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -713,12 +634,12 @@ class UnityScriptParser(antlr.LLkParser): match(DOT) e=member_reference_expression(e) else: - goto _loop198_breakloop - :_loop198_breakloop + goto _loop208_breakloop + :_loop208_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_16_) + recover(ex,tokenSet_18_) else: raise return e @@ -732,7 +653,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -748,7 +669,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_20_) else: raise @@ -760,7 +681,7 @@ class UnityScriptParser(antlr.LLkParser): name=qname() if 0 == inputState.guessing: attr = Ast.Attribute(ToLexicalInfo(name), name.getText()) - if ((LA(1)==LPAREN) and (tokenSet_19_.member(cast(int, LA(2))))): + if ((LA(1)==LPAREN) and (tokenSet_21_.member(cast(int, LA(2))))): match(LPAREN) _givenValue = LA(1) if ((_givenValue == FALSE) @@ -800,14 +721,14 @@ class UnityScriptParser(antlr.LLkParser): else: // line 1969 raise NoViableAltException(LT(1), getFilename()) match(RPAREN) - elif ((tokenSet_20_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_22_.member(cast(int, LA(1)))) and (tokenSet_23_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_20_) + recover(ex,tokenSet_22_) else: raise return attr @@ -841,7 +762,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_22_) + recover(ex,tokenSet_24_) else: raise return id @@ -890,7 +811,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_23_) + recover(ex,tokenSet_25_) else: raise return m @@ -936,6 +857,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==FINALLY) or (_givenValue ==FOR) or (_givenValue ==FUNCTION) + or (_givenValue ==GET) or (_givenValue ==IF) or (_givenValue ==INTERFACE) or (_givenValue ==NEW) @@ -946,6 +868,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==INTERNAL) or (_givenValue ==PARTIAL) or (_givenValue ==PRIVATE) + or (_givenValue ==SET) or (_givenValue ==STATIC) or (_givenValue ==SUPER) or (_givenValue ==THIS) @@ -988,7 +911,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise @@ -998,10 +921,10 @@ class UnityScriptParser(antlr.LLkParser): t as IToken = null try: // for error handling - if ((LA(1)==EOS) and (tokenSet_24_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_26_.member(cast(int, LA(2))))): _cnt43 as int = 0 while true: - if ((LA(1)==EOS) and (tokenSet_24_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_26_.member(cast(int, LA(2))))): t = LT(1) match(EOS) if 0 == inputState.guessing: @@ -1013,7 +936,7 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) ++_cnt43 :_loop43_breakloop - elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_26_.member(cast(int, LA(1)))) and (tokenSet_27_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: SemicolonExpected() else: @@ -1021,7 +944,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_26_) else: raise return firstEOS @@ -1081,7 +1004,7 @@ class UnityScriptParser(antlr.LLkParser): BaseTypeAnnotations.AnnotateImplements(typeRef) match(LBRACE) while true: - if ((tokenSet_26_.member(cast(int, LA(1))))): + if ((tokenSet_28_.member(cast(int, LA(1))))): if 0 == inputState.guessing: mod = TypeMemberModifiers.None _givenValue = LA(1) @@ -1106,9 +1029,9 @@ class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((tokenSet_27_.member(cast(int, LA(1)))) and (tokenSet_28_.member(cast(int, LA(2))))): + if ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_30_.member(cast(int, LA(2))))): mod=member_modifiers() - elif ((tokenSet_23_.member(cast(int, LA(1)))) and (tokenSet_29_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_25_.member(cast(int, LA(1)))) and (tokenSet_31_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1137,7 +1060,7 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: SetEndSourceLocation(cd, rbrace) while true: - if ((LA(1)==EOS) and (tokenSet_30_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): match(EOS) else: goto _loop60_breakloop @@ -1145,7 +1068,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_30_) + recover(ex,tokenSet_32_) else: raise return member @@ -1194,7 +1117,7 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: SetEndSourceLocation(td, rbrace) while true: - if ((LA(1)==EOS) and (tokenSet_30_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): match(EOS) else: goto _loop67_breakloop @@ -1202,7 +1125,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_30_) + recover(ex,tokenSet_32_) else: raise return member @@ -1252,7 +1175,7 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: SetEndSourceLocation(ed, rbrace) while true: - if ((LA(1)==EOS) and (tokenSet_30_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): match(EOS) else: goto _loop80_breakloop @@ -1260,7 +1183,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_30_) + recover(ex,tokenSet_32_) else: raise return member @@ -1324,7 +1247,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_30_) + recover(ex,tokenSet_32_) else: raise @@ -1351,6 +1274,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==FINAL) or (_givenValue ==FOR) or (_givenValue ==FUNCTION) + or (_givenValue ==GET) or (_givenValue ==IF) or (_givenValue ==INTERFACE) or (_givenValue ==NEW) @@ -1362,6 +1286,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==OVERRIDE) or (_givenValue ==PARTIAL) or (_givenValue ==PRIVATE) + or (_givenValue ==SET) or (_givenValue ==STATIC) or (_givenValue ==SUPER) or (_givenValue ==THIS) @@ -1411,6 +1336,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==FINAL) or (_givenValue ==FOR) or (_givenValue ==FUNCTION) + or (_givenValue ==GET) or (_givenValue ==IF) or (_givenValue ==INTERFACE) or (_givenValue ==NEW) @@ -1422,6 +1348,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==OVERRIDE) or (_givenValue ==PARTIAL) or (_givenValue ==PRIVATE) + or (_givenValue ==SET) or (_givenValue ==STATIC) or (_givenValue ==SUPER) or (_givenValue ==THIS) @@ -1468,7 +1395,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_30_) + recover(ex,tokenSet_32_) else: raise return member @@ -1525,7 +1452,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_23_) + recover(ex,tokenSet_25_) else: raise return m @@ -1553,19 +1480,19 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ++rank else: - goto _loop167_breakloop - :_loop167_breakloop + goto _loop177_breakloop + :_loop177_breakloop match(RBRACK) if 0 == inputState.guessing: tr = ArrayTypeReference(tr.LexicalInfo, tr, IntegerLiteralExpression(ToLexicalInfo(lbrack), rank)) - elif ((tokenSet_31_.member(cast(int, LA(1)))) and (tokenSet_32_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_33_.member(cast(int, LA(1)))) and (tokenSet_24_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_31_) + recover(ex,tokenSet_33_) else: raise return tr @@ -1586,12 +1513,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: typeReferences.Add(tr) else: - goto _loop183_breakloop - :_loop183_breakloop + goto _loop193_breakloop + :_loop193_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_33_) + recover(ex,tokenSet_34_) else: raise @@ -1628,7 +1555,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_34_) + recover(ex,tokenSet_35_) else: raise return member @@ -1697,7 +1624,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_35_) + recover(ex,tokenSet_36_) else: raise @@ -1730,7 +1657,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_37_) else: raise return token @@ -1752,7 +1679,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_37_) + recover(ex,tokenSet_38_) else: raise @@ -1789,7 +1716,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_38_) + recover(ex,tokenSet_39_) else: raise @@ -1817,7 +1744,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -1830,7 +1757,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling block(b) while true: - if ((LA(1)==EOS) and (tokenSet_39_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_40_.member(cast(int, LA(2))))): match(EOS) else: goto _loop102_breakloop @@ -1838,7 +1765,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_39_) + recover(ex,tokenSet_40_) else: raise @@ -1876,7 +1803,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -1886,16 +1813,16 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - if ((LA(1)==LBRACE) and (tokenSet_40_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_41_.member(cast(int, LA(2))))): compound_statement(b) - elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 statement(b) else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise @@ -1920,7 +1847,175 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) + else: + raise + + public def macro_application_test() as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + if ((LA(1)==GET or LA(1)==SET or LA(1)==ID) and (LA(2)==LBRACE)): + member() + match(LBRACE) + elif ((LA(1)==GET or LA(1)==SET or LA(1)==ID) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + member() + expression_list(null) + match(LBRACE) + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_4_) + else: + raise + + public def macro_application_block( + container as Block + ) as void: //throws RecognitionException, TokenStreamException + + m = MacroStatement() + args = m.Arguments + b = m.Body + + try: // for error handling + macroName=member() + synPredMatched146 as bool = false + if ((LA(1)==LBRACE) and (tokenSet_41_.member(cast(int, LA(2))))): + _m146 as int = mark() + synPredMatched146 = true + ++inputState.guessing + try: + match(LBRACE) + except x as RecognitionException: + synPredMatched146 = false + rewind(_m146) + --inputState.guessing + if synPredMatched146: + compound_statement(b) + elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_42_.member(cast(int, LA(2))))): // line 2102 + expression_list(args) + compound_statement(b) + else: + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + m.LexicalInfo = ToLexicalInfo(macroName) + m.Name = macroName.getText() + container.Add(m) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def builtin_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == DO) + or (_givenValue ==FOR) + or (_givenValue ==IF) + or (_givenValue ==TRY) + or (_givenValue ==WHILE) + or (_givenValue ==SWITCH) + ): // 1827 + _givenValue = LA(1) + if ((_givenValue == DO)): // 1831 + do_while_statement(b) + elif ((_givenValue == WHILE)): // 1831 + while_statement(b) + elif ((_givenValue == FOR)): // 1831 + for_statement(b) + elif ((_givenValue == IF)): // 1831 + if_statement(b) + elif ((_givenValue == TRY)): // 1831 + try_statement(b) + elif ((_givenValue == SWITCH)): // 1831 + switch_statement(b) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + elif ((_givenValue == BREAK) + or (_givenValue ==CONTINUE) + or (_givenValue ==FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==RETURN) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==THROW) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==VAR) + or (_givenValue ==YIELD) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + expression_statement(b) + elif ((_givenValue == YIELD)): // 1831 + yield_statement(b) + elif ((_givenValue == RETURN)): // 1831 + return_statement(b) + elif ((_givenValue == BREAK)): // 1831 + break_statement(b) + elif ((_givenValue == CONTINUE)): // 1831 + continue_statement(b) + elif ((_givenValue == THROW)): // 1831 + throw_statement(b) + elif ((_givenValue == VAR)): // 1831 + declaration_statement(b) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + eos() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) else: raise @@ -1950,7 +2045,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise @@ -1975,7 +2070,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise @@ -1989,10 +2084,10 @@ class UnityScriptParser(antlr.LLkParser): f = LT(1) match(FOR) match(LPAREN) - synPredMatched128 as bool = false - if ((tokenSet_42_.member(cast(int, LA(1)))) and (tokenSet_43_.member(cast(int, LA(2))))): - _m128 as int = mark() - synPredMatched128 = true + synPredMatched130 as bool = false + if ((tokenSet_43_.member(cast(int, LA(1)))) and (tokenSet_44_.member(cast(int, LA(2))))): + _m130 as int = mark() + synPredMatched130 = true ++inputState.guessing try: _givenValue = LA(1) @@ -2007,12 +2102,12 @@ class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) match(IN) except x as RecognitionException: - synPredMatched128 = false - rewind(_m128) + synPredMatched130 = false + rewind(_m130) --inputState.guessing - if synPredMatched128: + if synPredMatched130: stmt=for_in(container) - elif ((tokenSet_44_.member(cast(int, LA(1)))) and (tokenSet_45_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_45_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): // line 2102 stmt=for_c(container) else: raise NoViableAltException(LT(1), getFilename()) @@ -2021,7 +2116,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise @@ -2047,14 +2142,14 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: b = s.FalseBlock = Block(ToLexicalInfo(et)) compound_or_single_stmt(b) - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise @@ -2100,18 +2195,18 @@ class UnityScriptParser(antlr.LLkParser): tr = null compound_or_single_stmt(b) else: - goto _loop155_breakloop - :_loop155_breakloop + goto _loop165_breakloop + :_loop165_breakloop if ((LA(1)==FINALLY) and (tokenSet_2_.member(cast(int, LA(2))))): finally_block(s) - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise @@ -2154,22 +2249,22 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: item.Arguments.Add(e); else: - goto _loop143_breakloop - :_loop143_breakloop - _cnt145 as int = 0 + goto _loop153_breakloop + :_loop153_breakloop + _cnt155 as int = 0 while true: if ((tokenSet_2_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt145 >= 1): - goto _loop145_breakloop + if (_cnt155 >= 1): + goto _loop155_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt145 - :_loop145_breakloop + ++_cnt155 + :_loop155_breakloop else: - goto _loop146_breakloop - :_loop146_breakloop + goto _loop156_breakloop + :_loop156_breakloop _givenValue = LA(1) if ((_givenValue == DEFAULT)): // 1831 d = LT(1) @@ -2179,32 +2274,32 @@ class UnityScriptParser(antlr.LLkParser): item = MacroStatement(ToLexicalInfo(d), Name: d.getText()) itemBlock = item.Body switchBlock.Add(item) - _cnt149 as int = 0 + _cnt159 as int = 0 while true: if ((tokenSet_2_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt149 >= 1): - goto _loop149_breakloop + if (_cnt159 >= 1): + goto _loop159_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt149 - :_loop149_breakloop + ++_cnt159 + :_loop159_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) match(RBRACE) while true: - if ((LA(1)==EOS) and (tokenSet_12_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_15_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop151_breakloop - :_loop151_breakloop + goto _loop161_breakloop + :_loop161_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise @@ -2216,11 +2311,11 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=assignment_expression() if 0 == inputState.guessing: - b.Add(ExpressionStatement(e)) + b.Add(ExpressionStatement(e)) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise @@ -2233,18 +2328,18 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling yt = LT(1) match(YIELD) - if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): + if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_47_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) if 0 == inputState.guessing: - b.Add(YieldStatement(ToLexicalInfo(yt), Expression: e)) + b.Add(YieldStatement(ToLexicalInfo(yt), Expression: e)) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise @@ -2257,18 +2352,18 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling ret = LT(1) match(RETURN) - if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): + if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_47_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) if 0 == inputState.guessing: - b.Add(ReturnStatement(ToLexicalInfo(ret), Expression: e)) + b.Add(ReturnStatement(ToLexicalInfo(ret), Expression: e)) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise @@ -2282,11 +2377,11 @@ class UnityScriptParser(antlr.LLkParser): t = LT(1) match(BREAK) if 0 == inputState.guessing: - b.Add(BreakStatement(ToLexicalInfo(t))) + b.Add(BreakStatement(ToLexicalInfo(t))) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise @@ -2309,7 +2404,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise @@ -2322,18 +2417,18 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling t = LT(1) match(THROW) - if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): + if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_47_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) if 0 == inputState.guessing: - b.Add(RaiseStatement(ToLexicalInfo(t), Exception: e)) + b.Add(RaiseStatement(ToLexicalInfo(t), Exception: e)) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise @@ -2361,6 +2456,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==FINALLY) or (_givenValue ==FOR) or (_givenValue ==FUNCTION) + or (_givenValue ==GET) or (_givenValue ==IF) or (_givenValue ==IN) or (_givenValue ==INTERFACE) @@ -2372,6 +2468,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==INTERNAL) or (_givenValue ==PARTIAL) or (_givenValue ==PRIVATE) + or (_givenValue ==SET) or (_givenValue ==STATIC) or (_givenValue ==SUPER) or (_givenValue ==THIS) @@ -2414,7 +2511,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_47_) + recover(ex,tokenSet_48_) else: raise return d @@ -2520,6 +2617,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==FINALLY) or (_givenValue ==FOR) or (_givenValue ==FUNCTION) + or (_givenValue ==GET) or (_givenValue ==IF) or (_givenValue ==INTERFACE) or (_givenValue ==NEW) @@ -2530,6 +2628,7 @@ class UnityScriptParser(antlr.LLkParser): or (_givenValue ==INTERNAL) or (_givenValue ==PARTIAL) or (_givenValue ==PRIVATE) + or (_givenValue ==SET) or (_givenValue ==STATIC) or (_givenValue ==SUPER) or (_givenValue ==THIS) @@ -2570,7 +2669,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_48_) + recover(ex,tokenSet_49_) else: raise return e @@ -2612,7 +2711,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise return stmt @@ -2741,11 +2840,75 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise return stmt + public def member() as Token : //throws RecognitionException, TokenStreamException + name as Token + + id as IToken = null + st as IToken = null + gt as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + id = LT(1) + match(ID) + if 0 == inputState.guessing: + name=id; + elif ((_givenValue == SET)): // 1831 + st = LT(1) + match(SET) + if 0 == inputState.guessing: + name=st; + elif ((_givenValue == GET)): // 1831 + gt = LT(1) + match(GET) + if 0 == inputState.guessing: + name=gt; + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return name + + public def expression_list( + ec as ExpressionCollection + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): + e=expression() + if 0 == inputState.guessing: + ec.Add(e); + while true: + if ((LA(1)==COMMA)): + match(COMMA) + e=expression() + if 0 == inputState.guessing: + ec.Add(e); + else: + goto _loop226_breakloop + :_loop226_breakloop + elif ((LA(1)==LBRACE or LA(1)==RPAREN or LA(1)==RBRACK) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_50_) + else: + raise + public def paren_expression() as Expression : //throws RecognitionException, TokenStreamException e as Expression @@ -2757,7 +2920,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -2777,7 +2940,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_12_) + recover(ex,tokenSet_15_) else: raise @@ -2788,7 +2951,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=logical_or() - if ((LA(1)==QUESTION_MARK) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==QUESTION_MARK) and (tokenSet_12_.member(cast(int, LA(2))))): qm = LT(1) match(QUESTION_MARK) trueValue=logical_or() @@ -2799,52 +2962,18 @@ class UnityScriptParser(antlr.LLkParser): Condition: e, TrueValue: trueValue, FalseValue: falseValue) - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_19_.member(cast(int, LA(1)))) and (tokenSet_27_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e - public def member() as Token : //throws RecognitionException, TokenStreamException - name as Token - - id as IToken = null - st as IToken = null - gt as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - id = LT(1) - match(ID) - if 0 == inputState.guessing: - name=id; - elif ((_givenValue == SET)): // 1831 - st = LT(1) - match(SET) - if 0 == inputState.guessing: - name=st; - elif ((_givenValue == GET)): // 1831 - gt = LT(1) - match(GET) - if 0 == inputState.guessing: - name=gt; - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_17_) - else: - raise - return name - public def simple_type_reference() as TypeReference : //throws RecognitionException, TokenStreamException tr as TypeReference @@ -2859,7 +2988,7 @@ class UnityScriptParser(antlr.LLkParser): arguments = gtr.GenericArguments type_reference_list(arguments) match(GREATER_THAN) - elif ((tokenSet_31_.member(cast(int, LA(1)))) and (tokenSet_32_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_33_.member(cast(int, LA(1)))) and (tokenSet_24_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: tr = SimpleTypeReference(ToLexicalInfo(typeName), Name: typeName.getText()) else: @@ -2867,7 +2996,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_31_) + recover(ex,tokenSet_33_) else: raise return tr @@ -2889,14 +3018,14 @@ class UnityScriptParser(antlr.LLkParser): returnType=type_reference() if 0 == inputState.guessing: callableTypeRef.ReturnType = returnType - elif ((tokenSet_31_.member(cast(int, LA(1)))) and (tokenSet_32_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_33_.member(cast(int, LA(1)))) and (tokenSet_24_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_31_) + recover(ex,tokenSet_33_) else: raise return tr @@ -2922,8 +3051,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) else: - goto _loop173_breakloop - :_loop173_breakloop + goto _loop183_breakloop + :_loop183_breakloop elif ((_givenValue == RPAREN)): // 1831 pass // 947 else: // line 1969 @@ -2932,7 +3061,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_31_) + recover(ex,tokenSet_33_) else: raise @@ -2954,15 +3083,15 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dimensions.Add(size) else: - goto _loop176_breakloop - :_loop176_breakloop + goto _loop186_breakloop + :_loop186_breakloop match(RBRACK) if 0 == inputState.guessing: e = CodeFactory.NewArrayInitializer(tr.LexicalInfo, tr, dimensions) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -2977,7 +3106,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=term() while true: - if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_12_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == ADD)): // 1831 add = LT(1) @@ -2999,12 +3128,12 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop250_breakloop - :_loop250_breakloop + goto _loop260_breakloop + :_loop260_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3019,7 +3148,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3029,18 +3158,18 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched187 as bool = false + synPredMatched197 as bool = false if ((LA(1)==NEW) and (LA(2)==ID)): - _m187 as int = mark() - synPredMatched187 = true + _m197 as int = mark() + synPredMatched197 = true ++inputState.guessing try: new_array_expression() except x as RecognitionException: - synPredMatched187 = false - rewind(_m187) + synPredMatched197 = false + rewind(_m197) --inputState.guessing - if synPredMatched187: + if synPredMatched197: e=new_array_expression() elif ((LA(1)==NEW) and (LA(2)==ID)): // line 2102 match(NEW) @@ -3056,67 +3185,11 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e - public def expression_list( - ec as ExpressionCollection - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - e=expression() - if 0 == inputState.guessing: - ec.Add(e); - while true: - if ((LA(1)==COMMA)): - match(COMMA) - e=expression() - if 0 == inputState.guessing: - ec.Add(e); - else: - goto _loop216_breakloop - :_loop216_breakloop - elif ((_givenValue == RPAREN) - or (_givenValue ==RBRACK) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_49_) - else: - raise - public def atom() as Expression : //throws RecognitionException, TokenStreamException e as Expression @@ -3153,7 +3226,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3195,7 +3268,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3258,9 +3331,9 @@ class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((LA(1)==LBRACE) and (tokenSet_40_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_41_.member(cast(int, LA(2))))): block(body) - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 returnValue=expression() if 0 == inputState.guessing: body.Add(returnValue) @@ -3269,7 +3342,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3287,7 +3360,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3297,10 +3370,10 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched205 as bool = false - if ((LA(1)==TYPEOF) and (tokenSet_13_.member(cast(int, LA(2))))): - _m205 as int = mark() - synPredMatched205 = true + synPredMatched215 as bool = false + if ((LA(1)==TYPEOF) and (tokenSet_12_.member(cast(int, LA(2))))): + _m215 as int = mark() + synPredMatched215 = true ++inputState.guessing try: match(TYPEOF) @@ -3308,19 +3381,19 @@ class UnityScriptParser(antlr.LLkParser): expression() match(RPAREN) except x as RecognitionException: - synPredMatched205 = false - rewind(_m205) + synPredMatched215 = false + rewind(_m215) --inputState.guessing - if synPredMatched205: + if synPredMatched215: e=typeof_with_expression() - elif ((LA(1)==TYPEOF) and (tokenSet_13_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==TYPEOF) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 e=typeof_expression_alt() else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3355,7 +3428,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3368,11 +3441,11 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling t = LT(1) match(TYPEOF) - if ((LA(1)==LPAREN) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==LPAREN) and (tokenSet_12_.member(cast(int, LA(2))))): match(LPAREN) arg=expression() match(RPAREN) - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 arg=expression() else: raise NoViableAltException(LT(1), getFilename()) @@ -3384,7 +3457,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3394,10 +3467,10 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched208 as bool = false + synPredMatched218 as bool = false if ((LA(1)==TYPEOF) and (LA(2)==LPAREN)): - _m208 as int = mark() - synPredMatched208 = true + _m218 as int = mark() + synPredMatched218 = true ++inputState.guessing try: match(TYPEOF) @@ -3405,19 +3478,19 @@ class UnityScriptParser(antlr.LLkParser): type_reference() match(RPAREN) except x as RecognitionException: - synPredMatched208 = false - rewind(_m208) + synPredMatched218 = false + rewind(_m218) --inputState.guessing - if synPredMatched208: + if synPredMatched218: e=typeof_with_typeref() - elif ((LA(1)==TYPEOF) and (tokenSet_13_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==TYPEOF) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 e=typeof_with_expression() else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3438,7 +3511,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3579,7 +3652,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_50_) + recover(ex,tokenSet_51_) else: raise @@ -3595,7 +3668,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=atom() while true: - if ((LA(1)==LBRACK) and (tokenSet_51_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACK) and (tokenSet_52_.member(cast(int, LA(2))))): lbrack = LT(1) match(LBRACK) if 0 == inputState.guessing: @@ -3608,13 +3681,13 @@ class UnityScriptParser(antlr.LLkParser): match(COMMA) slice(se) else: - goto _loop232_breakloop - :_loop232_breakloop + goto _loop242_breakloop + :_loop242_breakloop match(RBRACK) - elif ((LA(1)==DOT) and (tokenSet_52_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DOT) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 match(DOT) e=member_reference_expression(e) - elif ((LA(1)==LPAREN) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==LPAREN) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 lparen = LT(1) match(LPAREN) if 0 == inputState.guessing: @@ -3625,12 +3698,12 @@ class UnityScriptParser(antlr.LLkParser): expression_list(args) match(RPAREN) else: - goto _loop235_breakloop - :_loop235_breakloop + goto _loop245_breakloop + :_loop245_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3643,17 +3716,17 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=slicing_expression() - if ((LA(1)==INCREMENT) and (tokenSet_17_.member(cast(int, LA(2))))): + if ((LA(1)==INCREMENT) and (tokenSet_19_.member(cast(int, LA(2))))): postinc = LT(1) match(INCREMENT) if 0 == inputState.guessing: token = postinc; operator = UnaryOperatorType.PostIncrement; - elif ((LA(1)==DECREMENT) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DECREMENT) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 preinc = LT(1) match(DECREMENT) if 0 == inputState.guessing: token = preinc; operator= UnaryOperatorType.PostDecrement; - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_19_.member(cast(int, LA(1)))) and (tokenSet_27_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3662,7 +3735,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3716,14 +3789,14 @@ class UnityScriptParser(antlr.LLkParser): tr=type_reference() if 0 == inputState.guessing: e = CastExpression(ToLexicalInfo(c), Target: e, Type: tr) - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_19_.member(cast(int, LA(1)))) and (tokenSet_27_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3773,7 +3846,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3789,7 +3862,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=unary_expression() while true: - if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_12_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == MULTIPLY)): // 1831 m = LT(1) @@ -3816,12 +3889,12 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop246_breakloop - :_loop246_breakloop + goto _loop256_breakloop + :_loop256_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3835,7 +3908,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=sum() while true: - if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_12_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == SHIFT_LEFT)): // 1831 sl = LT(1) @@ -3853,12 +3926,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop254_breakloop - :_loop254_breakloop + goto _loop264_breakloop + :_loop264_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3879,7 +3952,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=shift() while true: - if ((tokenSet_53_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((tokenSet_54_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == IN) or (_givenValue ==LESS_THAN) @@ -3933,12 +4006,12 @@ class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop266_breakloop - :_loop266_breakloop + goto _loop276_breakloop + :_loop276_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -3954,7 +4027,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=comparison() while true: - if ((tokenSet_54_.member(cast(int, LA(1)))) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((tokenSet_55_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == EQUALITY)): // 1831 te = LT(1) @@ -3982,12 +4055,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), op, e, r) else: - goto _loop274_breakloop - :_loop274_breakloop + goto _loop284_breakloop + :_loop284_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -4000,7 +4073,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=equality() while true: - if ((LA(1)==BITWISE_AND) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_AND) and (tokenSet_12_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_AND) if 0 == inputState.guessing: @@ -4009,12 +4082,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop277_breakloop - :_loop277_breakloop + goto _loop287_breakloop + :_loop287_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -4027,7 +4100,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_and() while true: - if ((LA(1)==BITWISE_XOR) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_XOR) and (tokenSet_12_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_XOR) if 0 == inputState.guessing: @@ -4036,12 +4109,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop280_breakloop - :_loop280_breakloop + goto _loop290_breakloop + :_loop290_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -4054,7 +4127,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_xor() while true: - if ((LA(1)==BITWISE_OR) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_OR) and (tokenSet_12_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_OR) if 0 == inputState.guessing: @@ -4063,12 +4136,12 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop283_breakloop - :_loop283_breakloop + goto _loop293_breakloop + :_loop293_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -4081,7 +4154,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_or() while true: - if ((LA(1)==LOGICAL_AND) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==LOGICAL_AND) and (tokenSet_12_.member(cast(int, LA(2))))): op = LT(1) match(LOGICAL_AND) rhs=bitwise_or() @@ -4091,12 +4164,12 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop286_breakloop - :_loop286_breakloop + goto _loop296_breakloop + :_loop296_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -4109,7 +4182,7 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling e=logical_and() while true: - if ((LA(1)==LOGICAL_OR) and (tokenSet_13_.member(cast(int, LA(2))))): + if ((LA(1)==LOGICAL_OR) and (tokenSet_12_.member(cast(int, LA(2))))): op = LT(1) match(LOGICAL_OR) rhs=logical_and() @@ -4119,12 +4192,12 @@ class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop289_breakloop - :_loop289_breakloop + goto _loop299_breakloop + :_loop299_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -4154,7 +4227,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -4167,19 +4240,19 @@ class UnityScriptParser(antlr.LLkParser): try: // for error handling lbrack = LT(1) match(LBRACK) - synPredMatched297 as bool = false - if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_55_.member(cast(int, LA(2))))): - _m297 as int = mark() - synPredMatched297 = true + synPredMatched307 as bool = false + if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_56_.member(cast(int, LA(2))))): + _m307 as int = mark() + synPredMatched307 = true ++inputState.guessing try: expression() match(FOR) except x as RecognitionException: - synPredMatched297 = false - rewind(_m297) + synPredMatched307 = false + rewind(_m307) --inputState.guessing - if synPredMatched297: + if synPredMatched307: projection=expression() match(FOR) match(LPAREN) @@ -4207,7 +4280,7 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) - elif ((tokenSet_56_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_57_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)); items = ale.Items; expression_list(items) @@ -4217,7 +4290,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -4268,8 +4341,8 @@ class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dle.Items.Add(pair); else: - goto _loop305_breakloop - :_loop305_breakloop + goto _loop315_breakloop + :_loop315_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 @@ -4278,7 +4351,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return dle @@ -4296,7 +4369,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return re @@ -4324,7 +4397,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -4342,7 +4415,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -4360,7 +4433,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -4378,7 +4451,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return e @@ -4396,7 +4469,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise return rle @@ -4416,7 +4489,7 @@ class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_38_) + recover(ex,tokenSet_39_) else: raise return ep @@ -4556,11 +4629,11 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) private static def mk_tokenSet_2_() as (long): - data = (3314913071567619616L, 17179873470468L, 0L, 0L, ) + data = (3314913105927882272L, 17179873470468L, 0L, 0L, ) return data public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) private static def mk_tokenSet_3_() as (long): - data = (-4738631271585491086L, 17540646436860L, 0L, 0L, ) + data = (-4738631237225228430L, 17540646436860L, 0L, 0L, ) return data public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) private static def mk_tokenSet_4_() as (long): @@ -4568,7 +4641,7 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) private static def mk_tokenSet_5_() as (long): - data = (3423017153076844322L, 17188463405060L, 0L, 0L, ) + data = (3423017187437106978L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) private static def mk_tokenSet_6_() as (long): @@ -4592,187 +4665,191 @@ class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_10_ = BitSet(mk_tokenSet_10_()) private static def mk_tokenSet_11_() as (long): - data = (3314930762017855266L, 17188463405060L, 0L, 0L, ) + data = (3314930796378117922L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_11_ = BitSet(mk_tokenSet_11_()) private static def mk_tokenSet_12_() as (long): - data = (4468696691554901922L, 17188463405060L, 0L, 0L, ) + data = (3314655235821289472L, 17179873468420L, 0L, 0L, ) return data public static final tokenSet_12_ = BitSet(mk_tokenSet_12_()) private static def mk_tokenSet_13_() as (long): - data = (3314655235821289472L, 17179873468420L, 0L, 0L, ) + data = (3314913071567619616L, 17179873468420L, 0L, 0L, ) return data public static final tokenSet_13_ = BitSet(mk_tokenSet_13_()) private static def mk_tokenSet_14_() as (long): - data = (-144109277957308336L, 17458773616350L, 0L, 0L, ) + data = (-4737786812295028750L, 17540646436860L, 0L, 0L, ) return data public static final tokenSet_14_ = BitSet(mk_tokenSet_14_()) private static def mk_tokenSet_15_() as (long): - data = (4611686018427387904L, 2L, 0L, 0L, ) + data = (4468696725915164578L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_15_ = BitSet(mk_tokenSet_15_()) private static def mk_tokenSet_16_() as (long): - data = (2305843009213693952L, 4096L, 0L, 0L, ) + data = (-144109277957308336L, 17458773616350L, 0L, 0L, ) return data public static final tokenSet_16_ = BitSet(mk_tokenSet_16_()) private static def mk_tokenSet_17_() as (long): - data = (-126100823932936206L, 17540646436863L, 0L, 0L, ) + data = (4611686018427387904L, 2L, 0L, 0L, ) return data public static final tokenSet_17_ = BitSet(mk_tokenSet_17_()) private static def mk_tokenSet_18_() as (long): - data = (144141678981452032L, 8589934592L, 0L, 0L, ) + data = (2305843009213693952L, 4096L, 0L, 0L, ) return data public static final tokenSet_18_ = BitSet(mk_tokenSet_18_()) private static def mk_tokenSet_19_() as (long): - data = (7926341254248677376L, 17179873468420L, 0L, 0L, ) + data = (-126100789572673550L, 17540646436863L, 0L, 0L, ) return data public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) private static def mk_tokenSet_20_() as (long): - data = (3423017157371811618L, 17188463405060L, 0L, 0L, ) + data = (144141678981452032L, 8589934592L, 0L, 0L, ) return data public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) private static def mk_tokenSet_21_() as (long): - data = (-18858823443884174L, 17540646436863L, 0L, 0L, ) + data = (7926341254248677376L, 17179873468420L, 0L, 0L, ) return data public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) private static def mk_tokenSet_22_() as (long): - data = (-18014432869752846L, 17540646436863L, 0L, 0L, ) + data = (3423017191732074274L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_22_ = BitSet(mk_tokenSet_22_()) private static def mk_tokenSet_23_() as (long): - data = (8804700000512L, 0L, ) + data = (-18858823443884174L, 17540646436863L, 0L, 0L, ) return data public static final tokenSet_23_ = BitSet(mk_tokenSet_23_()) private static def mk_tokenSet_24_() as (long): - data = (4576783086908858274L, 17188463405060L, 0L, 0L, ) + data = (-18014398509490190L, 17540646436863L, 0L, 0L, ) return data public static final tokenSet_24_ = BitSet(mk_tokenSet_24_()) private static def mk_tokenSet_25_() as (long): - data = (-18014398513684494L, 17540646436863L, 0L, 0L, ) + data = (8804700000512L, 0L, ) return data public static final tokenSet_25_ = BitSet(mk_tokenSet_25_()) private static def mk_tokenSet_26_() as (long): - data = (26490905596160L, 8589934592L, 0L, 0L, ) + data = (4576783121269120930L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_26_ = BitSet(mk_tokenSet_26_()) private static def mk_tokenSet_27_() as (long): - data = (26490905596160L, 0L, ) + data = (-18014398513684494L, 17540646436863L, 0L, 0L, ) return data public static final tokenSet_27_ = BitSet(mk_tokenSet_27_()) private static def mk_tokenSet_28_() as (long): - data = (144141713341714688L, 0L, ) + data = (26490905596160L, 8589934592L, 0L, 0L, ) return data public static final tokenSet_28_ = BitSet(mk_tokenSet_28_()) private static def mk_tokenSet_29_() as (long): - data = (144115224583635200L, 0L, ) + data = (26490905596160L, 0L, ) return data public static final tokenSet_29_ = BitSet(mk_tokenSet_29_()) private static def mk_tokenSet_30_() as (long): - data = (4467852270919669538L, 17188463405060L, 0L, 0L, ) + data = (144141713341714688L, 0L, ) return data public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) private static def mk_tokenSet_31_() as (long): - data = (-126100823928741902L, 17540646436863L, 0L, 0L, ) + data = (144115224583635200L, 0L, ) return data public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) private static def mk_tokenSet_32_() as (long): - data = (-18014398509490190L, 17540646436863L, 0L, 0L, ) + data = (4467852305279932194L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) private static def mk_tokenSet_33_() as (long): - data = (576460752303423488L, 536870912L, 0L, 0L, ) + data = (-126100789568479246L, 17540646436863L, 0L, 0L, ) return data public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) private static def mk_tokenSet_34_() as (long): - data = (1152947995512443136L, 8589934592L, 0L, 0L, ) + data = (576460752303423488L, 536870912L, 0L, 0L, ) return data public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) private static def mk_tokenSet_35_() as (long): - data = (1152921504607109120L, 8589934592L, 0L, 0L, ) + data = (1152947995512443136L, 8589934592L, 0L, 0L, ) return data public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) private static def mk_tokenSet_36_() as (long): - data = (9080382714285645730L, 17188463409159L, 0L, 0L, ) + data = (1152921504607109120L, 8589934592L, 0L, 0L, ) return data public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) private static def mk_tokenSet_37_() as (long): - data = (4611686018427387904L, 0L, ) + data = (9080382748645908386L, 17188463409159L, 0L, 0L, ) return data public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) private static def mk_tokenSet_38_() as (long): - data = (1152921504606846976L, 2L, 0L, 0L, ) + data = (4611686018427387904L, 0L, ) return data public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) private static def mk_tokenSet_39_() as (long): - data = (4468696695849869218L, 17188463405060L, 0L, 0L, ) + data = (1152921504606846976L, 2L, 0L, 0L, ) return data public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) private static def mk_tokenSet_40_() as (long): - data = (4467834576174466592L, 17179873470468L, 0L, 0L, ) + data = (4468696730210131874L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) private static def mk_tokenSet_41_() as (long): - data = (-4737786846655291406L, 17540646436860L, 0L, 0L, ) + data = (4467834610534729248L, 17179873470468L, 0L, 0L, ) return data public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) private static def mk_tokenSet_42_() as (long): - data = (144123986316394496L, 0L, ) + data = (-4755537426278103440L, 17458773618398L, 0L, 0L, ) return data public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) private static def mk_tokenSet_43_() as (long): - data = (144115190231760896L, 0L, ) + data = (144123986316394496L, 0L, ) return data public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) private static def mk_tokenSet_44_() as (long): - data = (3314664031914311680L, 17179873470468L, 0L, 0L, ) + data = (144115190231760896L, 0L, ) return data public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) private static def mk_tokenSet_45_() as (long): - data = (-4738906795634540464L, 17532056502268L, 0L, 0L, ) + data = (3314664031914311680L, 17179873470468L, 0L, 0L, ) return data public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) private static def mk_tokenSet_46_() as (long): - data = (-4754675345257930766L, 17467363552988L, 0L, 0L, ) + data = (-4738906795634540464L, 17532056502268L, 0L, 0L, ) return data public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) private static def mk_tokenSet_47_() as (long): - data = (4468696691563290530L, 17188463409156L, 0L, 0L, ) + data = (-4754675310897668110L, 17467363552988L, 0L, 0L, ) return data public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) private static def mk_tokenSet_48_() as (long): - data = (9080382709982289826L, 17188463405060L, 0L, 0L, ) + data = (4468696725923553186L, 17188463409156L, 0L, 0L, ) return data public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) private static def mk_tokenSet_49_() as (long): - data = (4611686018427387904L, 8L, 0L, 0L, ) + data = (9080382744342552482L, 17188463405060L, 0L, 0L, ) return data public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) private static def mk_tokenSet_50_() as (long): - data = (0L, 10L, 0L, 0L, ) + data = (5188146770730811392L, 8L, 0L, 0L, ) return data public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) private static def mk_tokenSet_51_() as (long): - data = (3314655235821289472L, 17179873468421L, 0L, 0L, ) + data = (0L, 10L, 0L, 0L, ) return data public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) private static def mk_tokenSet_52_() as (long): - data = (144115222436118528L, 33554432L, 0L, 0L, ) + data = (3314655235821289472L, 17179873468421L, 0L, 0L, ) return data public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) private static def mk_tokenSet_53_() as (long): - data = (41943040L, 1711276032L, 0L, 0L, ) + data = (144115222436118528L, 33554432L, 0L, 0L, ) return data public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) private static def mk_tokenSet_54_() as (long): - data = (0L, 26738688L, 0L, 0L, ) + data = (41943040L, 1711276032L, 0L, 0L, ) return data public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) private static def mk_tokenSet_55_() as (long): - data = (-4755795296384565168L, 17458773616348L, 0L, 0L, ) + data = (0L, 26738688L, 0L, 0L, ) return data public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) private static def mk_tokenSet_56_() as (long): - data = (3314655235821289472L, 17179873468428L, 0L, 0L, ) + data = (-4755795296384565168L, 17458773616348L, 0L, 0L, ) return data public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) + private static def mk_tokenSet_57_() as (long): + data = (3314655235821289472L, 17179873468428L, 0L, 0L, ) + return data + public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 99a44d7..12068c6 100644 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -693,6 +693,14 @@ block[Block b] statement[Block b] { +}: + (macro_application_test) => macro_application_block[b] + | builtin_statement[b] + | (EOS)+ +; + +builtin_statement[Block b] +{ }: ( do_while_statement[b] | @@ -713,9 +721,6 @@ statement[Block b] declaration_statement[b] ) eos - ) | - ( - (EOS)+ ) ; @@ -865,6 +870,31 @@ declaration returns [Declaration d] d = Declaration(ToLexicalInfo(id), Name: id.getText(), Type: tr) } ; + +macro_application_test +{ +}: + (member LBRACE) + | (member expression_list[null] LBRACE) +; + +macro_application_block[Block container] +{ + m = MacroStatement() + args = m.Arguments + b = m.Body +}: + macroName=member + ( + (LBRACE) => compound_statement[b] + | (expression_list[args] compound_statement[b]) + ) + { + m.LexicalInfo = ToLexicalInfo(macroName) + m.Name = macroName.getText() + container.Add(m) + } +; while_statement[Block container] { diff --git a/tests/parser/macro-application-blocks.js b/tests/parser/macro-application-blocks.js new file mode 100644 index 0000000..799e1a9 --- /dev/null +++ b/tests/parser/macro-application-blocks.js @@ -0,0 +1,26 @@ +/* +match foo: + when bar: + return 42 + when baz | gazonk: + return (-1) + otherwise : + return null +unchecked +*/ +match foo { + when bar { + return 42; + } + when baz | gazonk { + return -1; + } + otherwise { + return null; + } +} + +unchecked { + +} + From 9df8aff2d29d36453c0a22ec932dac8f3532f5ad Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 4 Jan 2012 14:45:31 -0200 Subject: [PATCH 214/276] todo update --- todo.txt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/todo.txt b/todo.txt index f7bf8a7..9f1570c 100644 --- a/todo.txt +++ b/todo.txt @@ -1,12 +1,10 @@ -*** Eval *** +* unchecked expression support: unchecked(1 << 31) +* pragma unchecked to enable unchecked arithmetic for the whole module -*) current imports should be effective inside eval code -*) cache eval assemblies used in static methods -*) for-loop variables should be visible to eval -*) propagate strict mode? +* current imports should be effective inside eval code +* cache eval assemblies used in static methods +* for-loop variables should be visible to eval +* propagate strict mode to eval? -************ -print usage information for bin/us - -->* lexical scopes for 'for' statements +* lexical scopes for 'for' statements From d2c3eeb556178ec84268d01a5ea397a968f78123 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 23 Jan 2012 14:53:14 -0200 Subject: [PATCH 215/276] test case for case 437620 (fixed) --- .../DuckyIntegrationTestFixture.boo | 4 ++++ .../StrictIntegrationTestFixture.Generated.boo | 4 ++++ tests/integration/ulong-bitshift-1.js | 13 +++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 tests/integration/ulong-bitshift-1.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 5106f79..ba04ef7 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -574,6 +574,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/uint-1.js") + [Test] def ulong_bitshift_1(): + RunTestCase("tests/integration/ulong-bitshift-1.js") + + [Test] def value_types_1(): RunTestCase("tests/integration/value-types-1.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo index 81356f7..2e86d20 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo @@ -572,6 +572,10 @@ partial class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/uint-1.js") + [Test] def ulong_bitshift_1(): + RunTestCase("tests/integration/ulong-bitshift-1.js") + + [Test] def value_types_1(): RunTestCase("tests/integration/value-types-1.js") diff --git a/tests/integration/ulong-bitshift-1.js b/tests/integration/ulong-bitshift-1.js new file mode 100644 index 0000000..b13be21 --- /dev/null +++ b/tests/integration/ulong-bitshift-1.js @@ -0,0 +1,13 @@ +/* +2 +*/ +#pragma strict + +function Start() +{ + var x : ulong = 1; + x = x << 1; + print(x); +} + +Start(); From 0060c7dcf4bce990dabfceb96c5e5ef81ec3ca60 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 23 Jan 2012 19:04:26 -0200 Subject: [PATCH 216/276] empty file begets empty behaviour --- .../SemanticsTestFixture.boo | 4 +++ src/UnityScript/Steps/ApplySemantics.boo | 26 +++++++++---------- .../EmptyFileBegetsEmptyBehaviour.js | 11 ++++++++ 3 files changed, 28 insertions(+), 13 deletions(-) create mode 100644 tests/semantics/EmptyFileBegetsEmptyBehaviour.js diff --git a/src/UnityScript.Tests/SemanticsTestFixture.boo b/src/UnityScript.Tests/SemanticsTestFixture.boo index e2eb272..2ac1808 100644 --- a/src/UnityScript.Tests/SemanticsTestFixture.boo +++ b/src/UnityScript.Tests/SemanticsTestFixture.boo @@ -7,6 +7,10 @@ import NUnit.Framework class SemanticsTestFixture(AbstractSemanticsTestFixture): + [Test] def EmptyFileBegetsEmptyBehaviour(): + RunTestCase("tests/semantics/EmptyFileBegetsEmptyBehaviour.js") + + [Test] def Magic2Class(): RunTestCase("tests/semantics/Magic2Class.js") diff --git a/src/UnityScript/Steps/ApplySemantics.boo b/src/UnityScript/Steps/ApplySemantics.boo index e6cb8ee..82fed36 100644 --- a/src/UnityScript/Steps/ApplySemantics.boo +++ b/src/UnityScript/Steps/ApplySemantics.boo @@ -52,15 +52,18 @@ class ApplySemantics(AbstractVisitorCompilerStep): SetScriptClass(Context, script) def ModuleContainsOnlyTypeDefinitions(module as Module): - return module.Globals.IsEmpty and module.Attributes.IsEmpty and module.Members.All({ m | m isa TypeDefinition }) - - def SetUpMainMethod(module as Module, script as TypeDefinition): + return not module.Members.IsEmpty and module.Members.All({ m | m isa TypeDefinition }) and module.Globals.IsEmpty and module.Attributes.IsEmpty + def SetUpMainMethod(module as Module, script as TypeDefinition): TransformGlobalVariablesIntoFields(module, script) + MoveGlobalStatementsToMainMethodOf(script, module) + + def MoveGlobalStatementsToMainMethodOf(script as TypeDefinition, module as Module): main = ExistingMainMethodOn(script) + if main is null: - main = CreateMainMethod(module) + main = NewMainMethodFor(module) script.Members.Add(main) else: Warnings.Add(UnityScriptWarnings.ScriptMainMethodIsImplicitlyDefined(main.LexicalInfo, main.Name)) @@ -142,15 +145,12 @@ class ApplySemantics(AbstractVisitorCompilerStep): ScriptMainMethod: get: return self.UnityScriptParameters.ScriptMainMethod - def CreateMainMethod(module as Module): - method = Method(module.LexicalInfo, Name: ScriptMainMethod) - method.Modifiers = TypeMemberModifiers.Public | TypeMemberModifiers.Virtual - - stmts = module.Globals.Statements - if len(stmts) > 0: method.LexicalInfo = Copy(stmts[0].LexicalInfo) - method.EndSourceLocation = module.EndSourceLocation - - return method + def NewMainMethodFor(module as Module): + return Method( + LexicalInfo: (Copy(module.Globals.Statements[0].LexicalInfo) if not module.Globals.IsEmpty else module.LexicalInfo), + Name: ScriptMainMethod, + Modifiers: TypeMemberModifiers.Public | TypeMemberModifiers.Virtual, + EndSourceLocation: module.EndSourceLocation) def Copy(li as LexicalInfo): return LexicalInfo(li.FileName, li.Line, li.Column) diff --git a/tests/semantics/EmptyFileBegetsEmptyBehaviour.js b/tests/semantics/EmptyFileBegetsEmptyBehaviour.js new file mode 100644 index 0000000..be369d9 --- /dev/null +++ b/tests/semantics/EmptyFileBegetsEmptyBehaviour.js @@ -0,0 +1,11 @@ +/* +import UnityScript.Tests + +partial public class EmptyFileBegetsEmptyBehaviour(UnityScript.Tests.MonoBehaviour): + + public virtual def Awake() as void: + pass + + public def constructor(): + super() +*/ \ No newline at end of file From e6e7d0ce766a821b68cc321e5a70e324bb1697f9 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 26 Jan 2012 10:45:23 -0200 Subject: [PATCH 217/276] order methods in the file so it reads top to bottom --- refresh-tests.boo | 155 +++++++++++++++++++++++----------------------- src/us/us.boo | 63 ++++++++++--------- 2 files changed, 109 insertions(+), 109 deletions(-) diff --git a/refresh-tests.boo b/refresh-tests.boo index 4507c6b..e52e9eb 100755 --- a/refresh-tests.boo +++ b/refresh-tests.boo @@ -10,73 +10,8 @@ import System import System.IO import Boo.Lang.PatternMatching -def GetTestCaseName(fname as string): - return Path.GetFileNameWithoutExtension(fname).Replace("-", "_").Replace(".", "_") - -def CategoryAttributeFor(testFile as string): -""" -If the first line of the test case file starts with // category CategoryName -then return a suitable [CategoryName()] attribute. -""" - match FirstLineOf(testFile): - case /\/\/\s*ignore\s+(?.*)/: - return "[Ignore(\"${reason[0].Value.Trim()}\")]" - case /\/\/\s*category\s+(?.*)/: - return "[Category(\"${name[0].Value.Trim()}\")]" - otherwise: - return "" - -def FirstLineOf(fname as string): - using reader=File.OpenText(fname): - return reader.ReadLine() - -def GenerateTestFixture(targetFile as string, header as string, *srcDirs as (string)): - contents = GenerateTestFixtureSource(header, srcDirs, JavascriptFilesIn, CategoryAttributeFor) - WriteFileIfChanged(targetFile, contents) - -def GenerateProjectTestFixture(targetFile as string, header as string, *srcDirs as (string)): - contents = GenerateTestFixtureSource(header, srcDirs, { dir | Directory.GetDirectories(dir) }, { dir | "" }) - WriteFileIfChanged(targetFile, contents) - -def WriteFileIfChanged(targetFile as string, contents as string): - if ShouldReplaceContent(targetFile, contents): - File.WriteAllText(targetFile, contents) - -def ShouldReplaceContent(fname as string, contents as string): - if not File.Exists(fname): return true - return ns(File.ReadAllText(fname)) != ns(contents) - -def ns(s as string): -""" -Normalize string. -""" - return s.Trim().Replace("\r\n", Environment.NewLine) - -def GenerateTestFixtureSource( - header as string, - srcDirs as string*, - testCaseProducer as callable(string) as string*, - categoryProducer as callable(string) as string): - - writer=StringWriter() - writer.Write(header) - for srcDir in srcDirs: - count = 0 - for testCase in testCaseProducer(srcDir): - ++count - categoryAttribute = categoryProducer(testCase) - writer.Write(""" - ${categoryAttribute} - [Test] def ${GetTestCaseName(testCase)}(): - RunTestCase("${testCase.Replace('\\', '/')}") - """) - print "\t${count} test cases found in ${srcDir}." - return writer.ToString() - -def JavascriptFilesIn(dir as string): - return fname for fname in Directory.GetFiles(dir) if fname.EndsWith(".js") - -GenerateProjectTestFixture("src/UnityScript.Tests/ProjectIntegrationTestFixture.Generated.boo", """ +def Main(): + GenerateProjectTestFixture("src/UnityScript.Tests/ProjectIntegrationTestFixture.Generated.boo", """ namespace UnityScript.Tests import NUnit.Framework @@ -84,7 +19,7 @@ import NUnit.Framework partial class ProjectIntegrationTestFixture: """, "tests/projects") -GenerateTestFixture("src/UnityScript.Tests/ParserTestFixture.Generated.boo", """ + GenerateTestFixture("src/UnityScript.Tests/ParserTestFixture.Generated.boo", """ namespace UnityScript.Tests import NUnit.Framework @@ -92,7 +27,7 @@ import NUnit.Framework partial class ParserTestFixture: """, "tests/parser") -GenerateTestFixture("src/UnityScript.Tests/SemanticsTestFixture.boo", """ + GenerateTestFixture("src/UnityScript.Tests/SemanticsTestFixture.boo", """ namespace UnityScript.Tests import NUnit.Framework @@ -101,7 +36,7 @@ import NUnit.Framework class SemanticsTestFixture(AbstractSemanticsTestFixture): """, "tests/semantics") -GenerateTestFixture("src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo", """ + GenerateTestFixture("src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo", """ namespace UnityScript.Tests import NUnit.Framework @@ -111,7 +46,7 @@ partial class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): """, "tests/integration") -GenerateTestFixture("src/UnityScript.Tests/DuckyIntegrationTestFixture.boo", """ + GenerateTestFixture("src/UnityScript.Tests/DuckyIntegrationTestFixture.boo", """ namespace UnityScript.Tests import NUnit.Framework @@ -123,7 +58,7 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): Parameters.Strict = false """, "tests/integration", "tests/ducky") -GenerateTestFixture("src/UnityScript.Tests/PragmaTestFixture.boo", """ + GenerateTestFixture("src/UnityScript.Tests/PragmaTestFixture.boo", """ namespace UnityScript.Tests import NUnit.Framework @@ -132,7 +67,7 @@ import NUnit.Framework class PragmaTestFixture(AbstractIntegrationTestFixture): """, "tests/pragma") -GenerateTestFixture("src/UnityScript.Tests/GenericsTestFixture.Generated.boo", """ + GenerateTestFixture("src/UnityScript.Tests/GenericsTestFixture.Generated.boo", """ namespace UnityScript.Tests import NUnit.Framework @@ -141,7 +76,7 @@ import NUnit.Framework class GenericsTestFixture(AbstractIntegrationTestFixture): """, "tests/generics") -GenerateTestFixture("src/UnityScript.Tests/EvalTestFixture.boo", """ + GenerateTestFixture("src/UnityScript.Tests/EvalTestFixture.boo", """ namespace UnityScript.Tests import NUnit.Framework @@ -150,7 +85,7 @@ import NUnit.Framework class EvalTestFixture(AbstractIntegrationTestFixture): """, "tests/eval") -GenerateTestFixture("src/UnityScript.Tests/ExpandoTestFixture.boo", """ + GenerateTestFixture("src/UnityScript.Tests/ExpandoTestFixture.boo", """ namespace UnityScript.Tests import NUnit.Framework @@ -164,7 +99,7 @@ class ExpandoTestFixture(AbstractIntegrationTestFixture): """, "tests/expando") -GenerateTestFixture("src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo", """ + GenerateTestFixture("src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo", """ namespace UnityScript.Tests import NUnit.Framework @@ -172,10 +107,76 @@ import NUnit.Framework partial class ErrorMessagesTestFixture: """, "tests/error-messages") -GenerateTestFixture("src/UnityScript.Tests/StackTraceTestFixture.Generated.boo", """ + GenerateTestFixture("src/UnityScript.Tests/StackTraceTestFixture.Generated.boo", """ namespace UnityScript.Tests import NUnit.Framework partial class StackTraceTestFixture: """, "tests/stacktrace") + +def GetTestCaseName(fname as string): + return Path.GetFileNameWithoutExtension(fname).Replace("-", "_").Replace(".", "_") + +def CategoryAttributeFor(testFile as string): +""" +If the first line of the test case file starts with // category CategoryName +then return a suitable [CategoryName()] attribute. +""" + match FirstLineOf(testFile): + case /\/\/\s*ignore\s+(?.*)/: + return "[Ignore(\"${reason[0].Value.Trim()}\")]" + case /\/\/\s*category\s+(?.*)/: + return "[Category(\"${name[0].Value.Trim()}\")]" + otherwise: + return "" + +def FirstLineOf(fname as string): + using reader=File.OpenText(fname): + return reader.ReadLine() + +def GenerateTestFixture(targetFile as string, header as string, *srcDirs as (string)): + contents = GenerateTestFixtureSource(header, srcDirs, JavascriptFilesIn, CategoryAttributeFor) + WriteFileIfChanged(targetFile, contents) + +def GenerateProjectTestFixture(targetFile as string, header as string, *srcDirs as (string)): + contents = GenerateTestFixtureSource(header, srcDirs, { dir | Directory.GetDirectories(dir) }, { dir | "" }) + WriteFileIfChanged(targetFile, contents) + +def WriteFileIfChanged(targetFile as string, contents as string): + if ShouldReplaceContent(targetFile, contents): + File.WriteAllText(targetFile, contents) + +def ShouldReplaceContent(fname as string, contents as string): + if not File.Exists(fname): return true + return ns(File.ReadAllText(fname)) != ns(contents) + +def ns(s as string): +""" +Normalize string. +""" + return s.Trim().Replace("\r\n", Environment.NewLine) + +def GenerateTestFixtureSource( + header as string, + srcDirs as string*, + testCaseProducer as callable(string) as string*, + categoryProducer as callable(string) as string): + + writer=StringWriter() + writer.Write(header) + for srcDir in srcDirs: + count = 0 + for testCase in testCaseProducer(srcDir): + ++count + categoryAttribute = categoryProducer(testCase) + writer.Write(""" + $categoryAttribute + [Test] def ${GetTestCaseName(testCase)}(): + RunTestCase("${testCase.Replace('\\', '/')}") + """) + print "\t$count test cases found in $srcDir." + return writer.ToString() + +def JavascriptFilesIn(dir as string): + return fname for fname in Directory.GetFiles(dir) if fname.EndsWith(".js") diff --git a/src/us/us.boo b/src/us/us.boo index bcc0f87..cd2bd69 100755 --- a/src/us/us.boo +++ b/src/us/us.boo @@ -4,25 +4,27 @@ import System import System.Reflection import Boo.Lang.Compiler -def Main([required] argv as (string)) as int: +def Main(argv as (string)): try: - return run(argv) + return runWithCommandLine(argv) + except x as TargetInvocationException: + print "Execution error: ", x.InnerException + except x as ApplicationException: + print "Error:", x.Message except x: print "Error:", x return 255 - -def getAssemblyTitle(): - return cast(AssemblyTitleAttribute, getAssemblyAttribute(AssemblyTitleAttribute)).Title -def getAssemblyVersion(): - return Assembly.GetExecutingAssembly().GetName().Version +def runWithCommandLine(commandLine as (string)): + options = parseCommandLineOptions(commandLine) + if options.IsValid and not options.DoHelp: + return compile(options) + usage(options) + return 255 -def getAssemblyCopyright(): - return cast(AssemblyCopyrightAttribute, getAssemblyAttribute(AssemblyCopyrightAttribute)).Copyright +def parseCommandLineOptions(commandLine as (string)): + return CommandLineOptions(*commandLine) -def getAssemblyAttribute(type as System.Type): - return Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), type) - def compile(options as CommandLineOptions): compiler = UnityScriptCompilerFactory.FromCommandLineOptions(options) results = compiler.Run() @@ -36,35 +38,32 @@ def compile(options as CommandLineOptions): else: print results.Warnings.ToString() if len(results.Warnings) print "Successfully compiled '${len(compiler.Parameters.Input)}' file(s) to '${results.GeneratedAssemblyFileName}'." + return 0 - + def execute(result as CompilerContext, mainMethod as string): for type in result.GeneratedAssembly.GetTypes(): method = type.GetMethod(mainMethod) if method is not null: method.Invoke(type(), (,)) - + +def usage(options as CommandLineOptions): + banner() + options.PrintOptions() + def banner(): print "${getAssemblyTitle()} - ${getAssemblyVersion()} ${getAssemblyCopyright()}" print -def run(argv as (string)): - options = parseCommandLineOptions(argv) - if options.IsValid and not options.DoHelp: - try: - return compile(options) - except x as ApplicationException: - print "ERROR:", x.Message - except x: - print "ERROR:", x - else: - usage(options) - - return 255 +def getAssemblyTitle(): + return getAssemblyAttribute[of AssemblyTitleAttribute]().Title -def parseCommandLineOptions(argv as (string)): - return CommandLineOptions(*argv) +def getAssemblyVersion(): + return Assembly.GetExecutingAssembly().GetName().Version + +def getAssemblyCopyright(): + return getAssemblyAttribute[of AssemblyCopyrightAttribute]().Copyright + +def getAssemblyAttribute[of T(System.Attribute)]() as T: + return Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), T) -def usage(options as CommandLineOptions): - banner() - options.PrintOptions() From 0cc3faace6faa955375dba0e9eb55110e44f6ab1 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 26 Jan 2012 11:39:39 -0200 Subject: [PATCH 218/276] make unityscript unchecked by default (fixes unity case 437620) --- .../UnityScriptCompilerParameters.boo | 1 + .../ulong-bitshift-overflow-regression.js | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) mode change 100755 => 100644 src/UnityScript/UnityScriptCompilerParameters.boo create mode 100644 tests/integration/ulong-bitshift-overflow-regression.js diff --git a/src/UnityScript/UnityScriptCompilerParameters.boo b/src/UnityScript/UnityScriptCompilerParameters.boo old mode 100755 new mode 100644 index d471b16..3a5f24e --- a/src/UnityScript/UnityScriptCompilerParameters.boo +++ b/src/UnityScript/UnityScriptCompilerParameters.boo @@ -24,6 +24,7 @@ class UnityScriptCompilerParameters(CompilerParameters): def constructor(): super(Boo.Lang.Compiler.TypeSystem.Reflection.ReflectionTypeSystemProvider()) + self.Checked = false self.OutputType = CompilerOutputType.Library self.References.Add(typeof(UnityScript.Lang.Array).Assembly) self.References.Add(GetType().Assembly) diff --git a/tests/integration/ulong-bitshift-overflow-regression.js b/tests/integration/ulong-bitshift-overflow-regression.js new file mode 100644 index 0000000..a1f150d --- /dev/null +++ b/tests/integration/ulong-bitshift-overflow-regression.js @@ -0,0 +1,23 @@ +/* +0.04210299 +*/ +#pragma strict + +function randomNumber2D(x: float, y: float): float { + var a: ulong = x * System.Convert.ToSingle(uint.MaxValue); + var b: ulong = y * System.Convert.ToSingle(uint.MaxValue); + + //hash numbers + var key : ulong = (a << 32) | b; + key = (~key) + (key << 18); + key = (key & ~(key >> 31)) | (~key & (key >> 31)); + key = (key + (key << 2)) + (key << 4); //key = key * 21; + key = (key & ~(key >> 11)) | (~key & (key >> 11)); + key = key + (key << 6); + key = (key & ~(key >> 22)) | (~key & (key >> 22)); + + //discard 32 most significant bits and scale to between 0 and 1 + return (key & 0xFFFFFFFF) / System.Convert.ToSingle(uint.MaxValue); +} + +print(randomNumber2D(.9996847, .4148785)); From 080e5a270c6f8d8752d240003d30d8177c73ca70 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 26 Jan 2012 11:40:35 -0200 Subject: [PATCH 219/276] introduce pragma checked for checked arithmetic behavior --- src/UnityScript/Core/Pragmas.boo | 12 +++++++----- tests/pragma/pragma-checked-1.js | 12 ++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 tests/pragma/pragma-checked-1.js diff --git a/src/UnityScript/Core/Pragmas.boo b/src/UnityScript/Core/Pragmas.boo index 243e948..f040ef3 100644 --- a/src/UnityScript/Core/Pragmas.boo +++ b/src/UnityScript/Core/Pragmas.boo @@ -12,11 +12,13 @@ static class Pragmas: public final Downcast = "downcast" - final ValidPragmas = Strict, Expando, Implicit, Downcast + public final Checked = "checked" - final Enabled = object() + final ValidPragmas = Strict, Expando, Implicit, Downcast, Checked - final Disabled = object() + final Enabled = true + + final Disabled = false All: get: return ValidPragmas[:] @@ -25,10 +27,10 @@ static class Pragmas: return pragma in ValidPragmas def IsEnabledOn(module as Module, pragma as string): - return module[pragma] is Enabled + return Enabled == module[pragma] def IsDisabledOn(module as Module, pragma as string): - return module[pragma] is Disabled + return Disabled == module[pragma] def TryToEnableOn(module as Module, pragma as string): if module.ContainsAnnotation(pragma): diff --git a/tests/pragma/pragma-checked-1.js b/tests/pragma/pragma-checked-1.js new file mode 100644 index 0000000..0bfa5b6 --- /dev/null +++ b/tests/pragma/pragma-checked-1.js @@ -0,0 +1,12 @@ +/* +overflow! +*/ +#pragma checked + +try { + var mv: int = int.MaxValue; + var i = mv + 1; + print(i); +} catch (e: System.OverflowException) { + print("overflow!"); +} From 786cec522d2af84bba0788617b9f757ffcbebbc1 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 26 Jan 2012 11:47:30 -0200 Subject: [PATCH 220/276] update autogenerated files --- src/UnityScript.Tests/DuckyIntegrationTestFixture.boo | 4 ++++ src/UnityScript.Tests/PragmaTestFixture.boo | 4 ++++ .../StrictIntegrationTestFixture.Generated.boo | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index ba04ef7..3f6907e 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -578,6 +578,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/ulong-bitshift-1.js") + [Test] def ulong_bitshift_overflow_regression(): + RunTestCase("tests/integration/ulong-bitshift-overflow-regression.js") + + [Test] def value_types_1(): RunTestCase("tests/integration/value-types-1.js") diff --git a/src/UnityScript.Tests/PragmaTestFixture.boo b/src/UnityScript.Tests/PragmaTestFixture.boo index 880c01b..12a1b17 100644 --- a/src/UnityScript.Tests/PragmaTestFixture.boo +++ b/src/UnityScript.Tests/PragmaTestFixture.boo @@ -27,6 +27,10 @@ class PragmaTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/pragma/implicit-plus-strict.js") + [Test] def pragma_checked_1(): + RunTestCase("tests/pragma/pragma-checked-1.js") + + [Test] def pragma_expando_1(): RunTestCase("tests/pragma/pragma-expando-1.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo index 2e86d20..e658d90 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo @@ -576,6 +576,10 @@ partial class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/ulong-bitshift-1.js") + [Test] def ulong_bitshift_overflow_regression(): + RunTestCase("tests/integration/ulong-bitshift-overflow-regression.js") + + [Test] def value_types_1(): RunTestCase("tests/integration/value-types-1.js") From 39773149b5f4a82cb4f852c1eca304cc59760aa4 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 27 Jan 2012 00:06:40 -0200 Subject: [PATCH 221/276] update original year --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 48215f8..c19769b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2010 Rodrigo B. de Oliveira (rbo@acm.org) +Copyright (c) 2004, 2008, 2010 Rodrigo B. de Oliveira (rbo@acm.org) All rights reserved. Redistribution and use in source and binary forms, with or without modification, From decae5992118aaa3f92835c1b2a4bee1c8ba4d66 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 23 Mar 2012 11:38:43 -0300 Subject: [PATCH 222/276] simplify code using 'or' null coalescing semantics --- src/UnityScript.Tests/AbstractCompilerTestFixture.boo | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/UnityScript.Tests/AbstractCompilerTestFixture.boo b/src/UnityScript.Tests/AbstractCompilerTestFixture.boo index 649f20e..2f81d16 100755 --- a/src/UnityScript.Tests/AbstractCompilerTestFixture.boo +++ b/src/UnityScript.Tests/AbstractCompilerTestFixture.boo @@ -11,10 +11,7 @@ abstract class AbstractCompilerTestFixture(AbstractCompilerTest): get: return false static BasePath as string: - get: - if _basePath is null: - _basePath = FindTestsPath() - return _basePath + get: return _basePath or _basePath = FindTestsPath() private static _basePath as string From dce7ea7102dede8ac1d49c07335c45d10aad87e6 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 23 Mar 2012 11:39:04 -0300 Subject: [PATCH 223/276] make UnityScriptParser class partial --- src/UnityScript/Parser/UnityScriptParser.boo | 2 +- src/UnityScript/UnityScript.g | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index bd27338..6fbefa0 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -27,7 +27,7 @@ import System.Globalization import UnityScript import UnityScript.Core -class UnityScriptParser(antlr.LLkParser): +partial class UnityScriptParser(antlr.LLkParser): public static final EOF = 1 public static final NULL_TREE_LOOKAHEAD = 3 public static final AS = 4 diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 12068c6..13f35af 100644 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -20,6 +20,7 @@ options k = 2; exportVocab = UnityScript; defaultErrorHandler = true; + classHeaderPrefix = "partial"; } tokens { From fa482051a1d9cb8f0cd26841766590bf3b501c72 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 23 Mar 2012 11:39:39 -0300 Subject: [PATCH 224/276] introduce UnityScriptParser.ParseExpression --- .../Parser/UnityScriptParserExtensions.boo | 52 +++++++++++++++++++ src/UnityScript/Steps/Parse.boo | 18 +------ 2 files changed, 53 insertions(+), 17 deletions(-) create mode 100644 src/UnityScript/Parser/UnityScriptParserExtensions.boo diff --git a/src/UnityScript/Parser/UnityScriptParserExtensions.boo b/src/UnityScript/Parser/UnityScriptParserExtensions.boo new file mode 100644 index 0000000..ebf6b09 --- /dev/null +++ b/src/UnityScript/Parser/UnityScriptParserExtensions.boo @@ -0,0 +1,52 @@ +namespace UnityScript.Parser + +import System.IO +import Boo.Lang.Compiler +import Boo.Lang.Compiler.Ast + +partial class UnityScriptParser: + + static def ParseReader(reader as TextReader, fileName as string, context as CompilerContext, targetCompileUnit as CompileUnit): + lexer = UnityScriptLexerFor(reader, fileName) + if lexer is null: + return + + parser = UnityScriptParser(lexer, CompilerContext: context) + parser.setFilename(fileName) + + try: + parser.start(targetCompileUnit) + except x as antlr.TokenStreamRecognitionException: + parser.reportError(x.recog) + + static def ParseExpression(expression as string, fileName as string, context as CompilerContext): + return ParseExpression(StringReader(expression), fileName, context) + + static def ParseExpression(expression as TextReader, fileName as string, context as CompilerContext): + """ + if the expression reader is empty returns null. + + Otherwise tries to parse an expression reporting errors in the compiler context passed as argument. + """ + lexer = UnityScriptLexerFor(expression, fileName) + if lexer is null: + return null + + parser = UnityScriptParser(lexer, CompilerContext: context) + parser.setFilename(fileName) + + try: + return parser.expression() + except x as antlr.TokenStreamRecognitionException: + parser.reportError(x.recog) + + static def UnityScriptLexerFor(reader as TextReader, fileName as string): + if reader.Peek() == -1: + return null + + lexer = UnityScriptLexer(reader) + lexer.setFilename(fileName) + lexer.setTokenCreator(Boo.Lang.Parser.BooToken.BooTokenCreator()) + return lexer + + \ No newline at end of file diff --git a/src/UnityScript/Steps/Parse.boo b/src/UnityScript/Steps/Parse.boo index bcc7465..2de6259 100644 --- a/src/UnityScript/Steps/Parse.boo +++ b/src/UnityScript/Steps/Parse.boo @@ -1,7 +1,6 @@ namespace UnityScript.Steps import System -import System.IO import Boo.Lang.Compiler import Boo.Lang.Compiler.Steps import UnityScript.Parser @@ -17,19 +16,4 @@ class Parse(AbstractCompilerStep): private def ParseInput(input as ICompilerInput): using reader = input.Open(): - if reader.Peek() == -1: - return - ParseReader(input.Name, reader) - - protected virtual def ParseReader(name as string, reader as TextReader): - lexer = UnityScriptLexer(reader) - lexer.setFilename(name) - lexer.setTokenCreator(Boo.Lang.Parser.BooToken.BooTokenCreator()) - - parser = UnityScriptParser(lexer, CompilerContext: Context) - parser.setFilename(name) - - try: - parser.start(self.CompileUnit) - except x as antlr.TokenStreamRecognitionException: - parser.reportError(x.recog) + UnityScriptParser.ParseReader(reader, input.Name, self.Context, self.CompileUnit) \ No newline at end of file From 52b8b128b4eb39b72c3622a36afc11ecccc7f995 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 3 Apr 2012 16:22:11 -0300 Subject: [PATCH 225/276] allow creating an UnityScriptCompilerParameters without any assembly references --- src/UnityScript.Tests/UnityScript.Tests.booproj | 1 + .../UnityScriptCompilerParametersTest.boo | 12 ++++++++++++ src/UnityScript/UnityScriptCompilerParameters.boo | 14 +++++++++----- 3 files changed, 22 insertions(+), 5 deletions(-) create mode 100755 src/UnityScript.Tests/UnityScriptCompilerParametersTest.boo mode change 100644 => 100755 src/UnityScript/UnityScriptCompilerParameters.boo diff --git a/src/UnityScript.Tests/UnityScript.Tests.booproj b/src/UnityScript.Tests/UnityScript.Tests.booproj index 3c8a722..bd49959 100755 --- a/src/UnityScript.Tests/UnityScript.Tests.booproj +++ b/src/UnityScript.Tests/UnityScript.Tests.booproj @@ -62,6 +62,7 @@ + diff --git a/src/UnityScript.Tests/UnityScriptCompilerParametersTest.boo b/src/UnityScript.Tests/UnityScriptCompilerParametersTest.boo new file mode 100755 index 0000000..bb1a9da --- /dev/null +++ b/src/UnityScript.Tests/UnityScriptCompilerParametersTest.boo @@ -0,0 +1,12 @@ +namespace UnityScript.Tests + +import UnityScript +import NUnit.Framework + +[TestFixture] +class UnityScriptCompilerParametersTest: + + [Test] + def PragmaDowncastCanBeDisabled(): + + Assert.AreEqual(0, UnityScriptCompilerParameters(false).References.Count) diff --git a/src/UnityScript/UnityScriptCompilerParameters.boo b/src/UnityScript/UnityScriptCompilerParameters.boo old mode 100644 new mode 100755 index 3a5f24e..84cd9e3 --- a/src/UnityScript/UnityScriptCompilerParameters.boo +++ b/src/UnityScript/UnityScriptCompilerParameters.boo @@ -21,13 +21,11 @@ class UnityScriptCompilerParameters(CompilerParameters): property GlobalVariablesBecomeFields = true property DisableEval as string - - def constructor(): - super(Boo.Lang.Compiler.TypeSystem.Reflection.ReflectionTypeSystemProvider()) + + def constructor(loadDefaultReferences as bool): + super(Boo.Lang.Compiler.TypeSystem.Reflection.ReflectionTypeSystemProvider(), loadDefaultReferences) self.Checked = false self.OutputType = CompilerOutputType.Library - self.References.Add(typeof(UnityScript.Lang.Array).Assembly) - self.References.Add(GetType().Assembly) self.Environment = DeferredEnvironment() { EntityFormatter: { UnityScriptEntityFormatter() }, TypeSystemServices: { UnityScriptTypeSystem() }, @@ -35,6 +33,12 @@ class UnityScriptCompilerParameters(CompilerParameters): DowncastPermissions: { UnityDowncastPermissions() }, LanguageAmbiance: { UnityScriptAmbiance() } } + if loadDefaultReferences: + self.References.Add(typeof(UnityScript.Lang.Array).Assembly) + self.References.Add(GetType().Assembly) + + def constructor(): + self(true) def AddToEnvironment(serviceType as System.Type, factory as ObjectFactory): (Environment as DeferredEnvironment).Add(serviceType, factory) From c2f27b607bb40c34028ff3ca2734b24871f15d8b Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Tue, 3 Apr 2012 16:23:01 -0300 Subject: [PATCH 226/276] produce modules for empty files too --- src/UnityScript.Tests/ParserTestFixture.boo | 3 ++- src/UnityScript/Parser/UnityScriptParserExtensions.boo | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) mode change 100644 => 100755 src/UnityScript/Parser/UnityScriptParserExtensions.boo diff --git a/src/UnityScript.Tests/ParserTestFixture.boo b/src/UnityScript.Tests/ParserTestFixture.boo index 1e38e84..70ed88b 100755 --- a/src/UnityScript.Tests/ParserTestFixture.boo +++ b/src/UnityScript.Tests/ParserTestFixture.boo @@ -17,6 +17,7 @@ partial class ParserTestFixture(AbstractCompilerTestFixture): def EmptyFile(): result = CompileTestCase(StringInput("empty", "")) Assert.AreEqual(0, len(result.Errors), result.Errors.ToString(true)) - Assert.AreEqual(0, len(result.CompileUnit.Modules)) + Assert.AreEqual(1, len(result.CompileUnit.Modules)) + Assert.AreEqual("empty", result.CompileUnit.Modules[0].LexicalInfo.FileName) diff --git a/src/UnityScript/Parser/UnityScriptParserExtensions.boo b/src/UnityScript/Parser/UnityScriptParserExtensions.boo old mode 100644 new mode 100755 index ebf6b09..00480a6 --- a/src/UnityScript/Parser/UnityScriptParserExtensions.boo +++ b/src/UnityScript/Parser/UnityScriptParserExtensions.boo @@ -9,6 +9,7 @@ partial class UnityScriptParser: static def ParseReader(reader as TextReader, fileName as string, context as CompilerContext, targetCompileUnit as CompileUnit): lexer = UnityScriptLexerFor(reader, fileName) if lexer is null: + targetCompileUnit.Modules.Add(Module(LexicalInfo(fileName, 1, 1))) return parser = UnityScriptParser(lexer, CompilerContext: context) From d14d90b44874c865fe96e5ba4caeb9fed80ffd86 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 9 Apr 2012 10:22:03 -0300 Subject: [PATCH 227/276] support script level properties --- .../DuckyIntegrationTestFixture.boo | 4 + ...StrictIntegrationTestFixture.Generated.boo | 4 + src/UnityScript/Parser/UnityScriptLexer.boo | 3940 +++---- src/UnityScript/Parser/UnityScriptParser.boo | 9391 ++++++++--------- .../Parser/UnityScriptTokenTypes.boo | 250 +- .../Parser/UnityScriptTokenTypes.txt | 240 +- src/UnityScript/UnityScript.g | 21 +- tests/integration/script-properties.js | 17 + 8 files changed, 6929 insertions(+), 6938 deletions(-) mode change 100644 => 100755 src/UnityScript/UnityScript.g create mode 100755 tests/integration/script-properties.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 3f6907e..68ceccb 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -510,6 +510,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/script-attributes.js") + [Test] def script_properties(): + RunTestCase("tests/integration/script-properties.js") + + [Test] def shift_left_bitwise_or(): RunTestCase("tests/integration/shift-left-bitwise-or.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo index e658d90..b27b7fc 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo @@ -508,6 +508,10 @@ partial class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/script-attributes.js") + [Test] def script_properties(): + RunTestCase("tests/integration/script-properties.js") + + [Test] def shift_left_bitwise_or(): RunTestCase("tests/integration/shift-left-bitwise-or.js") diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index 464adef..dd8fbb1 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -1,1975 +1,1975 @@ -// $ANTLR 2.7.5 (20050517): "UnityScript.g" -> "UnityScriptLexer.boo"$ - -namespace UnityScript.Parser -// Generate header specific to lexer Boo file -import System -import System.IO.Stream as Stream -import System.IO.TextReader as TextReader -import System.Collections.Hashtable as Hashtable -import System.Collections.Comparer as Comparer - -import antlr.TokenStreamException as TokenStreamException -import antlr.TokenStreamIOException as TokenStreamIOException -import antlr.TokenStreamRecognitionException as TokenStreamRecognitionException -import antlr.CharStreamException as CharStreamException -import antlr.CharStreamIOException as CharStreamIOException -import antlr.ANTLRException as ANTLRException -import antlr.CharScanner as CharScanner -import antlr.InputBuffer as InputBuffer -import antlr.ByteBuffer as ByteBuffer -import antlr.CharBuffer as CharBuffer -import antlr.Token as Token -import antlr.IToken as IToken -import antlr.CommonToken as CommonToken -import antlr.SemanticException as SemanticException -import antlr.RecognitionException as RecognitionException -import antlr.NoViableAltForCharException as NoViableAltForCharException -import antlr.MismatchedCharException as MismatchedCharException -import antlr.TokenStream as TokenStream -import antlr.LexerSharedInputState as LexerSharedInputState -import antlr.collections.impl.BitSet as BitSet - -class UnityScriptLexer(antlr.CharScanner, TokenStream): - public static final EOF = 1 - public static final NULL_TREE_LOOKAHEAD = 3 - public static final AS = 4 - public static final BREAK = 5 - public static final CAST = 6 - public static final CATCH = 7 - public static final CLASS = 8 - public static final CONTINUE = 9 - public static final DO = 10 - public static final ELSE = 11 - public static final ENUM = 12 - public static final EXTENDS = 13 - public static final FALSE = 14 - public static final FINAL = 15 - public static final FINALLY = 16 - public static final FOR = 17 - public static final FUNCTION = 18 - public static final GET = 19 - public static final IF = 20 - public static final IMPORT = 21 - public static final IMPLEMENTS = 22 - public static final IN = 23 - public static final INTERFACE = 24 - public static final INSTANCEOF = 25 - public static final NEW = 26 - public static final NULL = 27 - public static final RETURN = 28 - public static final PUBLIC = 29 - public static final PROTECTED = 30 - public static final INTERNAL = 31 - public static final OVERRIDE = 32 - public static final PARTIAL = 33 - public static final PRIVATE = 34 - public static final SET = 35 - public static final STATIC = 36 - public static final SUPER = 37 - public static final THIS = 38 - public static final THROW = 39 - public static final TRUE = 40 - public static final TRY = 41 - public static final TYPEOF = 42 - public static final VAR = 43 - public static final VIRTUAL = 44 - public static final WHILE = 45 - public static final YIELD = 46 - public static final SWITCH = 47 - public static final CASE = 48 - public static final DEFAULT = 49 - public static final INPLACE_DIVISION = 50 - public static final INPLACE_ADD = 51 - public static final INPLACE_SUBTRACT = 52 - public static final INPLACE_MULTIPLY = 53 - public static final SL_COMMENT = 54 - public static final PRAGMA_ON = 55 - public static final PRAGMA_OFF = 56 - public static final ID = 57 - public static final DOUBLE_QUOTED_STRING = 58 - public static final LBRACE = 59 - public static final RBRACE = 60 - public static final LPAREN = 61 - public static final RPAREN = 62 - public static final DOT = 63 - public static final COLON = 64 - public static final COMMA = 65 - public static final LBRACK = 66 - public static final RBRACK = 67 - public static final BITWISE_OR = 68 - public static final INPLACE_BITWISE_OR = 69 - public static final BITWISE_AND = 70 - public static final BITWISE_XOR = 71 - public static final INPLACE_BITWISE_AND = 72 - public static final LOGICAL_OR = 73 - public static final LOGICAL_AND = 74 - public static final EOS = 75 - public static final ASSIGN = 76 - public static final INCREMENT = 77 - public static final DECREMENT = 78 - public static final ADD = 79 - public static final SUBTRACT = 80 - public static final MODULUS = 81 - public static final MULTIPLY = 82 - public static final EQUALITY = 83 - public static final INEQUALITY = 84 - public static final QUESTION_MARK = 85 - public static final BITWISE_NOT = 86 - public static final REFERENCE_EQUALITY = 87 - public static final REFERENCE_INEQUALITY = 88 - public static final LESS_THAN = 89 - public static final LESS_THAN_OR_EQUAL = 90 - public static final SHIFT_LEFT = 91 - public static final INPLACE_SHIFT_LEFT = 92 - public static final GREATER_THAN = 93 - public static final GREATER_THAN_OR_EQUAL = 94 - public static final SHIFT_RIGHT = 95 - public static final INPLACE_SHIFT_RIGHT = 96 - public static final AT = 97 - public static final SCRIPT_ATTRIBUTE_MARKER = 98 - public static final ASSEMBLY_ATTRIBUTE_MARKER = 99 - public static final INPLACE_BITWISE_XOR = 100 - public static final NOT = 101 - public static final DIVISION = 102 - public static final RE_LITERAL = 103 - public static final DOUBLE = 104 - public static final INT = 105 - public static final LONG = 106 - public static final SINGLE_QUOTED_STRING = 107 - public static final DOUBLE_SUFFIX = 108 - public static final EXPONENT = 109 - public static final PRAGMA_WHITE_SPACE = 110 - public static final WHITE_SPACE = 111 - public static final DQS_ESC = 112 - public static final SQS_ESC = 113 - public static final SESC = 114 - public static final ML_COMMENT = 115 - public static final RE_CHAR = 116 - public static final RE_ESC = 117 - public static final NEWLINE = 118 - public static final ID_LETTER = 119 - public static final DIGIT = 120 - public static final HEXDIGIT = 121 - +// $ANTLR 2.7.5 (20050517): "src/UnityScript/UnityScript.g" -> "UnityScriptLexer.boo"$ + +namespace UnityScript.Parser +// Generate header specific to lexer Boo file +import System +import System.IO.Stream as Stream +import System.IO.TextReader as TextReader +import System.Collections.Hashtable as Hashtable +import System.Collections.Comparer as Comparer + +import antlr.TokenStreamException as TokenStreamException +import antlr.TokenStreamIOException as TokenStreamIOException +import antlr.TokenStreamRecognitionException as TokenStreamRecognitionException +import antlr.CharStreamException as CharStreamException +import antlr.CharStreamIOException as CharStreamIOException +import antlr.ANTLRException as ANTLRException +import antlr.CharScanner as CharScanner +import antlr.InputBuffer as InputBuffer +import antlr.ByteBuffer as ByteBuffer +import antlr.CharBuffer as CharBuffer +import antlr.Token as Token +import antlr.IToken as IToken +import antlr.CommonToken as CommonToken +import antlr.SemanticException as SemanticException +import antlr.RecognitionException as RecognitionException +import antlr.NoViableAltForCharException as NoViableAltForCharException +import antlr.MismatchedCharException as MismatchedCharException +import antlr.TokenStream as TokenStream +import antlr.LexerSharedInputState as LexerSharedInputState +import antlr.collections.impl.BitSet as BitSet + +class UnityScriptLexer(antlr.CharScanner, TokenStream): + public static final EOF = 1 + public static final NULL_TREE_LOOKAHEAD = 3 + public static final AS = 4 + public static final BREAK = 5 + public static final CAST = 6 + public static final CATCH = 7 + public static final CLASS = 8 + public static final CONTINUE = 9 + public static final DO = 10 + public static final ELSE = 11 + public static final ENUM = 12 + public static final EXTENDS = 13 + public static final FALSE = 14 + public static final FINAL = 15 + public static final FINALLY = 16 + public static final FOR = 17 + public static final FUNCTION = 18 + public static final GET = 19 + public static final IF = 20 + public static final IMPORT = 21 + public static final IMPLEMENTS = 22 + public static final IN = 23 + public static final INTERFACE = 24 + public static final INSTANCEOF = 25 + public static final NEW = 26 + public static final NULL = 27 + public static final RETURN = 28 + public static final PUBLIC = 29 + public static final PROTECTED = 30 + public static final INTERNAL = 31 + public static final OVERRIDE = 32 + public static final PARTIAL = 33 + public static final PRIVATE = 34 + public static final SET = 35 + public static final STATIC = 36 + public static final SUPER = 37 + public static final THIS = 38 + public static final THROW = 39 + public static final TRUE = 40 + public static final TRY = 41 + public static final TYPEOF = 42 + public static final VAR = 43 + public static final VIRTUAL = 44 + public static final WHILE = 45 + public static final YIELD = 46 + public static final SWITCH = 47 + public static final CASE = 48 + public static final DEFAULT = 49 + public static final INPLACE_DIVISION = 50 + public static final INPLACE_ADD = 51 + public static final INPLACE_SUBTRACT = 52 + public static final INPLACE_MULTIPLY = 53 + public static final SL_COMMENT = 54 + public static final PRAGMA_ON = 55 + public static final PRAGMA_OFF = 56 + public static final ID = 57 + public static final DOUBLE_QUOTED_STRING = 58 + public static final LBRACE = 59 + public static final RBRACE = 60 + public static final LPAREN = 61 + public static final RPAREN = 62 + public static final DOT = 63 + public static final COLON = 64 + public static final COMMA = 65 + public static final LBRACK = 66 + public static final RBRACK = 67 + public static final BITWISE_OR = 68 + public static final INPLACE_BITWISE_OR = 69 + public static final BITWISE_AND = 70 + public static final BITWISE_XOR = 71 + public static final INPLACE_BITWISE_AND = 72 + public static final LOGICAL_OR = 73 + public static final LOGICAL_AND = 74 + public static final EOS = 75 + public static final ASSIGN = 76 + public static final INCREMENT = 77 + public static final DECREMENT = 78 + public static final ADD = 79 + public static final SUBTRACT = 80 + public static final MODULUS = 81 + public static final MULTIPLY = 82 + public static final EQUALITY = 83 + public static final INEQUALITY = 84 + public static final QUESTION_MARK = 85 + public static final BITWISE_NOT = 86 + public static final REFERENCE_EQUALITY = 87 + public static final REFERENCE_INEQUALITY = 88 + public static final LESS_THAN = 89 + public static final LESS_THAN_OR_EQUAL = 90 + public static final SHIFT_LEFT = 91 + public static final INPLACE_SHIFT_LEFT = 92 + public static final GREATER_THAN = 93 + public static final GREATER_THAN_OR_EQUAL = 94 + public static final SHIFT_RIGHT = 95 + public static final INPLACE_SHIFT_RIGHT = 96 + public static final AT = 97 + public static final SCRIPT_ATTRIBUTE_MARKER = 98 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 99 + public static final INPLACE_BITWISE_XOR = 100 + public static final NOT = 101 + public static final DIVISION = 102 + public static final RE_LITERAL = 103 + public static final DOUBLE = 104 + public static final INT = 105 + public static final LONG = 106 + public static final SINGLE_QUOTED_STRING = 107 + public static final DOUBLE_SUFFIX = 108 + public static final EXPONENT = 109 + public static final PRAGMA_WHITE_SPACE = 110 + public static final WHITE_SPACE = 111 + public static final DQS_ESC = 112 + public static final SQS_ESC = 113 + public static final SESC = 114 + public static final ML_COMMENT = 115 + public static final RE_CHAR = 116 + public static final RE_ESC = 117 + public static final NEWLINE = 118 + public static final ID_LETTER = 119 + public static final DIGIT = 120 + public static final HEXDIGIT = 121 + property PreserveComments = false static def IsDigit(ch as char): return ch >= char('0') and ch <= char('9') - def constructor(ins as Stream): - self(ByteBuffer(ins)) - - def constructor(r as TextReader): - self(CharBuffer(r)) - - def constructor(ib as InputBuffer): - self(LexerSharedInputState(ib)) - - def constructor(state as LexerSharedInputState): - super(state) - initialize() - - private def initialize(): - caseSensitiveLiterals = true - setCaseSensitive(true) - literals = Hashtable(100, 0.4, null, Comparer.Default) - literals.Add(",", 65) - literals.Add("public", 29) - literals.Add("a string", 58) - literals.Add("an identifier", 57) - literals.Add("]", 67) - literals.Add("case", 48) - literals.Add("break", 5) - literals.Add("while", 45) - literals.Add("new", 26) - literals.Add("||", 73) - literals.Add("+", 79) - literals.Add("instanceof", 25) - literals.Add("implements", 22) - literals.Add("*", 82) - literals.Add("|=", 69) - literals.Add("typeof", 42) - literals.Add("@assembly", 99) - literals.Add("[", 66) - literals.Add(">>=", 96) - literals.Add("return", 28) - literals.Add("throw", 39) - literals.Add("var", 43) - literals.Add(")", 62) - literals.Add("==", 83) - literals.Add("null", 27) - literals.Add("protected", 30) - literals.Add("pragma off", 56) - literals.Add("@script", 98) - literals.Add("class", 8) - literals.Add("(", 61) - literals.Add("do", 10) - literals.Add("~", 86) - literals.Add("function", 18) - literals.Add("/=", 50) - literals.Add("super", 37) - literals.Add("@", 97) - literals.Add("-=", 52) - literals.Add("set", 35) - literals.Add("+=", 51) - literals.Add("!==", 88) - literals.Add("}", 60) - literals.Add("interface", 24) - literals.Add("?", 85) - literals.Add("&", 70) - literals.Add("internal", 31) - literals.Add("final", 15) - literals.Add("yield", 46) - literals.Add("!=", 84) - literals.Add("//", 54) - literals.Add("===", 87) - literals.Add("if", 20) - literals.Add("|", 68) - literals.Add("override", 32) - literals.Add(">", 93) - literals.Add("as", 4) - literals.Add("%", 81) - literals.Add("catch", 7) - literals.Add("try", 41) - literals.Add("{", 59) - literals.Add("=", 76) - literals.Add("enum", 12) - literals.Add("for", 17) - literals.Add(">>", 95) - literals.Add("extends", 13) - literals.Add("private", 34) - literals.Add("default", 49) - literals.Add("--", 78) - literals.Add("<", 89) - literals.Add("false", 14) - literals.Add("this", 38) - literals.Add("static", 36) - literals.Add(">=", 94) - literals.Add("<=", 90) - literals.Add("partial", 33) - literals.Add(";", 75) - literals.Add("get", 19) - literals.Add("<<=", 92) - literals.Add("continue", 9) - literals.Add("&&", 74) - literals.Add("cast", 6) - literals.Add("<<", 91) - literals.Add("pragma on", 55) - literals.Add(".", 63) - literals.Add("finally", 16) - literals.Add("else", 11) - literals.Add("import", 21) - literals.Add("++", 77) - literals.Add(":", 64) - literals.Add("in", 23) - literals.Add("switch", 47) - literals.Add("true", 40) - literals.Add("-", 80) - literals.Add("*=", 53) - literals.Add("virtual", 44) - literals.Add("^", 71) - literals.Add("&=", 72) - - override def nextToken() as IToken: - theRetToken as IToken - :tryAgain - while true: - _token as IToken = null - _ttype = Token.INVALID_TYPE - resetText() - try: // for char stream error handling - try: // for lexical error handling - _givenValue = cached_LA1 - if ((_givenValue == char('A')) - or (_givenValue ==char('B')) - or (_givenValue ==char('C')) - or (_givenValue ==char('D')) - or (_givenValue ==char('E')) - or (_givenValue ==char('F')) - or (_givenValue ==char('G')) - or (_givenValue ==char('H')) - or (_givenValue ==char('I')) - or (_givenValue ==char('J')) - or (_givenValue ==char('K')) - or (_givenValue ==char('L')) - or (_givenValue ==char('M')) - or (_givenValue ==char('N')) - or (_givenValue ==char('O')) - or (_givenValue ==char('P')) - or (_givenValue ==char('Q')) - or (_givenValue ==char('R')) - or (_givenValue ==char('S')) - or (_givenValue ==char('T')) - or (_givenValue ==char('U')) - or (_givenValue ==char('V')) - or (_givenValue ==char('W')) - or (_givenValue ==char('X')) - or (_givenValue ==char('Y')) - or (_givenValue ==char('Z')) - or (_givenValue ==char('_')) - or (_givenValue ==char('a')) - or (_givenValue ==char('b')) - or (_givenValue ==char('c')) - or (_givenValue ==char('d')) - or (_givenValue ==char('e')) - or (_givenValue ==char('f')) - or (_givenValue ==char('g')) - or (_givenValue ==char('h')) - or (_givenValue ==char('i')) - or (_givenValue ==char('j')) - or (_givenValue ==char('k')) - or (_givenValue ==char('l')) - or (_givenValue ==char('m')) - or (_givenValue ==char('n')) - or (_givenValue ==char('o')) - or (_givenValue ==char('p')) - or (_givenValue ==char('q')) - or (_givenValue ==char('r')) - or (_givenValue ==char('s')) - or (_givenValue ==char('t')) - or (_givenValue ==char('u')) - or (_givenValue ==char('v')) - or (_givenValue ==char('w')) - or (_givenValue ==char('x')) - or (_givenValue ==char('y')) - or (_givenValue ==char('z')) - ): // 1827 - mID(true) - theRetToken = returnToken_ - elif ((_givenValue == char('0')) - or (_givenValue ==char('1')) - or (_givenValue ==char('2')) - or (_givenValue ==char('3')) - or (_givenValue ==char('4')) - or (_givenValue ==char('5')) - or (_givenValue ==char('6')) - or (_givenValue ==char('7')) - or (_givenValue ==char('8')) - or (_givenValue ==char('9')) - ): // 1827 - mINT(true) - theRetToken = returnToken_ - elif ((_givenValue == char('.'))): // 1831 - mDOT(true) - theRetToken = returnToken_ - elif ((_givenValue == char(':'))): // 1831 - mCOLON(true) - theRetToken = returnToken_ - elif ((_givenValue == char(','))): // 1831 - mCOMMA(true) - theRetToken = returnToken_ - elif ((_givenValue == char('('))): // 1831 - mLPAREN(true) - theRetToken = returnToken_ - elif ((_givenValue == char(')'))): // 1831 - mRPAREN(true) - theRetToken = returnToken_ - elif ((_givenValue == char('['))): // 1831 - mLBRACK(true) - theRetToken = returnToken_ - elif ((_givenValue == char(']'))): // 1831 - mRBRACK(true) - theRetToken = returnToken_ - elif ((_givenValue == char('{'))): // 1831 - mLBRACE(true) - theRetToken = returnToken_ - elif ((_givenValue == char('}'))): // 1831 - mRBRACE(true) - theRetToken = returnToken_ - elif ((_givenValue == char(';'))): // 1831 - mEOS(true) - theRetToken = returnToken_ - elif ((_givenValue == char('#'))): // 1831 - mPRAGMA_ON(true) - theRetToken = returnToken_ - elif ((_givenValue == char('%'))): // 1831 - mMODULUS(true) - theRetToken = returnToken_ - elif ((_givenValue == char('?'))): // 1831 - mQUESTION_MARK(true) - theRetToken = returnToken_ - elif ((_givenValue == char('~'))): // 1831 - mBITWISE_NOT(true) - theRetToken = returnToken_ - elif ((_givenValue == char('@'))): // 1831 - mAT(true) - theRetToken = returnToken_ - elif ((_givenValue == char('/'))): // 1831 - mDIVISION(true) - theRetToken = returnToken_ - elif ((_givenValue == char('\t')) - or (_givenValue ==char('\n')) - or (_givenValue ==char('\u000c')) - or (_givenValue ==char('\r')) - or (_givenValue ==char(' ')) - ): // 1827 - mWHITE_SPACE(true) - theRetToken = returnToken_ - elif ((_givenValue == char('"'))): // 1831 - mDOUBLE_QUOTED_STRING(true) - theRetToken = returnToken_ - elif ((_givenValue == char('\''))): // 1831 - mSINGLE_QUOTED_STRING(true) - theRetToken = returnToken_ - else: // line 1969 - if ((cached_LA1==char('=')) and (cached_LA2==char('=')) and (LA(3)==char('='))): - mREFERENCE_EQUALITY(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('!')) and (cached_LA2==char('=')) and (LA(3)==char('='))): // line 2102 - mREFERENCE_INEQUALITY(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('<')) and (cached_LA2==char('<')) and (LA(3)==char('='))): // line 2102 - mINPLACE_SHIFT_LEFT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('>')) and (cached_LA2==char('>')) and (LA(3)==char('='))): // line 2102 - mINPLACE_SHIFT_RIGHT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('|')) and (cached_LA2==char('='))): // line 2102 - mINPLACE_BITWISE_OR(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('&')) and (cached_LA2==char('='))): // line 2102 - mINPLACE_BITWISE_AND(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('^')) and (cached_LA2==char('='))): // line 2102 - mINPLACE_BITWISE_XOR(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('|')) and (cached_LA2==char('|'))): // line 2102 - mLOGICAL_OR(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('&')) and (cached_LA2==char('&'))): // line 2102 - mLOGICAL_AND(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('+')) and (cached_LA2==char('+'))): // line 2102 - mINCREMENT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('-')) and (cached_LA2==char('-'))): // line 2102 - mDECREMENT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('+')) and (cached_LA2==char('='))): // line 2102 - mINPLACE_ADD(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('-')) and (cached_LA2==char('='))): // line 2102 - mINPLACE_SUBTRACT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('*')) and (cached_LA2==char('='))): // line 2102 - mINPLACE_MULTIPLY(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('=')) and (cached_LA2==char('=')) and (true)): // line 2102 - mEQUALITY(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('!')) and (cached_LA2==char('=')) and (true)): // line 2102 - mINEQUALITY(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('<')) and (cached_LA2==char('='))): // line 2102 - mLESS_THAN_OR_EQUAL(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('<')) and (cached_LA2==char('<')) and (true)): // line 2102 - mSHIFT_LEFT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('>')) and (cached_LA2==char('='))): // line 2102 - mGREATER_THAN_OR_EQUAL(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('>')) and (cached_LA2==char('>')) and (true)): // line 2102 - mSHIFT_RIGHT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('|')) and (true)): // line 2102 - mBITWISE_OR(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('&')) and (true)): // line 2102 - mBITWISE_AND(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('^')) and (true)): // line 2102 - mBITWISE_XOR(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('=')) and (true)): // line 2102 - mASSIGN(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('+')) and (true)): // line 2102 - mADD(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('-')) and (true)): // line 2102 - mSUBTRACT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('*')) and (true)): // line 2102 - mMULTIPLY(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('!')) and (true)): // line 2102 - mNOT(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('<')) and (true)): // line 2102 - mLESS_THAN(true) - theRetToken = returnToken_ - elif ((cached_LA1==char('>')) and (true)): // line 2102 - mGREATER_THAN(true) - theRetToken = returnToken_ - else: - if cached_LA1 == EOF_CHAR: - uponEOF(); returnToken_ = makeToken(Token.EOF_TYPE) - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - goto tryAgain if returnToken_ is null // found SKIP token - _ttype = returnToken_.Type - returnToken_.Type = _ttype - return returnToken_ - except e as RecognitionException: - raise TokenStreamRecognitionException(e) - except cse as CharStreamException: - if cse isa CharStreamIOException: - raise TokenStreamIOException(cast(CharStreamIOException, cse).io) - else: - raise TokenStreamException(cse.Message) - - public def mID(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = ID - - mID_LETTER(false) - while true: - _givenValue = cached_LA1 - if ((_givenValue == char('A')) - or (_givenValue ==char('B')) - or (_givenValue ==char('C')) - or (_givenValue ==char('D')) - or (_givenValue ==char('E')) - or (_givenValue ==char('F')) - or (_givenValue ==char('G')) - or (_givenValue ==char('H')) - or (_givenValue ==char('I')) - or (_givenValue ==char('J')) - or (_givenValue ==char('K')) - or (_givenValue ==char('L')) - or (_givenValue ==char('M')) - or (_givenValue ==char('N')) - or (_givenValue ==char('O')) - or (_givenValue ==char('P')) - or (_givenValue ==char('Q')) - or (_givenValue ==char('R')) - or (_givenValue ==char('S')) - or (_givenValue ==char('T')) - or (_givenValue ==char('U')) - or (_givenValue ==char('V')) - or (_givenValue ==char('W')) - or (_givenValue ==char('X')) - or (_givenValue ==char('Y')) - or (_givenValue ==char('Z')) - or (_givenValue ==char('_')) - or (_givenValue ==char('a')) - or (_givenValue ==char('b')) - or (_givenValue ==char('c')) - or (_givenValue ==char('d')) - or (_givenValue ==char('e')) - or (_givenValue ==char('f')) - or (_givenValue ==char('g')) - or (_givenValue ==char('h')) - or (_givenValue ==char('i')) - or (_givenValue ==char('j')) - or (_givenValue ==char('k')) - or (_givenValue ==char('l')) - or (_givenValue ==char('m')) - or (_givenValue ==char('n')) - or (_givenValue ==char('o')) - or (_givenValue ==char('p')) - or (_givenValue ==char('q')) - or (_givenValue ==char('r')) - or (_givenValue ==char('s')) - or (_givenValue ==char('t')) - or (_givenValue ==char('u')) - or (_givenValue ==char('v')) - or (_givenValue ==char('w')) - or (_givenValue ==char('x')) - or (_givenValue ==char('y')) - or (_givenValue ==char('z')) - ): // 1827 - mID_LETTER(false) - elif ((_givenValue == char('0')) - or (_givenValue ==char('1')) - or (_givenValue ==char('2')) - or (_givenValue ==char('3')) - or (_givenValue ==char('4')) - or (_givenValue ==char('5')) - or (_givenValue ==char('6')) - or (_givenValue ==char('7')) - or (_givenValue ==char('8')) - or (_givenValue ==char('9')) - ): // 1827 - mDIGIT(false) - else: // line 1969 - goto _loop328_breakloop - :_loop328_breakloop - _ttype = testLiteralsTable(_ttype) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mID_LETTER(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = ID_LETTER - - _givenValue = cached_LA1 - if ((_givenValue == char('_'))): // 1831 - match('_') - elif ((_givenValue == char('a')) - or (_givenValue ==char('b')) - or (_givenValue ==char('c')) - or (_givenValue ==char('d')) - or (_givenValue ==char('e')) - or (_givenValue ==char('f')) - or (_givenValue ==char('g')) - or (_givenValue ==char('h')) - or (_givenValue ==char('i')) - or (_givenValue ==char('j')) - or (_givenValue ==char('k')) - or (_givenValue ==char('l')) - or (_givenValue ==char('m')) - or (_givenValue ==char('n')) - or (_givenValue ==char('o')) - or (_givenValue ==char('p')) - or (_givenValue ==char('q')) - or (_givenValue ==char('r')) - or (_givenValue ==char('s')) - or (_givenValue ==char('t')) - or (_givenValue ==char('u')) - or (_givenValue ==char('v')) - or (_givenValue ==char('w')) - or (_givenValue ==char('x')) - or (_givenValue ==char('y')) - or (_givenValue ==char('z')) - ): // 1827 - matchRange(char('a'),char('z')) - elif ((_givenValue == char('A')) - or (_givenValue ==char('B')) - or (_givenValue ==char('C')) - or (_givenValue ==char('D')) - or (_givenValue ==char('E')) - or (_givenValue ==char('F')) - or (_givenValue ==char('G')) - or (_givenValue ==char('H')) - or (_givenValue ==char('I')) - or (_givenValue ==char('J')) - or (_givenValue ==char('K')) - or (_givenValue ==char('L')) - or (_givenValue ==char('M')) - or (_givenValue ==char('N')) - or (_givenValue ==char('O')) - or (_givenValue ==char('P')) - or (_givenValue ==char('Q')) - or (_givenValue ==char('R')) - or (_givenValue ==char('S')) - or (_givenValue ==char('T')) - or (_givenValue ==char('U')) - or (_givenValue ==char('V')) - or (_givenValue ==char('W')) - or (_givenValue ==char('X')) - or (_givenValue ==char('Y')) - or (_givenValue ==char('Z')) - ): // 1827 - matchRange(char('A'),char('Z')) - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mDIGIT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = DIGIT - - matchRange(char('0'),char('9')) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INT - - if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): - match("0x") - _cnt332 as int = 0 - while true: - if ((tokenSet_0_.member(cast(int, cached_LA1)))): - mHEXDIGIT(false) - else: - if (_cnt332 >= 1): - goto _loop332_breakloop - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt332 - :_loop332_breakloop - if ((cached_LA1==char('L') or cached_LA1==char('l'))): - _givenValue = cached_LA1 - if ((_givenValue == char('l'))): // 1831 - match('l') - elif ((_givenValue == char('L'))): // 1831 - match('L') - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if 0 == inputState.guessing: - _ttype = LONG; - else: // line 2053 - pass // 947 - elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt336 as int = 0 - while true: - if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): - mDIGIT(false) - else: - if (_cnt336 >= 1): - goto _loop336_breakloop - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt336 - :_loop336_breakloop - _givenValue = cached_LA1 - if ((_givenValue == char('L')) - or (_givenValue ==char('l')) - ): // 1827 - _givenValue = cached_LA1 - if ((_givenValue == char('l'))): // 1831 - match('l') - elif ((_givenValue == char('L'))): // 1831 - match('L') - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if 0 == inputState.guessing: - _ttype = LONG; - elif ((_givenValue == char('D')) - or (_givenValue ==char('F')) - or (_givenValue ==char('d')) - or (_givenValue ==char('f')) - ): // 1827 - _givenValue = cached_LA1 - if ((_givenValue == char('f'))): // 1831 - match('f') - elif ((_givenValue == char('F'))): // 1831 - match('F') - elif ((_givenValue == char('d'))): // 1831 - match('d') - elif ((_givenValue == char('D'))): // 1831 - match('D') - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if 0 == inputState.guessing: - _ttype = DOUBLE; - elif ((_givenValue == char('.'))): // 1831 - match('.') - mDOUBLE_SUFFIX(false) - if 0 == inputState.guessing: - _ttype = DOUBLE; - elif ((_givenValue == char('E')) - or (_givenValue ==char('e')) - ): // 1827 - mEXPONENT(false) - if 0 == inputState.guessing: - _ttype = DOUBLE; - else: // line 1969 - pass // 947 - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mHEXDIGIT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = HEXDIGIT - - _givenValue = cached_LA1 - if ((_givenValue == char('a')) - or (_givenValue ==char('b')) - or (_givenValue ==char('c')) - or (_givenValue ==char('d')) - or (_givenValue ==char('e')) - or (_givenValue ==char('f')) - ): // 1827 - matchRange(char('a'),char('f')) - elif ((_givenValue == char('A')) - or (_givenValue ==char('B')) - or (_givenValue ==char('C')) - or (_givenValue ==char('D')) - or (_givenValue ==char('E')) - or (_givenValue ==char('F')) - ): // 1827 - matchRange(char('A'),char('F')) - elif ((_givenValue == char('0')) - or (_givenValue ==char('1')) - or (_givenValue ==char('2')) - or (_givenValue ==char('3')) - or (_givenValue ==char('4')) - or (_givenValue ==char('5')) - or (_givenValue ==char('6')) - or (_givenValue ==char('7')) - or (_givenValue ==char('8')) - or (_givenValue ==char('9')) - ): // 1827 - matchRange(char('0'),char('9')) - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mDOUBLE_SUFFIX(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = DOUBLE_SUFFIX - - _cnt345 as int = 0 - while true: - if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): - mDIGIT(false) - else: - if (_cnt345 >= 1): - goto _loop345_breakloop - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt345 - :_loop345_breakloop - if ((cached_LA1==char('E') or cached_LA1==char('e'))): - mEXPONENT(false) - else: // line 2053 - pass // 947 - _givenValue = cached_LA1 - if ((_givenValue == char('f'))): // 1831 - match('f') - elif ((_givenValue == char('F'))): // 1831 - match('F') - elif ((_givenValue == char('d'))): // 1831 - match('d') - elif ((_givenValue == char('D'))): // 1831 - match('D') - else: // line 1969 - pass // 947 - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mEXPONENT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = EXPONENT - - _givenValue = cached_LA1 - if ((_givenValue == char('e'))): // 1831 - match('e') - elif ((_givenValue == char('E'))): // 1831 - match('E') - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _givenValue = cached_LA1 - if ((_givenValue == char('+'))): // 1831 - match('+') - elif ((_givenValue == char('-'))): // 1831 - match('-') - elif ((_givenValue == char('0')) - or (_givenValue ==char('1')) - or (_givenValue ==char('2')) - or (_givenValue ==char('3')) - or (_givenValue ==char('4')) - or (_givenValue ==char('5')) - or (_givenValue ==char('6')) - or (_givenValue ==char('7')) - or (_givenValue ==char('8')) - or (_givenValue ==char('9')) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt352 as int = 0 - while true: - if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): - mDIGIT(false) - else: - if (_cnt352 >= 1): - goto _loop352_breakloop - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt352 - :_loop352_breakloop - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mDOT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = DOT - - match('.') - if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): - mDOUBLE_SUFFIX(false) - if 0 == inputState.guessing: - _ttype = DOUBLE; - else: // line 2053 - pass // 947 - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mCOLON(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = COLON - - match(':') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mCOMMA(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = COMMA - - match(',') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mLPAREN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = LPAREN - - match('(') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mRPAREN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = RPAREN - - match(')') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mLBRACK(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = LBRACK - - match('[') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mRBRACK(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = RBRACK - - match(']') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mLBRACE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = LBRACE - - match('{') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mRBRACE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = RBRACE - - match('}') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mBITWISE_OR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = BITWISE_OR - - match('|') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINPLACE_BITWISE_OR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INPLACE_BITWISE_OR - - match("|=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mBITWISE_AND(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = BITWISE_AND - - match('&') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINPLACE_BITWISE_AND(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INPLACE_BITWISE_AND - - match("&=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mBITWISE_XOR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = BITWISE_XOR - - match('^') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINPLACE_BITWISE_XOR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INPLACE_BITWISE_XOR - - match("^=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mLOGICAL_OR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = LOGICAL_OR - - match("||") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mLOGICAL_AND(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = LOGICAL_AND - - match("&&") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mEOS(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = EOS - - match(';') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mASSIGN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = ASSIGN - - match('=') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINCREMENT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INCREMENT - - match("++") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mDECREMENT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = DECREMENT - - match("--") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mADD(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = ADD - - match('+') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mPRAGMA_ON(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = PRAGMA_ON - id as IToken - - _saveIndex = text.Length - match("#pragma") - text.Length = _saveIndex - _cnt376 as int = 0 - while true: - if ((cached_LA1==char('\t') or cached_LA1==char(' '))): - mPRAGMA_WHITE_SPACE(false) - else: - if (_cnt376 >= 1): - goto _loop376_breakloop - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt376 - :_loop376_breakloop - mID(true) - id = returnToken_ - if ((cached_LA1==char('\t') or cached_LA1==char(' ')) and (cached_LA2==char('\t') or cached_LA2==char(' ') or cached_LA2==char('o')) and (LA(3)==char('\t') or LA(3)==char(' ') or LA(3)==char('f') or LA(3)==char('n') or LA(3)==char('o'))): - _cnt379 as int = 0 - while true: - if ((cached_LA1==char('\t') or cached_LA1==char(' '))): - mPRAGMA_WHITE_SPACE(false) - else: - if (_cnt379 >= 1): - goto _loop379_breakloop - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt379 - :_loop379_breakloop - if ((cached_LA1==char('o')) and (cached_LA2==char('f'))): - _saveIndex = text.Length - match("off") - text.Length = _saveIndex - if 0 == inputState.guessing: - _ttype = PRAGMA_OFF; - elif ((cached_LA1==char('o')) and (cached_LA2==char('n'))): // line 2102 - _saveIndex = text.Length - match("on") - text.Length = _saveIndex - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - elif ((cached_LA1==char('\t') or cached_LA1==char('\n') or cached_LA1==char('\r') or cached_LA1==char(' ')) and (true) and (true)): // line 2102 - pass // 947 - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - while true: - if ((cached_LA1==char('\t') or cached_LA1==char(' '))): - mPRAGMA_WHITE_SPACE(false) - else: - goto _loop382_breakloop - :_loop382_breakloop - _saveIndex = text.Length - mNEWLINE(false) - text.Length = _saveIndex - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mPRAGMA_WHITE_SPACE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = PRAGMA_WHITE_SPACE - - _givenValue = cached_LA1 - if ((_givenValue == char(' '))): // 1831 - _saveIndex = text.Length - match(' ') - text.Length = _saveIndex - elif ((_givenValue == char('\t'))): // 1831 - _saveIndex = text.Length - match('\t') - text.Length = _saveIndex - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mNEWLINE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = NEWLINE - - _givenValue = cached_LA1 - if ((_givenValue == char('\n'))): // 1831 - match('\n') - elif ((_givenValue == char('\r'))): // 1831 - match('\r') - if ((cached_LA1==char('\n')) and (true) and (true)): - match('\n') - else: // line 2053 - pass // 947 - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if 0 == inputState.guessing: - newline(); - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINPLACE_ADD(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INPLACE_ADD - - match("+=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mSUBTRACT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = SUBTRACT - - match('-') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINPLACE_SUBTRACT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INPLACE_SUBTRACT - - match("-=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mMODULUS(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = MODULUS - - match('%') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mMULTIPLY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = MULTIPLY - - match('*') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINPLACE_MULTIPLY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INPLACE_MULTIPLY - - match("*=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mEQUALITY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = EQUALITY - - match("==") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINEQUALITY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INEQUALITY - - match("!=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mNOT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = NOT - - match('!') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mQUESTION_MARK(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = QUESTION_MARK - - match('?') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mBITWISE_NOT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = BITWISE_NOT - - match('~') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mREFERENCE_EQUALITY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = REFERENCE_EQUALITY - - match("===") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mREFERENCE_INEQUALITY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = REFERENCE_INEQUALITY - - match("!==") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mLESS_THAN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = LESS_THAN - - match('<') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mLESS_THAN_OR_EQUAL(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = LESS_THAN_OR_EQUAL - - match("<=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mSHIFT_LEFT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = SHIFT_LEFT - - match("<<") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINPLACE_SHIFT_LEFT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INPLACE_SHIFT_LEFT - - match("<<=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mGREATER_THAN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = GREATER_THAN - - match('>') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mGREATER_THAN_OR_EQUAL(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = GREATER_THAN_OR_EQUAL - - match(">=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mSHIFT_RIGHT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = SHIFT_RIGHT - - match(">>") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mINPLACE_SHIFT_RIGHT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = INPLACE_SHIFT_RIGHT - - match(">>=") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mAT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = AT - - match('@') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mDIVISION(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = DIVISION - - synPredMatched409 as bool = false - if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m409 as int = mark() - synPredMatched409 = true - ++inputState.guessing - try: - match("/*") - except x as RecognitionException: - synPredMatched409 = false - rewind(_m409) - --inputState.guessing - if synPredMatched409: - mML_COMMENT(false) - if 0 == inputState.guessing: - if not PreserveComments: - _ttype = Token.SKIP - elif ((cached_LA1==char('/')) and (true)): // line 2102 - match('/') - _givenValue = cached_LA1 - if ((_givenValue == char('/'))): // 1831 - match('/') - while true: - if ((tokenSet_1_.member(cast(int, cached_LA1)))): - match(tokenSet_1_) - else: - goto _loop414_breakloop - :_loop414_breakloop - if 0 == inputState.guessing: - if PreserveComments: - _ttype = SL_COMMENT - else: - _ttype = Token.SKIP; - elif ((_givenValue == char('='))): // 1831 - match('=') - if 0 == inputState.guessing: - _ttype = INPLACE_DIVISION; - else: // line 1969 - pass // 947 - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mML_COMMENT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = ML_COMMENT - - match("/*") - while true: - if (((cached_LA1==char('*')) and (((cached_LA2 >= char('\u0003')) and (cached_LA2 <= char('\ufffe')))) and (((LA(3) >= char('\u0003')) and (LA(3) <= char('\ufffe'))))) and ( LA(2) != char('/') )): - match('*') - elif ((cached_LA1==char('\n') or cached_LA1==char('\r'))): // line 2102 - mNEWLINE(false) - elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 - match(tokenSet_2_) - else: - goto _loop443_breakloop - :_loop443_breakloop - match("*/") - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mWHITE_SPACE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = WHITE_SPACE - - _cnt418 as int = 0 - while true: - _givenValue = cached_LA1 - if ((_givenValue == char(' '))): // 1831 - match(' ') - elif ((_givenValue == char('\t'))): // 1831 - match('\t') - elif ((_givenValue == char('\u000c'))): // 1831 - match('\f') - elif ((_givenValue == char('\n')) - or (_givenValue ==char('\r')) - ): // 1827 - mNEWLINE(false) - else: // line 1969 - if (_cnt418 >= 1): - goto _loop418_breakloop - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt418 - :_loop418_breakloop - if 0 == inputState.guessing: - _ttype = Token.SKIP; - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mDOUBLE_QUOTED_STRING(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = DOUBLE_QUOTED_STRING - - _saveIndex = text.Length - match('"') - text.Length = _saveIndex - while true: - if ((cached_LA1==char('\\'))): - mDQS_ESC(false) - elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 - match(tokenSet_3_) - else: - goto _loop422_breakloop - :_loop422_breakloop - _saveIndex = text.Length - match('"') - text.Length = _saveIndex - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mDQS_ESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = DQS_ESC - - _saveIndex = text.Length - match('\\') - text.Length = _saveIndex - _givenValue = cached_LA1 - if ((_givenValue == char('0')) - or (_givenValue ==char('\\')) - or (_givenValue ==char('a')) - or (_givenValue ==char('b')) - or (_givenValue ==char('f')) - or (_givenValue ==char('n')) - or (_givenValue ==char('r')) - or (_givenValue ==char('t')) - ): // 1827 - mSESC(false) - elif ((_givenValue == char('"'))): // 1831 - match('"') - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - public def mSINGLE_QUOTED_STRING(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = SINGLE_QUOTED_STRING - - _saveIndex = text.Length - match('\'') - text.Length = _saveIndex - while true: - if ((cached_LA1==char('\\'))): - mSQS_ESC(false) - elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 - match(tokenSet_4_) - else: - goto _loop426_breakloop - :_loop426_breakloop - _saveIndex = text.Length - match('\'') - text.Length = _saveIndex - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mSQS_ESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = SQS_ESC - - _saveIndex = text.Length - match('\\') - text.Length = _saveIndex - _givenValue = cached_LA1 - if ((_givenValue == char('0')) - or (_givenValue ==char('\\')) - or (_givenValue ==char('a')) - or (_givenValue ==char('b')) - or (_givenValue ==char('f')) - or (_givenValue ==char('n')) - or (_givenValue ==char('r')) - or (_givenValue ==char('t')) - ): // 1827 - mSESC(false) - elif ((_givenValue == char('\''))): // 1831 - match('\'') - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mSESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = SESC - - _givenValue = cached_LA1 - if ((_givenValue == char('r'))): // 1831 - _saveIndex = text.Length - match('r') - text.Length = _saveIndex - if 0 == inputState.guessing: - text.Length = _begin; text.Append("\r"); - elif ((_givenValue == char('n'))): // 1831 - _saveIndex = text.Length - match('n') - text.Length = _saveIndex - if 0 == inputState.guessing: - text.Length = _begin; text.Append("\n"); - elif ((_givenValue == char('t'))): // 1831 - _saveIndex = text.Length - match('t') - text.Length = _saveIndex - if 0 == inputState.guessing: - text.Length = _begin; text.Append("\t"); - elif ((_givenValue == char('a'))): // 1831 - _saveIndex = text.Length - match('a') - text.Length = _saveIndex - if 0 == inputState.guessing: - text.Length = _begin; text.Append("\a"); - elif ((_givenValue == char('b'))): // 1831 - _saveIndex = text.Length - match('b') - text.Length = _saveIndex - if 0 == inputState.guessing: - text.Length = _begin; text.Append("\b"); - elif ((_givenValue == char('f'))): // 1831 - _saveIndex = text.Length - match('f') - text.Length = _saveIndex - if 0 == inputState.guessing: - text.Length = _begin; text.Append("\f"); - elif ((_givenValue == char('0'))): // 1831 - _saveIndex = text.Length - match('0') - text.Length = _saveIndex - if 0 == inputState.guessing: - text.Length = _begin; text.Append("\0"); - elif ((_givenValue == char('\\'))): // 1831 - _saveIndex = text.Length - match('\\') - text.Length = _saveIndex - if 0 == inputState.guessing: - text.Length = _begin; text.Append("\\"); - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mRE_LITERAL(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = RE_LITERAL - - match('/') - _cnt446 as int = 0 - while true: - if ((tokenSet_5_.member(cast(int, cached_LA1)))): - mRE_CHAR(false) - else: - if (_cnt446 >= 1): - goto _loop446_breakloop - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt446 - :_loop446_breakloop - match('/') - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mRE_CHAR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = RE_CHAR - - if ((cached_LA1==char('\\'))): - mRE_ESC(false) - elif ((tokenSet_6_.member(cast(int, cached_LA1)))): // line 2102 - match(tokenSet_6_) - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - protected def mRE_ESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException - _ttype as int; _token as IToken; _begin = text.Length; - _ttype = RE_ESC - - match('\\') - _givenValue = cached_LA1 - if ((_givenValue == char('a'))): // 1831 - match('a') - elif ((_givenValue == char('b'))): // 1831 - match('b') - elif ((_givenValue == char('c'))): // 1831 - match('c') - matchRange(char('A'),char('Z')) - elif ((_givenValue == char('t'))): // 1831 - match('t') - elif ((_givenValue == char('r'))): // 1831 - match('r') - elif ((_givenValue == char('v'))): // 1831 - match('v') - elif ((_givenValue == char('f'))): // 1831 - match('f') - elif ((_givenValue == char('n'))): // 1831 - match('n') - elif ((_givenValue == char('e'))): // 1831 - match('e') - elif ((_givenValue == char('0')) - or (_givenValue ==char('1')) - or (_givenValue ==char('2')) - or (_givenValue ==char('3')) - or (_givenValue ==char('4')) - or (_givenValue ==char('5')) - or (_givenValue ==char('6')) - or (_givenValue ==char('7')) - or (_givenValue ==char('8')) - or (_givenValue ==char('9')) - ): // 1827 - _cnt452 as int = 0 - while true: - if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): - mDIGIT(false) - else: - if (_cnt452 >= 1): - goto _loop452_breakloop - else: - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt452 - :_loop452_breakloop - elif ((_givenValue == char('x'))): // 1831 - match('x') - mDIGIT(false) - mDIGIT(false) - elif ((_givenValue == char('u'))): // 1831 - match('u') - mDIGIT(false) - mDIGIT(false) - mDIGIT(false) - mDIGIT(false) - elif ((_givenValue == char('\\'))): // 1831 - match('\\') - elif ((_givenValue == char('w'))): // 1831 - match('w') - elif ((_givenValue == char('W'))): // 1831 - match('W') - elif ((_givenValue == char('s'))): // 1831 - match('s') - elif ((_givenValue == char('S'))): // 1831 - match('S') - elif ((_givenValue == char('d'))): // 1831 - match('d') - elif ((_givenValue == char('D'))): // 1831 - match('D') - elif ((_givenValue == char('p'))): // 1831 - match('p') - elif ((_givenValue == char('P'))): // 1831 - match('P') - elif ((_givenValue == char('A'))): // 1831 - match('A') - elif ((_givenValue == char('z'))): // 1831 - match('z') - elif ((_givenValue == char('Z'))): // 1831 - match('Z') - elif ((_givenValue == char('g'))): // 1831 - match('g') - elif ((_givenValue == char('B'))): // 1831 - match('B') - elif ((_givenValue == char('k'))): // 1831 - match('k') - elif ((_givenValue == char('/'))): // 1831 - match('/') - elif ((_givenValue == char('('))): // 1831 - match('(') - elif ((_givenValue == char(')'))): // 1831 - match(')') - elif ((_givenValue == char('|'))): // 1831 - match('|') - elif ((_givenValue == char('.'))): // 1831 - match('.') - elif ((_givenValue == char('*'))): // 1831 - match('*') - elif ((_givenValue == char('?'))): // 1831 - match('?') - elif ((_givenValue == char('$'))): // 1831 - match('$') - elif ((_givenValue == char('^'))): // 1831 - match('^') - elif ((_givenValue == char('['))): // 1831 - match('[') - elif ((_givenValue == char(']'))): // 1831 - match(']') - else: // line 1969 - raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - if (_createToken and (_token is null) and (_ttype != Token.SKIP)): - _token = makeToken(_ttype) - _token.setText(text.ToString(_begin, text.Length-_begin)) - returnToken_ = _token - - - private static def mk_tokenSet_0_() as (long): - data = array(long, 1025) - data[0]=287948901175001088L - data[1]=541165879422L - i = 2 - while i<=1024: - data[i] = 0L - ++i - return data - public static final tokenSet_0_ = BitSet(mk_tokenSet_0_()) - private static def mk_tokenSet_1_() as (long): - data = array(long, 2048) - data[0]=-9224L - i = 1 - while i<=1022: - data[i] = -1L - ++i - data[1023]=9223372036854775807L - i = 1024 - while i<=2047: - data[i] = 0L - ++i - return data - public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) - private static def mk_tokenSet_2_() as (long): - data = array(long, 2048) - data[0]=-4398046520328L - i = 1 - while i<=1022: - data[i] = -1L - ++i - data[1023]=9223372036854775807L - i = 1024 - while i<=2047: - data[i] = 0L - ++i - return data - public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) - private static def mk_tokenSet_3_() as (long): - data = array(long, 2048) - data[0]=-17179878408L - data[1]=-268435457L - i = 2 - while i<=1022: - data[i] = -1L - ++i - data[1023]=9223372036854775807L - i = 1024 - while i<=2047: - data[i] = 0L - ++i - return data - public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) - private static def mk_tokenSet_4_() as (long): - data = array(long, 2048) - data[0]=-549755823112L - data[1]=-268435457L - i = 2 - while i<=1022: - data[i] = -1L - ++i - data[1023]=9223372036854775807L - i = 1024 - while i<=2047: - data[i] = 0L - ++i - return data - public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) - private static def mk_tokenSet_5_() as (long): - data = array(long, 2048) - data[0]=-140741783332360L - i = 1 - while i<=1022: - data[i] = -1L - ++i - data[1023]=9223372036854775807L - i = 1024 - while i<=2047: - data[i] = 0L - ++i - return data - public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) - private static def mk_tokenSet_6_() as (long): - data = array(long, 2048) - data[0]=-140741783332360L - data[1]=-268435457L - i = 2 - while i<=1022: - data[i] = -1L - ++i - data[1023]=9223372036854775807L - i = 1024 - while i<=2047: - data[i] = 0L - ++i - return data - public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) - private static def mk_tokenSet_7_() as (long): - data = array(long, 2048) - data[0]=-4294977032L - i = 1 - while i<=1022: - data[i] = -1L - ++i - data[1023]=9223372036854775807L - i = 1024 - while i<=2047: - data[i] = 0L - ++i - return data - public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) - + def constructor(ins as Stream): + self(ByteBuffer(ins)) + + def constructor(r as TextReader): + self(CharBuffer(r)) + + def constructor(ib as InputBuffer): + self(LexerSharedInputState(ib)) + + def constructor(state as LexerSharedInputState): + super(state) + initialize() + + private def initialize(): + caseSensitiveLiterals = true + setCaseSensitive(true) + literals = Hashtable(100, 0.4, null, Comparer.Default) + literals.Add(",", 65) + literals.Add("public", 29) + literals.Add("a string", 58) + literals.Add("an identifier", 57) + literals.Add("]", 67) + literals.Add("case", 48) + literals.Add("break", 5) + literals.Add("while", 45) + literals.Add("new", 26) + literals.Add("||", 73) + literals.Add("+", 79) + literals.Add("instanceof", 25) + literals.Add("implements", 22) + literals.Add("*", 82) + literals.Add("|=", 69) + literals.Add("typeof", 42) + literals.Add("@assembly", 99) + literals.Add("[", 66) + literals.Add(">>=", 96) + literals.Add("return", 28) + literals.Add("throw", 39) + literals.Add("var", 43) + literals.Add(")", 62) + literals.Add("==", 83) + literals.Add("null", 27) + literals.Add("protected", 30) + literals.Add("pragma off", 56) + literals.Add("@script", 98) + literals.Add("class", 8) + literals.Add("(", 61) + literals.Add("do", 10) + literals.Add("~", 86) + literals.Add("function", 18) + literals.Add("/=", 50) + literals.Add("super", 37) + literals.Add("@", 97) + literals.Add("-=", 52) + literals.Add("set", 35) + literals.Add("+=", 51) + literals.Add("!==", 88) + literals.Add("}", 60) + literals.Add("interface", 24) + literals.Add("?", 85) + literals.Add("&", 70) + literals.Add("internal", 31) + literals.Add("final", 15) + literals.Add("yield", 46) + literals.Add("!=", 84) + literals.Add("//", 54) + literals.Add("===", 87) + literals.Add("if", 20) + literals.Add("|", 68) + literals.Add("override", 32) + literals.Add(">", 93) + literals.Add("as", 4) + literals.Add("%", 81) + literals.Add("catch", 7) + literals.Add("try", 41) + literals.Add("{", 59) + literals.Add("=", 76) + literals.Add("enum", 12) + literals.Add("for", 17) + literals.Add(">>", 95) + literals.Add("extends", 13) + literals.Add("private", 34) + literals.Add("default", 49) + literals.Add("--", 78) + literals.Add("<", 89) + literals.Add("false", 14) + literals.Add("this", 38) + literals.Add("static", 36) + literals.Add(">=", 94) + literals.Add("<=", 90) + literals.Add("partial", 33) + literals.Add(";", 75) + literals.Add("get", 19) + literals.Add("<<=", 92) + literals.Add("continue", 9) + literals.Add("&&", 74) + literals.Add("cast", 6) + literals.Add("<<", 91) + literals.Add("pragma on", 55) + literals.Add(".", 63) + literals.Add("finally", 16) + literals.Add("else", 11) + literals.Add("import", 21) + literals.Add("++", 77) + literals.Add(":", 64) + literals.Add("in", 23) + literals.Add("switch", 47) + literals.Add("true", 40) + literals.Add("-", 80) + literals.Add("*=", 53) + literals.Add("virtual", 44) + literals.Add("^", 71) + literals.Add("&=", 72) + + override def nextToken() as IToken: + theRetToken as IToken + :tryAgain + while true: + _token as IToken = null + _ttype = Token.INVALID_TYPE + resetText() + try: // for char stream error handling + try: // for lexical error handling + _givenValue = cached_LA1 + if ((_givenValue == char('A')) + or (_givenValue ==char('B')) + or (_givenValue ==char('C')) + or (_givenValue ==char('D')) + or (_givenValue ==char('E')) + or (_givenValue ==char('F')) + or (_givenValue ==char('G')) + or (_givenValue ==char('H')) + or (_givenValue ==char('I')) + or (_givenValue ==char('J')) + or (_givenValue ==char('K')) + or (_givenValue ==char('L')) + or (_givenValue ==char('M')) + or (_givenValue ==char('N')) + or (_givenValue ==char('O')) + or (_givenValue ==char('P')) + or (_givenValue ==char('Q')) + or (_givenValue ==char('R')) + or (_givenValue ==char('S')) + or (_givenValue ==char('T')) + or (_givenValue ==char('U')) + or (_givenValue ==char('V')) + or (_givenValue ==char('W')) + or (_givenValue ==char('X')) + or (_givenValue ==char('Y')) + or (_givenValue ==char('Z')) + or (_givenValue ==char('_')) + or (_givenValue ==char('a')) + or (_givenValue ==char('b')) + or (_givenValue ==char('c')) + or (_givenValue ==char('d')) + or (_givenValue ==char('e')) + or (_givenValue ==char('f')) + or (_givenValue ==char('g')) + or (_givenValue ==char('h')) + or (_givenValue ==char('i')) + or (_givenValue ==char('j')) + or (_givenValue ==char('k')) + or (_givenValue ==char('l')) + or (_givenValue ==char('m')) + or (_givenValue ==char('n')) + or (_givenValue ==char('o')) + or (_givenValue ==char('p')) + or (_givenValue ==char('q')) + or (_givenValue ==char('r')) + or (_givenValue ==char('s')) + or (_givenValue ==char('t')) + or (_givenValue ==char('u')) + or (_givenValue ==char('v')) + or (_givenValue ==char('w')) + or (_givenValue ==char('x')) + or (_givenValue ==char('y')) + or (_givenValue ==char('z')) + ): // 1827 + mID(true) + theRetToken = returnToken_ + elif ((_givenValue == char('0')) + or (_givenValue ==char('1')) + or (_givenValue ==char('2')) + or (_givenValue ==char('3')) + or (_givenValue ==char('4')) + or (_givenValue ==char('5')) + or (_givenValue ==char('6')) + or (_givenValue ==char('7')) + or (_givenValue ==char('8')) + or (_givenValue ==char('9')) + ): // 1827 + mINT(true) + theRetToken = returnToken_ + elif ((_givenValue == char('.'))): // 1831 + mDOT(true) + theRetToken = returnToken_ + elif ((_givenValue == char(':'))): // 1831 + mCOLON(true) + theRetToken = returnToken_ + elif ((_givenValue == char(','))): // 1831 + mCOMMA(true) + theRetToken = returnToken_ + elif ((_givenValue == char('('))): // 1831 + mLPAREN(true) + theRetToken = returnToken_ + elif ((_givenValue == char(')'))): // 1831 + mRPAREN(true) + theRetToken = returnToken_ + elif ((_givenValue == char('['))): // 1831 + mLBRACK(true) + theRetToken = returnToken_ + elif ((_givenValue == char(']'))): // 1831 + mRBRACK(true) + theRetToken = returnToken_ + elif ((_givenValue == char('{'))): // 1831 + mLBRACE(true) + theRetToken = returnToken_ + elif ((_givenValue == char('}'))): // 1831 + mRBRACE(true) + theRetToken = returnToken_ + elif ((_givenValue == char(';'))): // 1831 + mEOS(true) + theRetToken = returnToken_ + elif ((_givenValue == char('#'))): // 1831 + mPRAGMA_ON(true) + theRetToken = returnToken_ + elif ((_givenValue == char('%'))): // 1831 + mMODULUS(true) + theRetToken = returnToken_ + elif ((_givenValue == char('?'))): // 1831 + mQUESTION_MARK(true) + theRetToken = returnToken_ + elif ((_givenValue == char('~'))): // 1831 + mBITWISE_NOT(true) + theRetToken = returnToken_ + elif ((_givenValue == char('@'))): // 1831 + mAT(true) + theRetToken = returnToken_ + elif ((_givenValue == char('/'))): // 1831 + mDIVISION(true) + theRetToken = returnToken_ + elif ((_givenValue == char('\t')) + or (_givenValue ==char('\n')) + or (_givenValue ==char('\u000c')) + or (_givenValue ==char('\r')) + or (_givenValue ==char(' ')) + ): // 1827 + mWHITE_SPACE(true) + theRetToken = returnToken_ + elif ((_givenValue == char('"'))): // 1831 + mDOUBLE_QUOTED_STRING(true) + theRetToken = returnToken_ + elif ((_givenValue == char('\''))): // 1831 + mSINGLE_QUOTED_STRING(true) + theRetToken = returnToken_ + else: // line 1969 + if ((cached_LA1==char('=')) and (cached_LA2==char('=')) and (LA(3)==char('='))): + mREFERENCE_EQUALITY(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('!')) and (cached_LA2==char('=')) and (LA(3)==char('='))): // line 2102 + mREFERENCE_INEQUALITY(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('<')) and (cached_LA2==char('<')) and (LA(3)==char('='))): // line 2102 + mINPLACE_SHIFT_LEFT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('>')) and (cached_LA2==char('>')) and (LA(3)==char('='))): // line 2102 + mINPLACE_SHIFT_RIGHT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('|')) and (cached_LA2==char('='))): // line 2102 + mINPLACE_BITWISE_OR(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('&')) and (cached_LA2==char('='))): // line 2102 + mINPLACE_BITWISE_AND(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('^')) and (cached_LA2==char('='))): // line 2102 + mINPLACE_BITWISE_XOR(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('|')) and (cached_LA2==char('|'))): // line 2102 + mLOGICAL_OR(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('&')) and (cached_LA2==char('&'))): // line 2102 + mLOGICAL_AND(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('+')) and (cached_LA2==char('+'))): // line 2102 + mINCREMENT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('-')) and (cached_LA2==char('-'))): // line 2102 + mDECREMENT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('+')) and (cached_LA2==char('='))): // line 2102 + mINPLACE_ADD(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('-')) and (cached_LA2==char('='))): // line 2102 + mINPLACE_SUBTRACT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('*')) and (cached_LA2==char('='))): // line 2102 + mINPLACE_MULTIPLY(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('=')) and (cached_LA2==char('=')) and (true)): // line 2102 + mEQUALITY(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('!')) and (cached_LA2==char('=')) and (true)): // line 2102 + mINEQUALITY(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('<')) and (cached_LA2==char('='))): // line 2102 + mLESS_THAN_OR_EQUAL(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('<')) and (cached_LA2==char('<')) and (true)): // line 2102 + mSHIFT_LEFT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('>')) and (cached_LA2==char('='))): // line 2102 + mGREATER_THAN_OR_EQUAL(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('>')) and (cached_LA2==char('>')) and (true)): // line 2102 + mSHIFT_RIGHT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('|')) and (true)): // line 2102 + mBITWISE_OR(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('&')) and (true)): // line 2102 + mBITWISE_AND(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('^')) and (true)): // line 2102 + mBITWISE_XOR(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('=')) and (true)): // line 2102 + mASSIGN(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('+')) and (true)): // line 2102 + mADD(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('-')) and (true)): // line 2102 + mSUBTRACT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('*')) and (true)): // line 2102 + mMULTIPLY(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('!')) and (true)): // line 2102 + mNOT(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('<')) and (true)): // line 2102 + mLESS_THAN(true) + theRetToken = returnToken_ + elif ((cached_LA1==char('>')) and (true)): // line 2102 + mGREATER_THAN(true) + theRetToken = returnToken_ + else: + if cached_LA1 == EOF_CHAR: + uponEOF(); returnToken_ = makeToken(Token.EOF_TYPE) + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + goto tryAgain if returnToken_ is null // found SKIP token + _ttype = returnToken_.Type + returnToken_.Type = _ttype + return returnToken_ + except e as RecognitionException: + raise TokenStreamRecognitionException(e) + except cse as CharStreamException: + if cse isa CharStreamIOException: + raise TokenStreamIOException(cast(CharStreamIOException, cse).io) + else: + raise TokenStreamException(cse.Message) + + public def mID(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = ID + + mID_LETTER(false) + while true: + _givenValue = cached_LA1 + if ((_givenValue == char('A')) + or (_givenValue ==char('B')) + or (_givenValue ==char('C')) + or (_givenValue ==char('D')) + or (_givenValue ==char('E')) + or (_givenValue ==char('F')) + or (_givenValue ==char('G')) + or (_givenValue ==char('H')) + or (_givenValue ==char('I')) + or (_givenValue ==char('J')) + or (_givenValue ==char('K')) + or (_givenValue ==char('L')) + or (_givenValue ==char('M')) + or (_givenValue ==char('N')) + or (_givenValue ==char('O')) + or (_givenValue ==char('P')) + or (_givenValue ==char('Q')) + or (_givenValue ==char('R')) + or (_givenValue ==char('S')) + or (_givenValue ==char('T')) + or (_givenValue ==char('U')) + or (_givenValue ==char('V')) + or (_givenValue ==char('W')) + or (_givenValue ==char('X')) + or (_givenValue ==char('Y')) + or (_givenValue ==char('Z')) + or (_givenValue ==char('_')) + or (_givenValue ==char('a')) + or (_givenValue ==char('b')) + or (_givenValue ==char('c')) + or (_givenValue ==char('d')) + or (_givenValue ==char('e')) + or (_givenValue ==char('f')) + or (_givenValue ==char('g')) + or (_givenValue ==char('h')) + or (_givenValue ==char('i')) + or (_givenValue ==char('j')) + or (_givenValue ==char('k')) + or (_givenValue ==char('l')) + or (_givenValue ==char('m')) + or (_givenValue ==char('n')) + or (_givenValue ==char('o')) + or (_givenValue ==char('p')) + or (_givenValue ==char('q')) + or (_givenValue ==char('r')) + or (_givenValue ==char('s')) + or (_givenValue ==char('t')) + or (_givenValue ==char('u')) + or (_givenValue ==char('v')) + or (_givenValue ==char('w')) + or (_givenValue ==char('x')) + or (_givenValue ==char('y')) + or (_givenValue ==char('z')) + ): // 1827 + mID_LETTER(false) + elif ((_givenValue == char('0')) + or (_givenValue ==char('1')) + or (_givenValue ==char('2')) + or (_givenValue ==char('3')) + or (_givenValue ==char('4')) + or (_givenValue ==char('5')) + or (_givenValue ==char('6')) + or (_givenValue ==char('7')) + or (_givenValue ==char('8')) + or (_givenValue ==char('9')) + ): // 1827 + mDIGIT(false) + else: // line 1969 + goto _loop327_breakloop + :_loop327_breakloop + _ttype = testLiteralsTable(_ttype) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mID_LETTER(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = ID_LETTER + + _givenValue = cached_LA1 + if ((_givenValue == char('_'))): // 1831 + match('_') + elif ((_givenValue == char('a')) + or (_givenValue ==char('b')) + or (_givenValue ==char('c')) + or (_givenValue ==char('d')) + or (_givenValue ==char('e')) + or (_givenValue ==char('f')) + or (_givenValue ==char('g')) + or (_givenValue ==char('h')) + or (_givenValue ==char('i')) + or (_givenValue ==char('j')) + or (_givenValue ==char('k')) + or (_givenValue ==char('l')) + or (_givenValue ==char('m')) + or (_givenValue ==char('n')) + or (_givenValue ==char('o')) + or (_givenValue ==char('p')) + or (_givenValue ==char('q')) + or (_givenValue ==char('r')) + or (_givenValue ==char('s')) + or (_givenValue ==char('t')) + or (_givenValue ==char('u')) + or (_givenValue ==char('v')) + or (_givenValue ==char('w')) + or (_givenValue ==char('x')) + or (_givenValue ==char('y')) + or (_givenValue ==char('z')) + ): // 1827 + matchRange(char('a'),char('z')) + elif ((_givenValue == char('A')) + or (_givenValue ==char('B')) + or (_givenValue ==char('C')) + or (_givenValue ==char('D')) + or (_givenValue ==char('E')) + or (_givenValue ==char('F')) + or (_givenValue ==char('G')) + or (_givenValue ==char('H')) + or (_givenValue ==char('I')) + or (_givenValue ==char('J')) + or (_givenValue ==char('K')) + or (_givenValue ==char('L')) + or (_givenValue ==char('M')) + or (_givenValue ==char('N')) + or (_givenValue ==char('O')) + or (_givenValue ==char('P')) + or (_givenValue ==char('Q')) + or (_givenValue ==char('R')) + or (_givenValue ==char('S')) + or (_givenValue ==char('T')) + or (_givenValue ==char('U')) + or (_givenValue ==char('V')) + or (_givenValue ==char('W')) + or (_givenValue ==char('X')) + or (_givenValue ==char('Y')) + or (_givenValue ==char('Z')) + ): // 1827 + matchRange(char('A'),char('Z')) + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mDIGIT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = DIGIT + + matchRange(char('0'),char('9')) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INT + + if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): + match("0x") + _cnt331 as int = 0 + while true: + if ((tokenSet_0_.member(cast(int, cached_LA1)))): + mHEXDIGIT(false) + else: + if (_cnt331 >= 1): + goto _loop331_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt331 + :_loop331_breakloop + if ((cached_LA1==char('L') or cached_LA1==char('l'))): + _givenValue = cached_LA1 + if ((_givenValue == char('l'))): // 1831 + match('l') + elif ((_givenValue == char('L'))): // 1831 + match('L') + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if 0 == inputState.guessing: + _ttype = LONG; + else: // line 2053 + pass // 947 + elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 + _cnt335 as int = 0 + while true: + if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): + mDIGIT(false) + else: + if (_cnt335 >= 1): + goto _loop335_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt335 + :_loop335_breakloop + _givenValue = cached_LA1 + if ((_givenValue == char('L')) + or (_givenValue ==char('l')) + ): // 1827 + _givenValue = cached_LA1 + if ((_givenValue == char('l'))): // 1831 + match('l') + elif ((_givenValue == char('L'))): // 1831 + match('L') + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if 0 == inputState.guessing: + _ttype = LONG; + elif ((_givenValue == char('D')) + or (_givenValue ==char('F')) + or (_givenValue ==char('d')) + or (_givenValue ==char('f')) + ): // 1827 + _givenValue = cached_LA1 + if ((_givenValue == char('f'))): // 1831 + match('f') + elif ((_givenValue == char('F'))): // 1831 + match('F') + elif ((_givenValue == char('d'))): // 1831 + match('d') + elif ((_givenValue == char('D'))): // 1831 + match('D') + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if 0 == inputState.guessing: + _ttype = DOUBLE; + elif ((_givenValue == char('.'))): // 1831 + match('.') + mDOUBLE_SUFFIX(false) + if 0 == inputState.guessing: + _ttype = DOUBLE; + elif ((_givenValue == char('E')) + or (_givenValue ==char('e')) + ): // 1827 + mEXPONENT(false) + if 0 == inputState.guessing: + _ttype = DOUBLE; + else: // line 1969 + pass // 947 + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mHEXDIGIT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = HEXDIGIT + + _givenValue = cached_LA1 + if ((_givenValue == char('a')) + or (_givenValue ==char('b')) + or (_givenValue ==char('c')) + or (_givenValue ==char('d')) + or (_givenValue ==char('e')) + or (_givenValue ==char('f')) + ): // 1827 + matchRange(char('a'),char('f')) + elif ((_givenValue == char('A')) + or (_givenValue ==char('B')) + or (_givenValue ==char('C')) + or (_givenValue ==char('D')) + or (_givenValue ==char('E')) + or (_givenValue ==char('F')) + ): // 1827 + matchRange(char('A'),char('F')) + elif ((_givenValue == char('0')) + or (_givenValue ==char('1')) + or (_givenValue ==char('2')) + or (_givenValue ==char('3')) + or (_givenValue ==char('4')) + or (_givenValue ==char('5')) + or (_givenValue ==char('6')) + or (_givenValue ==char('7')) + or (_givenValue ==char('8')) + or (_givenValue ==char('9')) + ): // 1827 + matchRange(char('0'),char('9')) + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mDOUBLE_SUFFIX(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = DOUBLE_SUFFIX + + _cnt344 as int = 0 + while true: + if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): + mDIGIT(false) + else: + if (_cnt344 >= 1): + goto _loop344_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt344 + :_loop344_breakloop + if ((cached_LA1==char('E') or cached_LA1==char('e'))): + mEXPONENT(false) + else: // line 2053 + pass // 947 + _givenValue = cached_LA1 + if ((_givenValue == char('f'))): // 1831 + match('f') + elif ((_givenValue == char('F'))): // 1831 + match('F') + elif ((_givenValue == char('d'))): // 1831 + match('d') + elif ((_givenValue == char('D'))): // 1831 + match('D') + else: // line 1969 + pass // 947 + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mEXPONENT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = EXPONENT + + _givenValue = cached_LA1 + if ((_givenValue == char('e'))): // 1831 + match('e') + elif ((_givenValue == char('E'))): // 1831 + match('E') + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + _givenValue = cached_LA1 + if ((_givenValue == char('+'))): // 1831 + match('+') + elif ((_givenValue == char('-'))): // 1831 + match('-') + elif ((_givenValue == char('0')) + or (_givenValue ==char('1')) + or (_givenValue ==char('2')) + or (_givenValue ==char('3')) + or (_givenValue ==char('4')) + or (_givenValue ==char('5')) + or (_givenValue ==char('6')) + or (_givenValue ==char('7')) + or (_givenValue ==char('8')) + or (_givenValue ==char('9')) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + _cnt351 as int = 0 + while true: + if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): + mDIGIT(false) + else: + if (_cnt351 >= 1): + goto _loop351_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt351 + :_loop351_breakloop + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mDOT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = DOT + + match('.') + if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): + mDOUBLE_SUFFIX(false) + if 0 == inputState.guessing: + _ttype = DOUBLE; + else: // line 2053 + pass // 947 + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mCOLON(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = COLON + + match(':') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mCOMMA(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = COMMA + + match(',') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mLPAREN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = LPAREN + + match('(') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mRPAREN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = RPAREN + + match(')') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mLBRACK(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = LBRACK + + match('[') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mRBRACK(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = RBRACK + + match(']') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mLBRACE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = LBRACE + + match('{') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mRBRACE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = RBRACE + + match('}') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mBITWISE_OR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = BITWISE_OR + + match('|') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINPLACE_BITWISE_OR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INPLACE_BITWISE_OR + + match("|=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mBITWISE_AND(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = BITWISE_AND + + match('&') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINPLACE_BITWISE_AND(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INPLACE_BITWISE_AND + + match("&=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mBITWISE_XOR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = BITWISE_XOR + + match('^') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINPLACE_BITWISE_XOR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INPLACE_BITWISE_XOR + + match("^=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mLOGICAL_OR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = LOGICAL_OR + + match("||") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mLOGICAL_AND(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = LOGICAL_AND + + match("&&") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mEOS(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = EOS + + match(';') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mASSIGN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = ASSIGN + + match('=') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINCREMENT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INCREMENT + + match("++") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mDECREMENT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = DECREMENT + + match("--") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mADD(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = ADD + + match('+') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mPRAGMA_ON(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = PRAGMA_ON + id as IToken + + _saveIndex = text.Length + match("#pragma") + text.Length = _saveIndex + _cnt375 as int = 0 + while true: + if ((cached_LA1==char('\t') or cached_LA1==char(' '))): + mPRAGMA_WHITE_SPACE(false) + else: + if (_cnt375 >= 1): + goto _loop375_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt375 + :_loop375_breakloop + mID(true) + id = returnToken_ + if ((cached_LA1==char('\t') or cached_LA1==char(' ')) and (cached_LA2==char('\t') or cached_LA2==char(' ') or cached_LA2==char('o')) and (LA(3)==char('\t') or LA(3)==char(' ') or LA(3)==char('f') or LA(3)==char('n') or LA(3)==char('o'))): + _cnt378 as int = 0 + while true: + if ((cached_LA1==char('\t') or cached_LA1==char(' '))): + mPRAGMA_WHITE_SPACE(false) + else: + if (_cnt378 >= 1): + goto _loop378_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt378 + :_loop378_breakloop + if ((cached_LA1==char('o')) and (cached_LA2==char('f'))): + _saveIndex = text.Length + match("off") + text.Length = _saveIndex + if 0 == inputState.guessing: + _ttype = PRAGMA_OFF; + elif ((cached_LA1==char('o')) and (cached_LA2==char('n'))): // line 2102 + _saveIndex = text.Length + match("on") + text.Length = _saveIndex + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + elif ((cached_LA1==char('\t') or cached_LA1==char('\n') or cached_LA1==char('\r') or cached_LA1==char(' ')) and (true) and (true)): // line 2102 + pass // 947 + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + while true: + if ((cached_LA1==char('\t') or cached_LA1==char(' '))): + mPRAGMA_WHITE_SPACE(false) + else: + goto _loop381_breakloop + :_loop381_breakloop + _saveIndex = text.Length + mNEWLINE(false) + text.Length = _saveIndex + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mPRAGMA_WHITE_SPACE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = PRAGMA_WHITE_SPACE + + _givenValue = cached_LA1 + if ((_givenValue == char(' '))): // 1831 + _saveIndex = text.Length + match(' ') + text.Length = _saveIndex + elif ((_givenValue == char('\t'))): // 1831 + _saveIndex = text.Length + match('\t') + text.Length = _saveIndex + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mNEWLINE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = NEWLINE + + _givenValue = cached_LA1 + if ((_givenValue == char('\n'))): // 1831 + match('\n') + elif ((_givenValue == char('\r'))): // 1831 + match('\r') + if ((cached_LA1==char('\n')) and (true) and (true)): + match('\n') + else: // line 2053 + pass // 947 + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if 0 == inputState.guessing: + newline(); + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINPLACE_ADD(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INPLACE_ADD + + match("+=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mSUBTRACT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = SUBTRACT + + match('-') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINPLACE_SUBTRACT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INPLACE_SUBTRACT + + match("-=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mMODULUS(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = MODULUS + + match('%') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mMULTIPLY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = MULTIPLY + + match('*') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINPLACE_MULTIPLY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INPLACE_MULTIPLY + + match("*=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mEQUALITY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = EQUALITY + + match("==") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINEQUALITY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INEQUALITY + + match("!=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mNOT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = NOT + + match('!') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mQUESTION_MARK(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = QUESTION_MARK + + match('?') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mBITWISE_NOT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = BITWISE_NOT + + match('~') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mREFERENCE_EQUALITY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = REFERENCE_EQUALITY + + match("===") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mREFERENCE_INEQUALITY(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = REFERENCE_INEQUALITY + + match("!==") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mLESS_THAN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = LESS_THAN + + match('<') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mLESS_THAN_OR_EQUAL(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = LESS_THAN_OR_EQUAL + + match("<=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mSHIFT_LEFT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = SHIFT_LEFT + + match("<<") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINPLACE_SHIFT_LEFT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INPLACE_SHIFT_LEFT + + match("<<=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mGREATER_THAN(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = GREATER_THAN + + match('>') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mGREATER_THAN_OR_EQUAL(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = GREATER_THAN_OR_EQUAL + + match(">=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mSHIFT_RIGHT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = SHIFT_RIGHT + + match(">>") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mINPLACE_SHIFT_RIGHT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = INPLACE_SHIFT_RIGHT + + match(">>=") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mAT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = AT + + match('@') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mDIVISION(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = DIVISION + + synPredMatched408 as bool = false + if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): + _m408 as int = mark() + synPredMatched408 = true + ++inputState.guessing + try: + match("/*") + except x as RecognitionException: + synPredMatched408 = false + rewind(_m408) + --inputState.guessing + if synPredMatched408: + mML_COMMENT(false) + if 0 == inputState.guessing: + if not PreserveComments: + _ttype = Token.SKIP + elif ((cached_LA1==char('/')) and (true)): // line 2102 + match('/') + _givenValue = cached_LA1 + if ((_givenValue == char('/'))): // 1831 + match('/') + while true: + if ((tokenSet_1_.member(cast(int, cached_LA1)))): + match(tokenSet_1_) + else: + goto _loop413_breakloop + :_loop413_breakloop + if 0 == inputState.guessing: + if PreserveComments: + _ttype = SL_COMMENT + else: + _ttype = Token.SKIP; + elif ((_givenValue == char('='))): // 1831 + match('=') + if 0 == inputState.guessing: + _ttype = INPLACE_DIVISION; + else: // line 1969 + pass // 947 + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mML_COMMENT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = ML_COMMENT + + match("/*") + while true: + if (((cached_LA1==char('*')) and (((cached_LA2 >= char('\u0003')) and (cached_LA2 <= char('\ufffe')))) and (((LA(3) >= char('\u0003')) and (LA(3) <= char('\ufffe'))))) and ( LA(2) != char('/') )): + match('*') + elif ((cached_LA1==char('\n') or cached_LA1==char('\r'))): // line 2102 + mNEWLINE(false) + elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 + match(tokenSet_2_) + else: + goto _loop442_breakloop + :_loop442_breakloop + match("*/") + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mWHITE_SPACE(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = WHITE_SPACE + + _cnt417 as int = 0 + while true: + _givenValue = cached_LA1 + if ((_givenValue == char(' '))): // 1831 + match(' ') + elif ((_givenValue == char('\t'))): // 1831 + match('\t') + elif ((_givenValue == char('\u000c'))): // 1831 + match('\f') + elif ((_givenValue == char('\n')) + or (_givenValue ==char('\r')) + ): // 1827 + mNEWLINE(false) + else: // line 1969 + if (_cnt417 >= 1): + goto _loop417_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt417 + :_loop417_breakloop + if 0 == inputState.guessing: + _ttype = Token.SKIP; + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mDOUBLE_QUOTED_STRING(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = DOUBLE_QUOTED_STRING + + _saveIndex = text.Length + match('"') + text.Length = _saveIndex + while true: + if ((cached_LA1==char('\\'))): + mDQS_ESC(false) + elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 + match(tokenSet_3_) + else: + goto _loop421_breakloop + :_loop421_breakloop + _saveIndex = text.Length + match('"') + text.Length = _saveIndex + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mDQS_ESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = DQS_ESC + + _saveIndex = text.Length + match('\\') + text.Length = _saveIndex + _givenValue = cached_LA1 + if ((_givenValue == char('0')) + or (_givenValue ==char('\\')) + or (_givenValue ==char('a')) + or (_givenValue ==char('b')) + or (_givenValue ==char('f')) + or (_givenValue ==char('n')) + or (_givenValue ==char('r')) + or (_givenValue ==char('t')) + ): // 1827 + mSESC(false) + elif ((_givenValue == char('"'))): // 1831 + match('"') + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + public def mSINGLE_QUOTED_STRING(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = SINGLE_QUOTED_STRING + + _saveIndex = text.Length + match('\'') + text.Length = _saveIndex + while true: + if ((cached_LA1==char('\\'))): + mSQS_ESC(false) + elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 + match(tokenSet_4_) + else: + goto _loop425_breakloop + :_loop425_breakloop + _saveIndex = text.Length + match('\'') + text.Length = _saveIndex + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mSQS_ESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = SQS_ESC + + _saveIndex = text.Length + match('\\') + text.Length = _saveIndex + _givenValue = cached_LA1 + if ((_givenValue == char('0')) + or (_givenValue ==char('\\')) + or (_givenValue ==char('a')) + or (_givenValue ==char('b')) + or (_givenValue ==char('f')) + or (_givenValue ==char('n')) + or (_givenValue ==char('r')) + or (_givenValue ==char('t')) + ): // 1827 + mSESC(false) + elif ((_givenValue == char('\''))): // 1831 + match('\'') + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mSESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = SESC + + _givenValue = cached_LA1 + if ((_givenValue == char('r'))): // 1831 + _saveIndex = text.Length + match('r') + text.Length = _saveIndex + if 0 == inputState.guessing: + text.Length = _begin; text.Append("\r"); + elif ((_givenValue == char('n'))): // 1831 + _saveIndex = text.Length + match('n') + text.Length = _saveIndex + if 0 == inputState.guessing: + text.Length = _begin; text.Append("\n"); + elif ((_givenValue == char('t'))): // 1831 + _saveIndex = text.Length + match('t') + text.Length = _saveIndex + if 0 == inputState.guessing: + text.Length = _begin; text.Append("\t"); + elif ((_givenValue == char('a'))): // 1831 + _saveIndex = text.Length + match('a') + text.Length = _saveIndex + if 0 == inputState.guessing: + text.Length = _begin; text.Append("\a"); + elif ((_givenValue == char('b'))): // 1831 + _saveIndex = text.Length + match('b') + text.Length = _saveIndex + if 0 == inputState.guessing: + text.Length = _begin; text.Append("\b"); + elif ((_givenValue == char('f'))): // 1831 + _saveIndex = text.Length + match('f') + text.Length = _saveIndex + if 0 == inputState.guessing: + text.Length = _begin; text.Append("\f"); + elif ((_givenValue == char('0'))): // 1831 + _saveIndex = text.Length + match('0') + text.Length = _saveIndex + if 0 == inputState.guessing: + text.Length = _begin; text.Append("\0"); + elif ((_givenValue == char('\\'))): // 1831 + _saveIndex = text.Length + match('\\') + text.Length = _saveIndex + if 0 == inputState.guessing: + text.Length = _begin; text.Append("\\"); + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mRE_LITERAL(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = RE_LITERAL + + match('/') + _cnt445 as int = 0 + while true: + if ((tokenSet_5_.member(cast(int, cached_LA1)))): + mRE_CHAR(false) + else: + if (_cnt445 >= 1): + goto _loop445_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt445 + :_loop445_breakloop + match('/') + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mRE_CHAR(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = RE_CHAR + + if ((cached_LA1==char('\\'))): + mRE_ESC(false) + elif ((tokenSet_6_.member(cast(int, cached_LA1)))): // line 2102 + match(tokenSet_6_) + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + protected def mRE_ESC(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + _ttype as int; _token as IToken; _begin = text.Length; + _ttype = RE_ESC + + match('\\') + _givenValue = cached_LA1 + if ((_givenValue == char('a'))): // 1831 + match('a') + elif ((_givenValue == char('b'))): // 1831 + match('b') + elif ((_givenValue == char('c'))): // 1831 + match('c') + matchRange(char('A'),char('Z')) + elif ((_givenValue == char('t'))): // 1831 + match('t') + elif ((_givenValue == char('r'))): // 1831 + match('r') + elif ((_givenValue == char('v'))): // 1831 + match('v') + elif ((_givenValue == char('f'))): // 1831 + match('f') + elif ((_givenValue == char('n'))): // 1831 + match('n') + elif ((_givenValue == char('e'))): // 1831 + match('e') + elif ((_givenValue == char('0')) + or (_givenValue ==char('1')) + or (_givenValue ==char('2')) + or (_givenValue ==char('3')) + or (_givenValue ==char('4')) + or (_givenValue ==char('5')) + or (_givenValue ==char('6')) + or (_givenValue ==char('7')) + or (_givenValue ==char('8')) + or (_givenValue ==char('9')) + ): // 1827 + _cnt451 as int = 0 + while true: + if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): + mDIGIT(false) + else: + if (_cnt451 >= 1): + goto _loop451_breakloop + else: + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + ++_cnt451 + :_loop451_breakloop + elif ((_givenValue == char('x'))): // 1831 + match('x') + mDIGIT(false) + mDIGIT(false) + elif ((_givenValue == char('u'))): // 1831 + match('u') + mDIGIT(false) + mDIGIT(false) + mDIGIT(false) + mDIGIT(false) + elif ((_givenValue == char('\\'))): // 1831 + match('\\') + elif ((_givenValue == char('w'))): // 1831 + match('w') + elif ((_givenValue == char('W'))): // 1831 + match('W') + elif ((_givenValue == char('s'))): // 1831 + match('s') + elif ((_givenValue == char('S'))): // 1831 + match('S') + elif ((_givenValue == char('d'))): // 1831 + match('d') + elif ((_givenValue == char('D'))): // 1831 + match('D') + elif ((_givenValue == char('p'))): // 1831 + match('p') + elif ((_givenValue == char('P'))): // 1831 + match('P') + elif ((_givenValue == char('A'))): // 1831 + match('A') + elif ((_givenValue == char('z'))): // 1831 + match('z') + elif ((_givenValue == char('Z'))): // 1831 + match('Z') + elif ((_givenValue == char('g'))): // 1831 + match('g') + elif ((_givenValue == char('B'))): // 1831 + match('B') + elif ((_givenValue == char('k'))): // 1831 + match('k') + elif ((_givenValue == char('/'))): // 1831 + match('/') + elif ((_givenValue == char('('))): // 1831 + match('(') + elif ((_givenValue == char(')'))): // 1831 + match(')') + elif ((_givenValue == char('|'))): // 1831 + match('|') + elif ((_givenValue == char('.'))): // 1831 + match('.') + elif ((_givenValue == char('*'))): // 1831 + match('*') + elif ((_givenValue == char('?'))): // 1831 + match('?') + elif ((_givenValue == char('$'))): // 1831 + match('$') + elif ((_givenValue == char('^'))): // 1831 + match('^') + elif ((_givenValue == char('['))): // 1831 + match('[') + elif ((_givenValue == char(']'))): // 1831 + match(']') + else: // line 1969 + raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) + if (_createToken and (_token is null) and (_ttype != Token.SKIP)): + _token = makeToken(_ttype) + _token.setText(text.ToString(_begin, text.Length-_begin)) + returnToken_ = _token + + + private static def mk_tokenSet_0_() as (long): + data = array(long, 1025) + data[0]=287948901175001088L + data[1]=541165879422L + i = 2 + while i<=1024: + data[i] = 0L + ++i + return data + public static final tokenSet_0_ = BitSet(mk_tokenSet_0_()) + private static def mk_tokenSet_1_() as (long): + data = array(long, 2048) + data[0]=-9224L + i = 1 + while i<=1022: + data[i] = -1L + ++i + data[1023]=9223372036854775807L + i = 1024 + while i<=2047: + data[i] = 0L + ++i + return data + public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) + private static def mk_tokenSet_2_() as (long): + data = array(long, 2048) + data[0]=-4398046520328L + i = 1 + while i<=1022: + data[i] = -1L + ++i + data[1023]=9223372036854775807L + i = 1024 + while i<=2047: + data[i] = 0L + ++i + return data + public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) + private static def mk_tokenSet_3_() as (long): + data = array(long, 2048) + data[0]=-17179878408L + data[1]=-268435457L + i = 2 + while i<=1022: + data[i] = -1L + ++i + data[1023]=9223372036854775807L + i = 1024 + while i<=2047: + data[i] = 0L + ++i + return data + public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) + private static def mk_tokenSet_4_() as (long): + data = array(long, 2048) + data[0]=-549755823112L + data[1]=-268435457L + i = 2 + while i<=1022: + data[i] = -1L + ++i + data[1023]=9223372036854775807L + i = 1024 + while i<=2047: + data[i] = 0L + ++i + return data + public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) + private static def mk_tokenSet_5_() as (long): + data = array(long, 2048) + data[0]=-140741783332360L + i = 1 + while i<=1022: + data[i] = -1L + ++i + data[1023]=9223372036854775807L + i = 1024 + while i<=2047: + data[i] = 0L + ++i + return data + public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) + private static def mk_tokenSet_6_() as (long): + data = array(long, 2048) + data[0]=-140741783332360L + data[1]=-268435457L + i = 2 + while i<=1022: + data[i] = -1L + ++i + data[1023]=9223372036854775807L + i = 1024 + while i<=2047: + data[i] = 0L + ++i + return data + public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) + private static def mk_tokenSet_7_() as (long): + data = array(long, 2048) + data[0]=-4294977032L + i = 1 + while i<=1022: + data[i] = -1L + ++i + data[1023]=9223372036854775807L + i = 1024 + while i<=2047: + data[i] = 0L + ++i + return data + public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) + diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 6fbefa0..2a6b551 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -1,23 +1,23 @@ -// $ANTLR 2.7.5 (20050517): "UnityScript.g" -> "UnityScriptParser.boo"$ - -namespace UnityScript.Parser -// Generate the header common to all output files. -import System - -import antlr.TokenBuffer as TokenBuffer -import antlr.TokenStreamException as TokenStreamException -import antlr.TokenStreamIOException as TokenStreamIOException -import antlr.ANTLRException as ANTLRException -import antlr.LLkParser as LLkParser -import antlr.Token as Token -import antlr.IToken as IToken -import antlr.TokenStream as TokenStream -import antlr.RecognitionException as RecognitionException -import antlr.NoViableAltException as NoViableAltException -import antlr.MismatchedTokenException as MismatchedTokenException -import antlr.SemanticException as SemanticException -import antlr.ParserSharedInputState as ParserSharedInputState -import antlr.collections.impl.BitSet as BitSet +// $ANTLR 2.7.5 (20050517): "src/UnityScript/UnityScript.g" -> "UnityScriptParser.boo"$ + +namespace UnityScript.Parser +// Generate the header common to all output files. +import System + +import antlr.TokenBuffer as TokenBuffer +import antlr.TokenStreamException as TokenStreamException +import antlr.TokenStreamIOException as TokenStreamIOException +import antlr.ANTLRException as ANTLRException +import antlr.LLkParser as LLkParser +import antlr.Token as Token +import antlr.IToken as IToken +import antlr.TokenStream as TokenStream +import antlr.RecognitionException as RecognitionException +import antlr.NoViableAltException as NoViableAltException +import antlr.MismatchedTokenException as MismatchedTokenException +import antlr.SemanticException as SemanticException +import antlr.ParserSharedInputState as ParserSharedInputState +import antlr.collections.impl.BitSet as BitSet import System.Text import Boo.Lang.Compiler @@ -26,129 +26,129 @@ import System.Globalization import UnityScript import UnityScript.Core - -partial class UnityScriptParser(antlr.LLkParser): - public static final EOF = 1 - public static final NULL_TREE_LOOKAHEAD = 3 - public static final AS = 4 - public static final BREAK = 5 - public static final CAST = 6 - public static final CATCH = 7 - public static final CLASS = 8 - public static final CONTINUE = 9 - public static final DO = 10 - public static final ELSE = 11 - public static final ENUM = 12 - public static final EXTENDS = 13 - public static final FALSE = 14 - public static final FINAL = 15 - public static final FINALLY = 16 - public static final FOR = 17 - public static final FUNCTION = 18 - public static final GET = 19 - public static final IF = 20 - public static final IMPORT = 21 - public static final IMPLEMENTS = 22 - public static final IN = 23 - public static final INTERFACE = 24 - public static final INSTANCEOF = 25 - public static final NEW = 26 - public static final NULL = 27 - public static final RETURN = 28 - public static final PUBLIC = 29 - public static final PROTECTED = 30 - public static final INTERNAL = 31 - public static final OVERRIDE = 32 - public static final PARTIAL = 33 - public static final PRIVATE = 34 - public static final SET = 35 - public static final STATIC = 36 - public static final SUPER = 37 - public static final THIS = 38 - public static final THROW = 39 - public static final TRUE = 40 - public static final TRY = 41 - public static final TYPEOF = 42 - public static final VAR = 43 - public static final VIRTUAL = 44 - public static final WHILE = 45 - public static final YIELD = 46 - public static final SWITCH = 47 - public static final CASE = 48 - public static final DEFAULT = 49 - public static final INPLACE_DIVISION = 50 - public static final INPLACE_ADD = 51 - public static final INPLACE_SUBTRACT = 52 - public static final INPLACE_MULTIPLY = 53 - public static final SL_COMMENT = 54 - public static final PRAGMA_ON = 55 - public static final PRAGMA_OFF = 56 - public static final ID = 57 - public static final DOUBLE_QUOTED_STRING = 58 - public static final LBRACE = 59 - public static final RBRACE = 60 - public static final LPAREN = 61 - public static final RPAREN = 62 - public static final DOT = 63 - public static final COLON = 64 - public static final COMMA = 65 - public static final LBRACK = 66 - public static final RBRACK = 67 - public static final BITWISE_OR = 68 - public static final INPLACE_BITWISE_OR = 69 - public static final BITWISE_AND = 70 - public static final BITWISE_XOR = 71 - public static final INPLACE_BITWISE_AND = 72 - public static final LOGICAL_OR = 73 - public static final LOGICAL_AND = 74 - public static final EOS = 75 - public static final ASSIGN = 76 - public static final INCREMENT = 77 - public static final DECREMENT = 78 - public static final ADD = 79 - public static final SUBTRACT = 80 - public static final MODULUS = 81 - public static final MULTIPLY = 82 - public static final EQUALITY = 83 - public static final INEQUALITY = 84 - public static final QUESTION_MARK = 85 - public static final BITWISE_NOT = 86 - public static final REFERENCE_EQUALITY = 87 - public static final REFERENCE_INEQUALITY = 88 - public static final LESS_THAN = 89 - public static final LESS_THAN_OR_EQUAL = 90 - public static final SHIFT_LEFT = 91 - public static final INPLACE_SHIFT_LEFT = 92 - public static final GREATER_THAN = 93 - public static final GREATER_THAN_OR_EQUAL = 94 - public static final SHIFT_RIGHT = 95 - public static final INPLACE_SHIFT_RIGHT = 96 - public static final AT = 97 - public static final SCRIPT_ATTRIBUTE_MARKER = 98 - public static final ASSEMBLY_ATTRIBUTE_MARKER = 99 - public static final INPLACE_BITWISE_XOR = 100 - public static final NOT = 101 - public static final DIVISION = 102 - public static final RE_LITERAL = 103 - public static final DOUBLE = 104 - public static final INT = 105 - public static final LONG = 106 - public static final SINGLE_QUOTED_STRING = 107 - public static final DOUBLE_SUFFIX = 108 - public static final EXPONENT = 109 - public static final PRAGMA_WHITE_SPACE = 110 - public static final WHITE_SPACE = 111 - public static final DQS_ESC = 112 - public static final SQS_ESC = 113 - public static final SESC = 114 - public static final ML_COMMENT = 115 - public static final RE_CHAR = 116 - public static final RE_ESC = 117 - public static final NEWLINE = 118 - public static final ID_LETTER = 119 - public static final DIGIT = 120 - public static final HEXDIGIT = 121 - + +partial class UnityScriptParser(antlr.LLkParser): + public static final EOF = 1 + public static final NULL_TREE_LOOKAHEAD = 3 + public static final AS = 4 + public static final BREAK = 5 + public static final CAST = 6 + public static final CATCH = 7 + public static final CLASS = 8 + public static final CONTINUE = 9 + public static final DO = 10 + public static final ELSE = 11 + public static final ENUM = 12 + public static final EXTENDS = 13 + public static final FALSE = 14 + public static final FINAL = 15 + public static final FINALLY = 16 + public static final FOR = 17 + public static final FUNCTION = 18 + public static final GET = 19 + public static final IF = 20 + public static final IMPORT = 21 + public static final IMPLEMENTS = 22 + public static final IN = 23 + public static final INTERFACE = 24 + public static final INSTANCEOF = 25 + public static final NEW = 26 + public static final NULL = 27 + public static final RETURN = 28 + public static final PUBLIC = 29 + public static final PROTECTED = 30 + public static final INTERNAL = 31 + public static final OVERRIDE = 32 + public static final PARTIAL = 33 + public static final PRIVATE = 34 + public static final SET = 35 + public static final STATIC = 36 + public static final SUPER = 37 + public static final THIS = 38 + public static final THROW = 39 + public static final TRUE = 40 + public static final TRY = 41 + public static final TYPEOF = 42 + public static final VAR = 43 + public static final VIRTUAL = 44 + public static final WHILE = 45 + public static final YIELD = 46 + public static final SWITCH = 47 + public static final CASE = 48 + public static final DEFAULT = 49 + public static final INPLACE_DIVISION = 50 + public static final INPLACE_ADD = 51 + public static final INPLACE_SUBTRACT = 52 + public static final INPLACE_MULTIPLY = 53 + public static final SL_COMMENT = 54 + public static final PRAGMA_ON = 55 + public static final PRAGMA_OFF = 56 + public static final ID = 57 + public static final DOUBLE_QUOTED_STRING = 58 + public static final LBRACE = 59 + public static final RBRACE = 60 + public static final LPAREN = 61 + public static final RPAREN = 62 + public static final DOT = 63 + public static final COLON = 64 + public static final COMMA = 65 + public static final LBRACK = 66 + public static final RBRACK = 67 + public static final BITWISE_OR = 68 + public static final INPLACE_BITWISE_OR = 69 + public static final BITWISE_AND = 70 + public static final BITWISE_XOR = 71 + public static final INPLACE_BITWISE_AND = 72 + public static final LOGICAL_OR = 73 + public static final LOGICAL_AND = 74 + public static final EOS = 75 + public static final ASSIGN = 76 + public static final INCREMENT = 77 + public static final DECREMENT = 78 + public static final ADD = 79 + public static final SUBTRACT = 80 + public static final MODULUS = 81 + public static final MULTIPLY = 82 + public static final EQUALITY = 83 + public static final INEQUALITY = 84 + public static final QUESTION_MARK = 85 + public static final BITWISE_NOT = 86 + public static final REFERENCE_EQUALITY = 87 + public static final REFERENCE_INEQUALITY = 88 + public static final LESS_THAN = 89 + public static final LESS_THAN_OR_EQUAL = 90 + public static final SHIFT_LEFT = 91 + public static final INPLACE_SHIFT_LEFT = 92 + public static final GREATER_THAN = 93 + public static final GREATER_THAN_OR_EQUAL = 94 + public static final SHIFT_RIGHT = 95 + public static final INPLACE_SHIFT_RIGHT = 96 + public static final AT = 97 + public static final SCRIPT_ATTRIBUTE_MARKER = 98 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 99 + public static final INPLACE_BITWISE_XOR = 100 + public static final NOT = 101 + public static final DIVISION = 102 + public static final RE_LITERAL = 103 + public static final DOUBLE = 104 + public static final INT = 105 + public static final LONG = 106 + public static final SINGLE_QUOTED_STRING = 107 + public static final DOUBLE_SUFFIX = 108 + public static final EXPONENT = 109 + public static final PRAGMA_WHITE_SPACE = 110 + public static final WHITE_SPACE = 111 + public static final DQS_ESC = 112 + public static final SQS_ESC = 113 + public static final SESC = 114 + public static final ML_COMMENT = 115 + public static final RE_CHAR = 116 + public static final RE_ESC = 117 + public static final NEWLINE = 118 + public static final ID_LETTER = 119 + public static final DIGIT = 120 + public static final HEXDIGIT = 121 + [property(CompilerContext)] _context as CompilerContext @@ -254,12 +254,15 @@ partial class UnityScriptParser(antlr.LLkParser): static def CreateModuleName(fname as string): return System.IO.Path.GetFileNameWithoutExtension(fname) + static def IsConstructorName(name as string, type as TypeDefinition): + return type.NodeType != NodeType.Module and name == type.Name + def AddFunctionTo(type as TypeDefinition, nameToken as IToken, getter as IToken, setter as IToken): name = nameToken.getText() location = ToLexicalInfo(nameToken) - function as Method = (Constructor(location) if name == type.Name else Method(location, Name: name)) + function as Method = (Constructor(location) if IsConstructorName(name, type) else Method(location, Name: name)) if getter is not null or setter is not null: p = type.Members[name] as Property if p is null: @@ -289,4567 +292,4539 @@ partial class UnityScriptParser(antlr.LLkParser): if getter is not null: if function.Parameters.Count > 0: ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(function.LexicalInfo)) - - protected def initialize(): - tokenNames = tokenNames_ - - - protected def constructor(tokenBuf as TokenBuffer, k as int): - super(tokenBuf, k) - initialize() - - def constructor(tokenBuf as TokenBuffer): - self(tokenBuf, 2) - - protected def constructor(lexer as TokenStream, k as int): - super(lexer, k) - initialize() - - public def constructor(lexer as TokenStream): - self(lexer, 2) - - public def constructor(state as ParserSharedInputState): - super(state, 2) - initialize() - - public def start( - cu as CompileUnit - ) as void: //throws RecognitionException, TokenStreamException - - eof as IToken = null - module = Module(LexicalInfo(getFilename(), 1, 1)) - module.Name = CreateModuleName(getFilename()) - cu.Modules.Add(module) - globals = module.Globals - - try: // for error handling - while true: - _givenValue = LA(1) - if ((_givenValue == IMPORT)): // 1831 - import_directive(module) - elif ((_givenValue == PRAGMA_ON) - or (_givenValue ==PRAGMA_OFF) - ): // 1827 - pragma_directive(module) - else: // line 1969 - synPredMatched4 as bool = false - if ((LA(1)==AT) and (LA(2)==ID)): - _m4 as int = mark() - synPredMatched4 = true - ++inputState.guessing - try: - match(AT) - match(ID) - match(ID) - except x as RecognitionException: - synPredMatched4 = false - rewind(_m4) - --inputState.guessing - if synPredMatched4: - script_or_assembly_attribute(module) - else: - goto _loop5_breakloop - :_loop5_breakloop - while true: - synPredMatched8 as bool = false - if ((LA(1)==AT) and (LA(2)==ID)): - _m8 as int = mark() - synPredMatched8 = true - ++inputState.guessing - try: - match(AT) - match(ID) - match(ID) - except x as RecognitionException: - synPredMatched8 = false - rewind(_m8) - --inputState.guessing - if synPredMatched8: - script_or_assembly_attribute(module) - elif ((LA(1)==AT) and (LA(2)==ID)): // line 2102 - attributes() - module_member(module) - elif ((tokenSet_0_.member(cast(int, LA(1)))) and (tokenSet_1_.member(cast(int, LA(2))))): // line 2102 - module_member(module) - elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_3_.member(cast(int, LA(2))))): // line 2102 - statement(globals) - else: - goto _loop10_breakloop - :_loop10_breakloop - eof = LT(1) - match(Token.EOF_TYPE) - if 0 == inputState.guessing: - SetEndSourceLocation(module, eof) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_4_) - else: - raise - - public def import_directive( - container as Module - ) as void: //throws RecognitionException, TokenStreamException - - imp as IToken = null - - try: // for error handling - imp = LT(1) - match(IMPORT) - ns=qname() - eos() - if 0 == inputState.guessing: - container.Imports.Add( - Import(ToLexicalInfo(imp), ReferenceExpression(ToLexicalInfo(ns), ns.getText()))) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_5_) - else: - raise - - public def pragma_directive( - container as Module - ) as void: //throws RecognitionException, TokenStreamException - - on as IToken = null - off as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == PRAGMA_ON)): // 1831 - on = LT(1) - match(PRAGMA_ON) - if 0 == inputState.guessing: - id=on - elif ((_givenValue == PRAGMA_OFF)): // 1831 - off = LT(1) - match(PRAGMA_OFF) - if 0 == inputState.guessing: - id=off - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - pragma = id.getText() - if Pragmas.IsValid(pragma): - if on is not null: - Pragmas.TryToEnableOn(container, pragma) - else: - Pragmas.DisableOn(container, pragma) - else: - ReportError(UnityScriptCompilerErrors.UnknownPragma(ToLexicalInfo(id), pragma)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_5_) - else: - raise - - public def script_or_assembly_attribute( - m as Module - ) as void: //throws RecognitionException, TokenStreamException - - attributeKindToken as IToken = null - - try: // for error handling - match(AT) - attributeKindToken = LT(1) - match(ID) - attr=attribute_constructor() - if 0 == inputState.guessing: - attributeKind = attributeKindToken.getText() - if attributeKind == "assembly": - m.AssemblyAttributes.Add(attr) - elif attributeKind == "script": - m.Attributes.Add(attr) - else: - UnexpectedToken(attributeKindToken) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_5_) - else: - raise - - public def attributes() as void: //throws RecognitionException, TokenStreamException - - _attributes.Clear() - - try: // for error handling - _cnt18 as int = 0 - while true: - if ((LA(1)==AT)): - attribute() - else: - if (_cnt18 >= 1): - goto _loop18_breakloop - else: - raise NoViableAltException(LT(1), getFilename()) - ++_cnt18 - :_loop18_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_6_) - else: - raise - - public def module_member( - module as Module - ) as void: //throws RecognitionException, TokenStreamException - - globals = module.Globals - - try: // for error handling - synPredMatched27 as bool = false - if (((tokenSet_7_.member(cast(int, LA(1)))) and (tokenSet_8_.member(cast(int, LA(2))))) and (GlobalVariablesBecomeFields())): - _m27 as int = mark() - synPredMatched27 = true - ++inputState.guessing - try: - module_member_modifiers() - match(VAR) - except x as RecognitionException: - synPredMatched27 = false - rewind(_m27) - --inputState.guessing - if synPredMatched27: - module_field(module) - elif ((LA(1)==VAR) and (LA(2)==FINAL or LA(2)==INTERNAL or LA(2)==ID)): // line 2102 - declaration_statement(globals) - eos() - elif ((tokenSet_9_.member(cast(int, LA(1)))) and (tokenSet_10_.member(cast(int, LA(2))))): // line 2102 - mod=module_member_modifiers() - _givenValue = LA(1) - if ((_givenValue == CLASS) - or (_givenValue ==PARTIAL) - ): // 1827 - mm=class_declaration(module) - elif ((_givenValue == INTERFACE)): // 1831 - mm=interface_declaration(module) - elif ((_givenValue == ENUM)): // 1831 - mm=enum_declaration(module) - elif ((_givenValue == FUNCTION)): // 1831 - mm=module_function(module) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - mm.Modifiers |= mod if mm is not null - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_11_) - else: - raise - - public def statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - synPredMatched108 as bool = false - if ((LA(1)==GET or LA(1)==SET or LA(1)==ID) and (tokenSet_12_.member(cast(int, LA(2))))): - _m108 as int = mark() - synPredMatched108 = true - ++inputState.guessing - try: - macro_application_test() - except x as RecognitionException: - synPredMatched108 = false - rewind(_m108) - --inputState.guessing - if synPredMatched108: - macro_application_block(b) - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 - builtin_statement(b) - elif ((LA(1)==EOS)): // line 2102 - _cnt110 as int = 0 - while true: - if ((LA(1)==EOS) and (tokenSet_15_.member(cast(int, LA(2))))): - match(EOS) - else: - if (_cnt110 >= 1): - goto _loop110_breakloop - else: - raise NoViableAltException(LT(1), getFilename()) - ++_cnt110 - :_loop110_breakloop - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def attribute_parameter( - attr as Ast.Attribute - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - synPredMatched13 as bool = false - if ((LA(1)==ID) and (LA(2)==DOT or LA(2)==ASSIGN)): - _m13 as int = mark() - synPredMatched13 = true - ++inputState.guessing - try: - match(ID) - match(ASSIGN) - except x as RecognitionException: - synPredMatched13 = false - rewind(_m13) - --inputState.guessing - if synPredMatched13: - name=reference_expression() - match(ASSIGN) - value=expression() - if 0 == inputState.guessing: - attr.NamedArguments.Add(ExpressionPair(name, value)) - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 - value=expression() - if 0 == inputState.guessing: - attr.Arguments.Add(value) - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_17_) - else: - raise - - public def reference_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - e=simple_reference_expression() - while true: - if ((LA(1)==DOT)): - match(DOT) - e=member_reference_expression(e) - else: - goto _loop208_breakloop - :_loop208_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_18_) - else: - raise - return e - - public def expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - e=conditional_expression() - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def attribute() as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - match(AT) - attr=attribute_constructor() - if 0 == inputState.guessing: - _attributes.Add(attr) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_20_) - else: - raise - - public def attribute_constructor() as Boo.Lang.Compiler.Ast.Attribute : //throws RecognitionException, TokenStreamException - attr as Boo.Lang.Compiler.Ast.Attribute - - - try: // for error handling - name=qname() - if 0 == inputState.guessing: - attr = Ast.Attribute(ToLexicalInfo(name), name.getText()) - if ((LA(1)==LPAREN) and (tokenSet_21_.member(cast(int, LA(2))))): - match(LPAREN) - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - attribute_parameter(attr) - while true: - if ((LA(1)==COMMA)): - match(COMMA) - attribute_parameter(attr) - else: - goto _loop24_breakloop - :_loop24_breakloop - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RPAREN) - elif ((tokenSet_22_.member(cast(int, LA(1)))) and (tokenSet_23_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_22_) - else: - raise - return attr - - public def qname() as Token : //throws RecognitionException, TokenStreamException - id as Token - - start as IToken = null - other as IToken = null - - try: // for error handling - start = LT(1) - match(ID) - if 0 == inputState.guessing: - id = start - buffer = StringBuilder() - buffer.Append(start.getText()) - while true: - if ((LA(1)==DOT) and (LA(2)==ID)): - match(DOT) - other = LT(1) - match(ID) - if 0 == inputState.guessing: - buffer.Append(".") - buffer.Append(other.getText()) - else: - goto _loop36_breakloop - :_loop36_breakloop - if 0 == inputState.guessing: - id.setText(buffer.ToString()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_24_) - else: - raise - return id - - public def module_member_modifiers() as TypeMemberModifiers : //throws RecognitionException, TokenStreamException - m as TypeMemberModifiers - - v as IToken = null - m = TypeMemberModifiers.None - - try: // for error handling - while true: - _givenValue = LA(1) - if ((_givenValue == FINAL)): // 1831 - match(FINAL) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Final - elif ((_givenValue == PUBLIC)): // 1831 - match(PUBLIC) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Public - elif ((_givenValue == PRIVATE)): // 1831 - match(PRIVATE) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Private - elif ((_givenValue == PROTECTED)): // 1831 - match(PROTECTED) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Protected - elif ((_givenValue == INTERNAL)): // 1831 - match(INTERNAL) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Internal - elif ((_givenValue == STATIC)): // 1831 - match(STATIC) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Static - elif ((_givenValue == VIRTUAL)): // 1831 - v = LT(1) - match(VIRTUAL) - if 0 == inputState.guessing: - VirtualKeywordHasNoEffect(v) - else: // line 1969 - goto _loop46_breakloop - :_loop46_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_25_) - else: - raise - return m - - public def module_field( - m as Module - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - mod=module_member_modifiers() - f=field_member(m) - if 0 == inputState.guessing: - f.Modifiers |= mod - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_11_) - else: - raise - - public def declaration_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - d=declaration() - _givenValue = LA(1) - if ((_givenValue == ASSIGN)): // 1831 - match(ASSIGN) - i=expression() - elif ((_givenValue == EOF) - or (_givenValue ==BREAK) - or (_givenValue ==CATCH) - or (_givenValue ==CLASS) - or (_givenValue ==CONTINUE) - or (_givenValue ==DO) - or (_givenValue ==ELSE) - or (_givenValue ==ENUM) - or (_givenValue ==FALSE) - or (_givenValue ==FINAL) - or (_givenValue ==FINALLY) - or (_givenValue ==FOR) - or (_givenValue ==FUNCTION) - or (_givenValue ==GET) - or (_givenValue ==IF) - or (_givenValue ==INTERFACE) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==RETURN) - or (_givenValue ==PUBLIC) - or (_givenValue ==PROTECTED) - or (_givenValue ==INTERNAL) - or (_givenValue ==PARTIAL) - or (_givenValue ==PRIVATE) - or (_givenValue ==SET) - or (_givenValue ==STATIC) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==THROW) - or (_givenValue ==TRUE) - or (_givenValue ==TRY) - or (_givenValue ==TYPEOF) - or (_givenValue ==VAR) - or (_givenValue ==VIRTUAL) - or (_givenValue ==WHILE) - or (_givenValue ==YIELD) - or (_givenValue ==SWITCH) - or (_givenValue ==CASE) - or (_givenValue ==DEFAULT) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==RBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==EOS) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==AT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - stmt = DeclarationStatement(d.LexicalInfo, Declaration: d, Initializer: i) - b.Add(stmt) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def eos() as antlr.IToken : //throws RecognitionException, TokenStreamException - firstEOS as antlr.IToken - - t as IToken = null - - try: // for error handling - if ((LA(1)==EOS) and (tokenSet_26_.member(cast(int, LA(2))))): - _cnt43 as int = 0 - while true: - if ((LA(1)==EOS) and (tokenSet_26_.member(cast(int, LA(2))))): - t = LT(1) - match(EOS) - if 0 == inputState.guessing: - if firstEOS is null: firstEOS = t - else: - if (_cnt43 >= 1): - goto _loop43_breakloop - else: - raise NoViableAltException(LT(1), getFilename()) - ++_cnt43 - :_loop43_breakloop - elif ((tokenSet_26_.member(cast(int, LA(1)))) and (tokenSet_27_.member(cast(int, LA(2))))): // line 2102 - if 0 == inputState.guessing: - SemicolonExpected() - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_26_) - else: - raise - return firstEOS - - public def class_declaration( - parent as TypeDefinition - ) as TypeMember : //throws RecognitionException, TokenStreamException - member as TypeMember - - p as IToken = null - name as IToken = null - rbrace as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == PARTIAL)): // 1831 - p = LT(1) - match(PARTIAL) - elif ((_givenValue == CLASS)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(CLASS) - name = LT(1) - match(ID) - _givenValue = LA(1) - if ((_givenValue == EXTENDS)): // 1831 - match(EXTENDS) - baseType=type_reference() - elif ((_givenValue == IMPLEMENTS) - or (_givenValue ==LBRACE) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - member = cd = ClassDefinition(ToLexicalInfo(name), Name: name.getText()) - baseTypes = cd.BaseTypes - if baseType is not null: - baseTypes.Add(baseType) - cd.Modifiers |= TypeMemberModifiers.Partial if p is not null - FlushAttributes(cd) - parent.Members.Add(cd) - _givenValue = LA(1) - if ((_givenValue == IMPLEMENTS)): // 1831 - match(IMPLEMENTS) - type_reference_list(baseTypes) - elif ((_givenValue == LBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - for typeRef in baseTypes: - if typeRef is baseType: - BaseTypeAnnotations.AnnotateExtends(typeRef) - else: - BaseTypeAnnotations.AnnotateImplements(typeRef) - match(LBRACE) - while true: - if ((tokenSet_28_.member(cast(int, LA(1))))): - if 0 == inputState.guessing: - mod = TypeMemberModifiers.None - _givenValue = LA(1) - if ((_givenValue == AT)): // 1831 - attributes() - elif ((_givenValue == CLASS) - or (_givenValue ==ENUM) - or (_givenValue ==FINAL) - or (_givenValue ==FUNCTION) - or (_givenValue ==INTERFACE) - or (_givenValue ==NEW) - or (_givenValue ==PUBLIC) - or (_givenValue ==PROTECTED) - or (_givenValue ==INTERNAL) - or (_givenValue ==OVERRIDE) - or (_givenValue ==PARTIAL) - or (_givenValue ==PRIVATE) - or (_givenValue ==STATIC) - or (_givenValue ==VAR) - or (_givenValue ==VIRTUAL) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_30_.member(cast(int, LA(2))))): - mod=member_modifiers() - elif ((tokenSet_25_.member(cast(int, LA(1)))) and (tokenSet_31_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - _givenValue = LA(1) - if ((_givenValue == FUNCTION)): // 1831 - m=function_member(cd) - elif ((_givenValue == VAR)): // 1831 - m=field_member(cd) - elif ((_givenValue == ENUM)): // 1831 - m=enum_declaration(cd) - elif ((_givenValue == CLASS) - or (_givenValue ==PARTIAL) - ): // 1827 - m=class_declaration(cd) - elif ((_givenValue == INTERFACE)): // 1831 - m=interface_declaration(cd) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - m.Modifiers |= mod if m is not null - else: - goto _loop58_breakloop - :_loop58_breakloop - rbrace = LT(1) - match(RBRACE) - if 0 == inputState.guessing: - SetEndSourceLocation(cd, rbrace) - while true: - if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): - match(EOS) - else: - goto _loop60_breakloop - :_loop60_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - return member - - public def interface_declaration( - parent as TypeDefinition - ) as TypeMember : //throws RecognitionException, TokenStreamException - member as TypeMember - - name as IToken = null - rbrace as IToken = null - - try: // for error handling - match(INTERFACE) - name = LT(1) - match(ID) - if 0 == inputState.guessing: - member = td = InterfaceDefinition(ToLexicalInfo(name), Name: name.getText()) - baseTypes = td.BaseTypes - FlushAttributes(td) - parent.Members.Add(td) - _givenValue = LA(1) - if ((_givenValue == EXTENDS)): // 1831 - match(EXTENDS) - type_reference_list(baseTypes) - elif ((_givenValue == LBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(LBRACE) - while true: - if ((LA(1)==FUNCTION or LA(1)==AT)): - _givenValue = LA(1) - if ((_givenValue == AT)): // 1831 - attributes() - elif ((_givenValue == FUNCTION)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - interface_member(td) - else: - goto _loop65_breakloop - :_loop65_breakloop - rbrace = LT(1) - match(RBRACE) - if 0 == inputState.guessing: - SetEndSourceLocation(td, rbrace) - while true: - if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): - match(EOS) - else: - goto _loop67_breakloop - :_loop67_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - return member - - public def enum_declaration( - container as TypeDefinition - ) as TypeMember : //throws RecognitionException, TokenStreamException - member as TypeMember - - name as IToken = null - rbrace as IToken = null - - try: // for error handling - match(ENUM) - name = LT(1) - match(ID) - if 0 == inputState.guessing: - member = ed = EnumDefinition(ToLexicalInfo(name), Name: name.getText()) - FlushAttributes(member); - container.Members.Add(ed) - match(LBRACE) - _givenValue = LA(1) - if ((_givenValue == ID) - or (_givenValue ==AT) - ): // 1827 - enum_member(ed) - while true: - if ((LA(1)==COMMA) and (LA(2)==ID or LA(2)==AT)): - match(COMMA) - enum_member(ed) - else: - goto _loop77_breakloop - :_loop77_breakloop - _givenValue = LA(1) - if ((_givenValue == COMMA)): // 1831 - match(COMMA) - elif ((_givenValue == RBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - elif ((_givenValue == RBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - rbrace = LT(1) - match(RBRACE) - if 0 == inputState.guessing: - SetEndSourceLocation(ed, rbrace) - while true: - if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): - match(EOS) - else: - goto _loop80_breakloop - :_loop80_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - return member - - public def module_function( - parent as TypeDefinition - ) as TypeMember : //throws RecognitionException, TokenStreamException - member as TypeMember - - name as IToken = null - - try: // for error handling - match(FUNCTION) - name = LT(1) - match(ID) - if 0 == inputState.guessing: - member = method = Method(ToLexicalInfo(name), Name: name.getText()) - FlushAttributes(method) - parent.Members.Add(method) - function_body(method) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_11_) - else: - raise - return member - - public def function_body( - method as Method - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - match(LPAREN) - _givenValue = LA(1) - if ((_givenValue == FINAL) - or (_givenValue ==INTERNAL) - or (_givenValue ==ID) - or (_givenValue ==AT) - ): // 1827 - parameter_declaration_list(method) - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RPAREN) - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - if 0 == inputState.guessing: - method.ReturnType = tr; - elif ((_givenValue == LBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - compound_statement(method.Body) - if 0 == inputState.guessing: - method.EndSourceLocation = method.Body.EndSourceLocation - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - - public def field_member( - cd as TypeDefinition - ) as TypeMember : //throws RecognitionException, TokenStreamException - member as TypeMember - - - try: // for error handling - match(VAR) - name=identifier() - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - elif ((_givenValue == EOF) - or (_givenValue ==BREAK) - or (_givenValue ==CLASS) - or (_givenValue ==CONTINUE) - or (_givenValue ==DO) - or (_givenValue ==ENUM) - or (_givenValue ==FALSE) - or (_givenValue ==FINAL) - or (_givenValue ==FOR) - or (_givenValue ==FUNCTION) - or (_givenValue ==GET) - or (_givenValue ==IF) - or (_givenValue ==INTERFACE) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==RETURN) - or (_givenValue ==PUBLIC) - or (_givenValue ==PROTECTED) - or (_givenValue ==INTERNAL) - or (_givenValue ==OVERRIDE) - or (_givenValue ==PARTIAL) - or (_givenValue ==PRIVATE) - or (_givenValue ==SET) - or (_givenValue ==STATIC) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==THROW) - or (_givenValue ==TRUE) - or (_givenValue ==TRY) - or (_givenValue ==TYPEOF) - or (_givenValue ==VAR) - or (_givenValue ==VIRTUAL) - or (_givenValue ==WHILE) - or (_givenValue ==YIELD) - or (_givenValue ==SWITCH) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==RBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==EOS) - or (_givenValue ==ASSIGN) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==AT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - _givenValue = LA(1) - if ((_givenValue == ASSIGN)): // 1831 - match(ASSIGN) - initializer=expression() - elif ((_givenValue == EOF) - or (_givenValue ==BREAK) - or (_givenValue ==CLASS) - or (_givenValue ==CONTINUE) - or (_givenValue ==DO) - or (_givenValue ==ENUM) - or (_givenValue ==FALSE) - or (_givenValue ==FINAL) - or (_givenValue ==FOR) - or (_givenValue ==FUNCTION) - or (_givenValue ==GET) - or (_givenValue ==IF) - or (_givenValue ==INTERFACE) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==RETURN) - or (_givenValue ==PUBLIC) - or (_givenValue ==PROTECTED) - or (_givenValue ==INTERNAL) - or (_givenValue ==OVERRIDE) - or (_givenValue ==PARTIAL) - or (_givenValue ==PRIVATE) - or (_givenValue ==SET) - or (_givenValue ==STATIC) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==THROW) - or (_givenValue ==TRUE) - or (_givenValue ==TRY) - or (_givenValue ==TYPEOF) - or (_givenValue ==VAR) - or (_givenValue ==VIRTUAL) - or (_givenValue ==WHILE) - or (_givenValue ==YIELD) - or (_givenValue ==SWITCH) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==RBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==EOS) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==AT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - finalToken=eos() - if 0 == inputState.guessing: - member = Field(ToLexicalInfo(name), - Name: name.getText(), - Type: tr, - Initializer: initializer) - if finalToken is not null: SetEndSourceLocation(member, finalToken) - FlushAttributes(member) - cd.Members.Add(member) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_32_) - else: - raise - return member - - public def member_modifiers() as TypeMemberModifiers : //throws RecognitionException, TokenStreamException - m as TypeMemberModifiers - - v as IToken = null - m = TypeMemberModifiers.None - - try: // for error handling - while true: - _givenValue = LA(1) - if ((_givenValue == FINAL)): // 1831 - match(FINAL) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Final - elif ((_givenValue == OVERRIDE)): // 1831 - match(OVERRIDE) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Override - elif ((_givenValue == PUBLIC)): // 1831 - match(PUBLIC) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Public - elif ((_givenValue == PRIVATE)): // 1831 - match(PRIVATE) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Private - elif ((_givenValue == PROTECTED)): // 1831 - match(PROTECTED) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Protected - elif ((_givenValue == INTERNAL)): // 1831 - match(INTERNAL) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Internal - elif ((_givenValue == STATIC)): // 1831 - match(STATIC) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.Static - elif ((_givenValue == NEW)): // 1831 - match(NEW) - if 0 == inputState.guessing: - m |= TypeMemberModifiers.New - elif ((_givenValue == VIRTUAL)): // 1831 - v = LT(1) - match(VIRTUAL) - if 0 == inputState.guessing: - VirtualKeywordHasNoEffect(v) - else: // line 1969 - goto _loop49_breakloop - :_loop49_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_25_) - else: - raise - return m - - public def type_reference() as TypeReference : //throws RecognitionException, TokenStreamException - tr as TypeReference - - lbrack as IToken = null - rank = 1 - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - tr=simple_type_reference() - elif ((_givenValue == FUNCTION)): // 1831 - tr=anonymous_function_type() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if ((LA(1)==LBRACK) and (LA(2)==COMMA or LA(2)==RBRACK)): - lbrack = LT(1) - match(LBRACK) - while true: - if ((LA(1)==COMMA)): - match(COMMA) - if 0 == inputState.guessing: - ++rank - else: - goto _loop177_breakloop - :_loop177_breakloop - match(RBRACK) - if 0 == inputState.guessing: - tr = ArrayTypeReference(tr.LexicalInfo, tr, IntegerLiteralExpression(ToLexicalInfo(lbrack), rank)) - elif ((tokenSet_33_.member(cast(int, LA(1)))) and (tokenSet_24_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_33_) - else: - raise - return tr - - public def type_reference_list( - typeReferences as TypeReferenceCollection - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - tr=type_reference() - if 0 == inputState.guessing: - typeReferences.Add(tr) - while true: - if ((LA(1)==COMMA)): - match(COMMA) - tr=type_reference() - if 0 == inputState.guessing: - typeReferences.Add(tr) - else: - goto _loop193_breakloop - :_loop193_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_34_) - else: - raise - - public def function_member( - cd as ClassDefinition - ) as TypeMember : //throws RecognitionException, TokenStreamException - member as TypeMember - - getter as IToken = null - setter as IToken = null - - try: // for error handling - match(FUNCTION) - _givenValue = LA(1) - if ((_givenValue == GET)): // 1831 - getter = LT(1) - match(GET) - elif ((_givenValue == SET)): // 1831 - setter = LT(1) - match(SET) - elif ((_givenValue == FINAL) - or (_givenValue ==INTERNAL) - or (_givenValue ==ID) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - memberName=identifier() - if 0 == inputState.guessing: - member = function = AddFunctionTo(cd, memberName, getter, setter) - function_body(function) - if 0 == inputState.guessing: - ValidateFunctionDeclaration(function, getter, setter) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_35_) - else: - raise - return member - - public def interface_member( - parent as TypeDefinition - ) as void: //throws RecognitionException, TokenStreamException - - getter as IToken = null - setter as IToken = null - - try: // for error handling - match(FUNCTION) - _givenValue = LA(1) - if ((_givenValue == GET)): // 1831 - getter = LT(1) - match(GET) - elif ((_givenValue == SET)): // 1831 - setter = LT(1) - match(SET) - elif ((_givenValue == FINAL) - or (_givenValue ==INTERNAL) - or (_givenValue ==ID) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - memberName=identifier() - if 0 == inputState.guessing: - function = AddFunctionTo(parent, memberName, getter, setter) - match(LPAREN) - _givenValue = LA(1) - if ((_givenValue == FINAL) - or (_givenValue ==INTERNAL) - or (_givenValue ==ID) - or (_givenValue ==AT) - ): // 1827 - parameter_declaration_list(function) - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RPAREN) - if 0 == inputState.guessing: - ValidateFunctionDeclaration(function, getter, setter) - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - if 0 == inputState.guessing: - function.ReturnType = tr; - elif ((_givenValue == FUNCTION) - or (_givenValue ==RBRACE) - or (_givenValue ==EOS) - or (_givenValue ==AT) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - while true: - if ((LA(1)==EOS)): - match(EOS) - else: - goto _loop73_breakloop - :_loop73_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_36_) - else: - raise - - public def identifier() as antlr.IToken : //throws RecognitionException, TokenStreamException - token as antlr.IToken - - name as IToken = null - f as IToken = null - i as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - name = LT(1) - match(ID) - if 0 == inputState.guessing: - token = name; - elif ((_givenValue == FINAL)): // 1831 - f = LT(1) - match(FINAL) - if 0 == inputState.guessing: - token = f; KeywordCannotBeUsedAsAnIdentifier(token); - elif ((_givenValue == INTERNAL)): // 1831 - i = LT(1) - match(INTERNAL) - if 0 == inputState.guessing: - token = i; KeywordCannotBeUsedAsAnIdentifier(token); - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_37_) - else: - raise - return token - - public def parameter_declaration_list( - m as INodeWithParameters - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - parameter_declaration(m) - while true: - if ((LA(1)==COMMA)): - match(COMMA) - parameter_declaration(m) - else: - goto _loop95_breakloop - :_loop95_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_38_) - else: - raise - - public def enum_member( - container as EnumDefinition - ) as void: //throws RecognitionException, TokenStreamException - - name as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == AT)): // 1831 - attributes() - elif ((_givenValue == ID)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - name = LT(1) - match(ID) - _givenValue = LA(1) - if ((_givenValue == ASSIGN)): // 1831 - match(ASSIGN) - initializer=integer_literal() - elif ((_givenValue == RBRACE) - or (_givenValue ==COMMA) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - em = EnumMember(ToLexicalInfo(name), Name: name.getText(), Initializer: initializer) - FlushAttributes(em) - container.Members.Add(em) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_39_) - else: - raise - - public def integer_literal() as IntegerLiteralExpression : //throws RecognitionException, TokenStreamException - e as IntegerLiteralExpression - - i as IToken = null - l as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == INT)): // 1831 - i = LT(1) - match(INT) - if 0 == inputState.guessing: - e = ParseIntegerLiteralExpression(i, i.getText(), false); - elif ((_givenValue == LONG)): // 1831 - l = LT(1) - match(LONG) - if 0 == inputState.guessing: - s = l.getText() - e = ParseIntegerLiteralExpression(l, s[:-1], true) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def compound_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - block(b) - while true: - if ((LA(1)==EOS) and (tokenSet_40_.member(cast(int, LA(2))))): - match(EOS) - else: - goto _loop102_breakloop - :_loop102_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_40_) - else: - raise - - public def parameter_declaration( - m as INodeWithParameters - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == AT)): // 1831 - attributes() - elif ((_givenValue == FINAL) - or (_givenValue ==INTERNAL) - or (_givenValue ==ID) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - id=identifier() - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - elif ((_givenValue == RPAREN) - or (_givenValue ==COMMA) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - parameter = ParameterDeclaration(ToLexicalInfo(id), Name: id.getText(), Type: tr) - m.Parameters.Add(parameter) - FlushAttributes(parameter) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_17_) - else: - raise - - public def compound_or_single_stmt( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - if ((LA(1)==LBRACE) and (tokenSet_41_.member(cast(int, LA(2))))): - compound_statement(b) - elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 - statement(b) - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def block( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - rbrace as IToken = null - - try: // for error handling - match(LBRACE) - while true: - if ((tokenSet_2_.member(cast(int, LA(1))))): - statement(b) - else: - goto _loop105_breakloop - :_loop105_breakloop - rbrace = LT(1) - match(RBRACE) - if 0 == inputState.guessing: - SetEndSourceLocation(b, rbrace) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - - public def macro_application_test() as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - if ((LA(1)==GET or LA(1)==SET or LA(1)==ID) and (LA(2)==LBRACE)): - member() - match(LBRACE) - elif ((LA(1)==GET or LA(1)==SET or LA(1)==ID) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 - member() - expression_list(null) - match(LBRACE) - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_4_) - else: - raise - - public def macro_application_block( - container as Block - ) as void: //throws RecognitionException, TokenStreamException - - m = MacroStatement() - args = m.Arguments - b = m.Body - - try: // for error handling - macroName=member() - synPredMatched146 as bool = false - if ((LA(1)==LBRACE) and (tokenSet_41_.member(cast(int, LA(2))))): - _m146 as int = mark() - synPredMatched146 = true - ++inputState.guessing - try: - match(LBRACE) - except x as RecognitionException: - synPredMatched146 = false - rewind(_m146) - --inputState.guessing - if synPredMatched146: - compound_statement(b) - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_42_.member(cast(int, LA(2))))): // line 2102 - expression_list(args) - compound_statement(b) - else: - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - m.LexicalInfo = ToLexicalInfo(macroName) - m.Name = macroName.getText() - container.Add(m) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def builtin_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == DO) - or (_givenValue ==FOR) - or (_givenValue ==IF) - or (_givenValue ==TRY) - or (_givenValue ==WHILE) - or (_givenValue ==SWITCH) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == DO)): // 1831 - do_while_statement(b) - elif ((_givenValue == WHILE)): // 1831 - while_statement(b) - elif ((_givenValue == FOR)): // 1831 - for_statement(b) - elif ((_givenValue == IF)): // 1831 - if_statement(b) - elif ((_givenValue == TRY)): // 1831 - try_statement(b) - elif ((_givenValue == SWITCH)): // 1831 - switch_statement(b) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - elif ((_givenValue == BREAK) - or (_givenValue ==CONTINUE) - or (_givenValue ==FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==RETURN) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==THROW) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==VAR) - or (_givenValue ==YIELD) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - expression_statement(b) - elif ((_givenValue == YIELD)): // 1831 - yield_statement(b) - elif ((_givenValue == RETURN)): // 1831 - return_statement(b) - elif ((_givenValue == BREAK)): // 1831 - break_statement(b) - elif ((_givenValue == CONTINUE)): // 1831 - continue_statement(b) - elif ((_givenValue == THROW)): // 1831 - throw_statement(b) - elif ((_givenValue == VAR)): // 1831 - declaration_statement(b) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - eos() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def do_while_statement( - container as Block - ) as void: //throws RecognitionException, TokenStreamException - - d as IToken = null - w as IToken = null - - try: // for error handling - d = LT(1) - match(DO) - if 0 == inputState.guessing: - ws = WhileStatement(ToLexicalInfo(d), Condition: BoolLiteralExpression(true)) - b = ws.Block - container.Add(ws) - EnterLoop(ws) - block(b) - w = LT(1) - match(WHILE) - e=paren_expression() - eos() - if 0 == inputState.guessing: - b.Add(BreakStatement(ToLexicalInfo(w), Modifier: StatementModifier(StatementModifierType.Unless, e))) - LeaveLoop(ws) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def while_statement( - container as Block - ) as void: //throws RecognitionException, TokenStreamException - - w as IToken = null - - try: // for error handling - w = LT(1) - match(WHILE) - e=paren_expression() - if 0 == inputState.guessing: - ws = WhileStatement(ToLexicalInfo(w), Condition: e) - b = ws.Block - container.Add(ws) - EnterLoop(ws) - compound_or_single_stmt(b) - if 0 == inputState.guessing: - LeaveLoop(ws) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def for_statement( - container as Block - ) as void: //throws RecognitionException, TokenStreamException - - f as IToken = null - - try: // for error handling - f = LT(1) - match(FOR) - match(LPAREN) - synPredMatched130 as bool = false - if ((tokenSet_43_.member(cast(int, LA(1)))) and (tokenSet_44_.member(cast(int, LA(2))))): - _m130 as int = mark() - synPredMatched130 = true - ++inputState.guessing - try: - _givenValue = LA(1) - if ((_givenValue == FINAL) - or (_givenValue ==INTERNAL) - or (_givenValue ==ID) - ): // 1827 - identifier() - elif ((_givenValue == VAR)): // 1831 - declaration() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(IN) - except x as RecognitionException: - synPredMatched130 = false - rewind(_m130) - --inputState.guessing - if synPredMatched130: - stmt=for_in(container) - elif ((tokenSet_45_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): // line 2102 - stmt=for_c(container) - else: - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - stmt.LexicalInfo = ToLexicalInfo(f) if stmt is not null - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def if_statement( - container as Block - ) as void: //throws RecognitionException, TokenStreamException - - it as IToken = null - et as IToken = null - - try: // for error handling - it = LT(1) - match(IF) - e=paren_expression() - if 0 == inputState.guessing: - s = IfStatement(ToLexicalInfo(it), Condition: e) - b = s.TrueBlock = Block() - container.Add(s) - compound_or_single_stmt(b) - if ((LA(1)==ELSE) and (tokenSet_2_.member(cast(int, LA(2))))): - et = LT(1) - match(ELSE) - if 0 == inputState.guessing: - b = s.FalseBlock = Block(ToLexicalInfo(et)) - compound_or_single_stmt(b) - elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def try_statement( - container as Block - ) as void: //throws RecognitionException, TokenStreamException - - tt as IToken = null - ct as IToken = null - id as IToken = null - - try: // for error handling - tt = LT(1) - match(TRY) - if 0 == inputState.guessing: - s = TryStatement(ToLexicalInfo(tt)) - b = s.ProtectedBlock - container.Add(s) - compound_or_single_stmt(b) - while true: - if ((LA(1)==CATCH) and (LA(2)==LPAREN)): - ct = LT(1) - match(CATCH) - match(LPAREN) - id = LT(1) - match(ID) - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RPAREN) - if 0 == inputState.guessing: - tr = SimpleTypeReference(ToLexicalInfo(id), "System.Exception") if tr is null - handler = ExceptionHandler( - ToLexicalInfo(ct), - Declaration: Declaration(ToLexicalInfo(id), Name: id.getText(), Type: tr)) - s.ExceptionHandlers.Add(handler) - b = handler.Block - tr = null - compound_or_single_stmt(b) - else: - goto _loop165_breakloop - :_loop165_breakloop - if ((LA(1)==FINALLY) and (tokenSet_2_.member(cast(int, LA(2))))): - finally_block(s) - elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def switch_statement( - container as Block - ) as void: //throws RecognitionException, TokenStreamException - - s as IToken = null - c as IToken = null - fallthrough as IToken = null - d as IToken = null - - try: // for error handling - s = LT(1) - match(SWITCH) - e=paren_expression() - if 0 == inputState.guessing: - switchMacro = MacroStatement(ToLexicalInfo(s), Name: MacroName(s.getText())) - switchMacro.Arguments.Add(e) - switchBlock = switchMacro.Body - container.Add(switchMacro) - match(LBRACE) - while true: - if ((LA(1)==CASE)): - c = LT(1) - match(CASE) - e=expression() - match(COLON) - if 0 == inputState.guessing: - item = MacroStatement(ToLexicalInfo(c), Name: c.getText()) - item.Arguments.Add(e) - itemBlock = item.Body - switchBlock.Add(item) - while true: - if ((LA(1)==CASE)): - fallthrough = LT(1) - match(CASE) - e=expression() - match(COLON) - if 0 == inputState.guessing: - item.Arguments.Add(e); - else: - goto _loop153_breakloop - :_loop153_breakloop - _cnt155 as int = 0 - while true: - if ((tokenSet_2_.member(cast(int, LA(1))))): - statement(itemBlock) - else: - if (_cnt155 >= 1): - goto _loop155_breakloop - else: - raise NoViableAltException(LT(1), getFilename()) - ++_cnt155 - :_loop155_breakloop - else: - goto _loop156_breakloop - :_loop156_breakloop - _givenValue = LA(1) - if ((_givenValue == DEFAULT)): // 1831 - d = LT(1) - match(DEFAULT) - match(COLON) - if 0 == inputState.guessing: - item = MacroStatement(ToLexicalInfo(d), Name: d.getText()) - itemBlock = item.Body - switchBlock.Add(item) - _cnt159 as int = 0 - while true: - if ((tokenSet_2_.member(cast(int, LA(1))))): - statement(itemBlock) - else: - if (_cnt159 >= 1): - goto _loop159_breakloop - else: - raise NoViableAltException(LT(1), getFilename()) - ++_cnt159 - :_loop159_breakloop - elif ((_givenValue == RBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RBRACE) - while true: - if ((LA(1)==EOS) and (tokenSet_15_.member(cast(int, LA(2))))): - match(EOS) - else: - goto _loop161_breakloop - :_loop161_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def expression_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - e=assignment_expression() - if 0 == inputState.guessing: - b.Add(ExpressionStatement(e)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def yield_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - yt as IToken = null - - try: // for error handling - yt = LT(1) - match(YIELD) - if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_47_.member(cast(int, LA(2))))): - e=expression() - elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - b.Add(YieldStatement(ToLexicalInfo(yt), Expression: e)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def return_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - ret as IToken = null - - try: // for error handling - ret = LT(1) - match(RETURN) - if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_47_.member(cast(int, LA(2))))): - e=expression() - elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - b.Add(ReturnStatement(ToLexicalInfo(ret), Expression: e)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def break_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - t as IToken = null - - try: // for error handling - t = LT(1) - match(BREAK) - if 0 == inputState.guessing: - b.Add(BreakStatement(ToLexicalInfo(t))) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def continue_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - t as IToken = null - - try: // for error handling - t = LT(1) - match(CONTINUE) - if 0 == inputState.guessing: - gotoLabel = GetCurrentLoopLabel() - if gotoLabel is not null: - // we might be inside a c style for statement - b.Add(GotoStatement(ToLexicalInfo(t), Label: ReferenceExpression(gotoLabel))) - else: - b.Add(ContinueStatement(ToLexicalInfo(t))) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def throw_statement( - b as Block - ) as void: //throws RecognitionException, TokenStreamException - - t as IToken = null - - try: // for error handling - t = LT(1) - match(THROW) - if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_47_.member(cast(int, LA(2))))): - e=expression() - elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - b.Add(RaiseStatement(ToLexicalInfo(t), Exception: e)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def declaration() as Declaration : //throws RecognitionException, TokenStreamException - d as Declaration - - - try: // for error handling - match(VAR) - id=identifier() - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - elif ((_givenValue == EOF) - or (_givenValue ==BREAK) - or (_givenValue ==CATCH) - or (_givenValue ==CLASS) - or (_givenValue ==CONTINUE) - or (_givenValue ==DO) - or (_givenValue ==ELSE) - or (_givenValue ==ENUM) - or (_givenValue ==FALSE) - or (_givenValue ==FINAL) - or (_givenValue ==FINALLY) - or (_givenValue ==FOR) - or (_givenValue ==FUNCTION) - or (_givenValue ==GET) - or (_givenValue ==IF) - or (_givenValue ==IN) - or (_givenValue ==INTERFACE) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==RETURN) - or (_givenValue ==PUBLIC) - or (_givenValue ==PROTECTED) - or (_givenValue ==INTERNAL) - or (_givenValue ==PARTIAL) - or (_givenValue ==PRIVATE) - or (_givenValue ==SET) - or (_givenValue ==STATIC) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==THROW) - or (_givenValue ==TRUE) - or (_givenValue ==TRY) - or (_givenValue ==TYPEOF) - or (_givenValue ==VAR) - or (_givenValue ==VIRTUAL) - or (_givenValue ==WHILE) - or (_givenValue ==YIELD) - or (_givenValue ==SWITCH) - or (_givenValue ==CASE) - or (_givenValue ==DEFAULT) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==RBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==EOS) - or (_givenValue ==ASSIGN) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==AT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - d = Declaration(ToLexicalInfo(id), Name: id.getText(), Type: tr) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_48_) - else: - raise - return d - - public def assignment_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - a as IToken = null - ipa as IToken = null - ips as IToken = null - ipm as IToken = null - ipd as IToken = null - ipbo as IToken = null - ipba as IToken = null - ipxo as IToken = null - ipsl as IToken = null - ipsr as IToken = null - - try: // for error handling - e=conditional_expression() - _givenValue = LA(1) - if ((_givenValue == INPLACE_DIVISION) - or (_givenValue ==INPLACE_ADD) - or (_givenValue ==INPLACE_SUBTRACT) - or (_givenValue ==INPLACE_MULTIPLY) - or (_givenValue ==INPLACE_BITWISE_OR) - or (_givenValue ==INPLACE_BITWISE_AND) - or (_givenValue ==ASSIGN) - or (_givenValue ==INPLACE_SHIFT_LEFT) - or (_givenValue ==INPLACE_SHIFT_RIGHT) - or (_givenValue ==INPLACE_BITWISE_XOR) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == ASSIGN)): // 1831 - a = LT(1) - match(ASSIGN) - if 0 == inputState.guessing: - token = a; op = BinaryOperatorType.Assign - elif ((_givenValue == INPLACE_ADD)): // 1831 - ipa = LT(1) - match(INPLACE_ADD) - if 0 == inputState.guessing: - token = ipa; op = BinaryOperatorType.InPlaceAddition - elif ((_givenValue == INPLACE_SUBTRACT)): // 1831 - ips = LT(1) - match(INPLACE_SUBTRACT) - if 0 == inputState.guessing: - token = ips; op = BinaryOperatorType.InPlaceSubtraction - elif ((_givenValue == INPLACE_MULTIPLY)): // 1831 - ipm = LT(1) - match(INPLACE_MULTIPLY) - if 0 == inputState.guessing: - token = ipm; op = BinaryOperatorType.InPlaceMultiply - elif ((_givenValue == INPLACE_DIVISION)): // 1831 - ipd = LT(1) - match(INPLACE_DIVISION) - if 0 == inputState.guessing: - token = ipd; op = BinaryOperatorType.InPlaceDivision - elif ((_givenValue == INPLACE_BITWISE_OR)): // 1831 - ipbo = LT(1) - match(INPLACE_BITWISE_OR) - if 0 == inputState.guessing: - token = ipbo; op = BinaryOperatorType.InPlaceBitwiseOr - elif ((_givenValue == INPLACE_BITWISE_AND)): // 1831 - ipba = LT(1) - match(INPLACE_BITWISE_AND) - if 0 == inputState.guessing: - token = ipba; op = BinaryOperatorType.InPlaceBitwiseAnd - elif ((_givenValue == INPLACE_BITWISE_XOR)): // 1831 - ipxo = LT(1) - match(INPLACE_BITWISE_XOR) - if 0 == inputState.guessing: - token = ipxo; op = BinaryOperatorType.InPlaceExclusiveOr - elif ((_givenValue == INPLACE_SHIFT_LEFT)): // 1831 - ipsl = LT(1) - match(INPLACE_SHIFT_LEFT) - if 0 == inputState.guessing: - token = ipsl; op = BinaryOperatorType.InPlaceShiftLeft - elif ((_givenValue == INPLACE_SHIFT_RIGHT)): // 1831 - ipsr = LT(1) - match(INPLACE_SHIFT_RIGHT) - if 0 == inputState.guessing: - token = ipsr; op = BinaryOperatorType.InPlaceShiftRight - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - r=assignment_expression() - if 0 == inputState.guessing: - be = BinaryExpression(ToLexicalInfo(token)) - be.Operator = op - be.Left = e - be.Right = r - e = be - elif ((_givenValue == EOF) - or (_givenValue ==BREAK) - or (_givenValue ==CATCH) - or (_givenValue ==CLASS) - or (_givenValue ==CONTINUE) - or (_givenValue ==DO) - or (_givenValue ==ELSE) - or (_givenValue ==ENUM) - or (_givenValue ==FALSE) - or (_givenValue ==FINAL) - or (_givenValue ==FINALLY) - or (_givenValue ==FOR) - or (_givenValue ==FUNCTION) - or (_givenValue ==GET) - or (_givenValue ==IF) - or (_givenValue ==INTERFACE) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==RETURN) - or (_givenValue ==PUBLIC) - or (_givenValue ==PROTECTED) - or (_givenValue ==INTERNAL) - or (_givenValue ==PARTIAL) - or (_givenValue ==PRIVATE) - or (_givenValue ==SET) - or (_givenValue ==STATIC) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==THROW) - or (_givenValue ==TRUE) - or (_givenValue ==TRY) - or (_givenValue ==TYPEOF) - or (_givenValue ==VAR) - or (_givenValue ==VIRTUAL) - or (_givenValue ==WHILE) - or (_givenValue ==YIELD) - or (_givenValue ==SWITCH) - or (_givenValue ==CASE) - or (_givenValue ==DEFAULT) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==RBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==RPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==EOS) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==AT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_49_) - else: - raise - return e - - public def for_in( - container as Block - ) as Statement : //throws RecognitionException, TokenStreamException - stmt as Statement - - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == FINAL) - or (_givenValue ==INTERNAL) - or (_givenValue ==ID) - ): // 1827 - id=identifier() - if 0 == inputState.guessing: - d = Declaration(ToLexicalInfo(id), Name: id.getText()) - elif ((_givenValue == VAR)): // 1831 - d=declaration() - if 0 == inputState.guessing: - DeclarationAnnotations.ForceNewVariable(d) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(IN) - iterator=expression() - if 0 == inputState.guessing: - fs = ForStatement(Iterator: iterator) - fs.Declarations.Add(d) - b = fs.Block - stmt = fs - container.Add(stmt) - EnterLoop(stmt) - match(RPAREN) - compound_or_single_stmt(b) - if 0 == inputState.guessing: - LeaveLoop(stmt) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - return stmt - - public def for_c( - container as Block - ) as Statement : //throws RecognitionException, TokenStreamException - stmt as Statement - - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == VAR)): // 1831 - declaration_statement(container) - if 0 == inputState.guessing: - stmt = container.Statements[-1] as DeclarationStatement - stmt.Annotate("PrivateScope") if stmt is not null - elif ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - expression_statement(container) - elif ((_givenValue == EOS)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(EOS) - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - condition=expression() - elif ((_givenValue == EOS)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(EOS) - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - update=assignment_expression() - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - ws = WhileStatement(Condition: condition) - if condition is null: - ws.Condition = BoolLiteralExpression(Value: true) - b = ws.Block - stmt = ws - // support for 'continue' - label = SetUpLoopLabel(ws) - container.Add(stmt) - EnterLoop(ws) - match(RPAREN) - compound_or_single_stmt(b) - if 0 == inputState.guessing: - LeaveLoop(ws) - if IsLabelInUse(ws): - b.Add(LabelStatement(Name: label)) - b.Add(update) if update is not null - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - return stmt - - public def member() as Token : //throws RecognitionException, TokenStreamException - name as Token - - id as IToken = null - st as IToken = null - gt as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == ID)): // 1831 - id = LT(1) - match(ID) - if 0 == inputState.guessing: - name=id; - elif ((_givenValue == SET)): // 1831 - st = LT(1) - match(SET) - if 0 == inputState.guessing: - name=st; - elif ((_givenValue == GET)): // 1831 - gt = LT(1) - match(GET) - if 0 == inputState.guessing: - name=gt; - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return name - - public def expression_list( - ec as ExpressionCollection - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): - e=expression() - if 0 == inputState.guessing: - ec.Add(e); - while true: - if ((LA(1)==COMMA)): - match(COMMA) - e=expression() - if 0 == inputState.guessing: - ec.Add(e); - else: - goto _loop226_breakloop - :_loop226_breakloop - elif ((LA(1)==LBRACE or LA(1)==RPAREN or LA(1)==RBRACK) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_50_) - else: - raise - - public def paren_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - match(LPAREN) - e=expression() - match(RPAREN) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def finally_block( - s as TryStatement - ) as void: //throws RecognitionException, TokenStreamException - - ft as IToken = null - - try: // for error handling - ft = LT(1) - match(FINALLY) - if 0 == inputState.guessing: - finallyBlock = s.EnsureBlock = Block(ToLexicalInfo(ft)) - compound_or_single_stmt(finallyBlock) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_15_) - else: - raise - - public def conditional_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - qm as IToken = null - - try: // for error handling - e=logical_or() - if ((LA(1)==QUESTION_MARK) and (tokenSet_12_.member(cast(int, LA(2))))): - qm = LT(1) - match(QUESTION_MARK) - trueValue=logical_or() - match(COLON) - falseValue=conditional_expression() - if 0 == inputState.guessing: - e = ConditionalExpression(ToLexicalInfo(qm), - Condition: e, - TrueValue: trueValue, - FalseValue: falseValue) - elif ((tokenSet_19_.member(cast(int, LA(1)))) and (tokenSet_27_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def simple_type_reference() as TypeReference : //throws RecognitionException, TokenStreamException - tr as TypeReference - - - try: // for error handling - typeName=qname() - if ((LA(1)==DOT) and (LA(2)==LESS_THAN)): - match(DOT) - match(LESS_THAN) - if 0 == inputState.guessing: - tr = gtr = GenericTypeReference(ToLexicalInfo(typeName), typeName.getText()); - arguments = gtr.GenericArguments - type_reference_list(arguments) - match(GREATER_THAN) - elif ((tokenSet_33_.member(cast(int, LA(1)))) and (tokenSet_24_.member(cast(int, LA(2))))): // line 2102 - if 0 == inputState.guessing: - tr = SimpleTypeReference(ToLexicalInfo(typeName), Name: typeName.getText()) - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_33_) - else: - raise - return tr - - public def anonymous_function_type() as TypeReference : //throws RecognitionException, TokenStreamException - tr as TypeReference - - fn as IToken = null - - try: // for error handling - fn = LT(1) - match(FUNCTION) - if 0 == inputState.guessing: - tr = callableTypeRef = CallableTypeReference(ToLexicalInfo(fn)) - parameters = callableTypeRef.Parameters - function_type_parameters(parameters) - if ((LA(1)==COLON) and (LA(2)==FUNCTION or LA(2)==ID)): - match(COLON) - returnType=type_reference() - if 0 == inputState.guessing: - callableTypeRef.ReturnType = returnType - elif ((tokenSet_33_.member(cast(int, LA(1)))) and (tokenSet_24_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_33_) - else: - raise - return tr - - public def function_type_parameters( - parameters as ParameterDeclarationCollection - ) as void: //throws RecognitionException, TokenStreamException - - - try: // for error handling - match(LPAREN) - _givenValue = LA(1) - if ((_givenValue == FUNCTION) - or (_givenValue ==ID) - ): // 1827 - parameterType=type_reference() - if 0 == inputState.guessing: - parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) - while true: - if ((LA(1)==COMMA)): - match(COMMA) - parameterType=type_reference() - if 0 == inputState.guessing: - parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) - else: - goto _loop183_breakloop - :_loop183_breakloop - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RPAREN) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_33_) - else: - raise - - public def array_initializer() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - dimensions = List of Expression(1) - - try: // for error handling - tr=simple_type_reference() - match(LBRACK) - size=sum() - if 0 == inputState.guessing: - dimensions.Add(size) - while true: - if ((LA(1)==COMMA)): - match(COMMA) - size=sum() - if 0 == inputState.guessing: - dimensions.Add(size) - else: - goto _loop186_breakloop - :_loop186_breakloop - match(RBRACK) - if 0 == inputState.guessing: - e = CodeFactory.NewArrayInitializer(tr.LexicalInfo, tr, dimensions) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def sum() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - add as IToken = null - sub as IToken = null - bOperator = BinaryOperatorType.None; - - try: // for error handling - e=term() - while true: - if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_12_.member(cast(int, LA(2))))): - _givenValue = LA(1) - if ((_givenValue == ADD)): // 1831 - add = LT(1) - match(ADD) - if 0 == inputState.guessing: - op=add; bOperator = BinaryOperatorType.Addition; - elif ((_givenValue == SUBTRACT)): // 1831 - sub = LT(1) - match(SUBTRACT) - if 0 == inputState.guessing: - op=sub; bOperator = BinaryOperatorType.Subtraction; - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - r=term() - if 0 == inputState.guessing: - be = BinaryExpression(ToLexicalInfo(op)) - be.Operator = bOperator - be.Left = e - be.Right = r - e = be - else: - goto _loop260_breakloop - :_loop260_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def new_array_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - match(NEW) - e=array_initializer() - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def new_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - synPredMatched197 as bool = false - if ((LA(1)==NEW) and (LA(2)==ID)): - _m197 as int = mark() - synPredMatched197 = true - ++inputState.guessing - try: - new_array_expression() - except x as RecognitionException: - synPredMatched197 = false - rewind(_m197) - --inputState.guessing - if synPredMatched197: - e=new_array_expression() - elif ((LA(1)==NEW) and (LA(2)==ID)): // line 2102 - match(NEW) - r=reference_expression() - if 0 == inputState.guessing: - e = mie = MethodInvocationExpression(r.LexicalInfo, Target: r) - args = mie.Arguments - match(LPAREN) - expression_list(args) - match(RPAREN) - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def atom() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LBRACK) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - e=literal() - elif ((_givenValue == FUNCTION)): // 1831 - e=function_expression() - elif ((_givenValue == ID)): // 1831 - e=simple_reference_expression() - elif ((_givenValue == LPAREN)): // 1831 - e=paren_expression() - elif ((_givenValue == NEW)): // 1831 - e=new_expression() - elif ((_givenValue == TYPEOF)): // 1831 - e=typeof_expression() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def literal() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == INT) - or (_givenValue ==LONG) - ): // 1827 - e=integer_literal() - elif ((_givenValue == DOUBLE_QUOTED_STRING) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - e=string_literal() - elif ((_givenValue == LBRACK)): // 1831 - e=array_literal() - elif ((_givenValue == LBRACE)): // 1831 - e=hash_literal() - elif ((_givenValue == RE_LITERAL)): // 1831 - e=re_literal() - elif ((_givenValue == FALSE) - or (_givenValue ==TRUE) - ): // 1827 - e=bool_literal() - elif ((_givenValue == NULL)): // 1831 - e=null_literal() - elif ((_givenValue == THIS)): // 1831 - e=self_literal() - elif ((_givenValue == SUPER)): // 1831 - e=super_literal() - elif ((_givenValue == DOUBLE)): // 1831 - e=double_literal() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def function_expression() as BlockExpression : //throws RecognitionException, TokenStreamException - e as BlockExpression - - fn as IToken = null - - try: // for error handling - fn = LT(1) - match(FUNCTION) - if 0 == inputState.guessing: - e = BlockExpression(ToLexicalInfo(fn)) - e.Annotate("inline"); - body = e.Body - match(LPAREN) - _givenValue = LA(1) - if ((_givenValue == FINAL) - or (_givenValue ==INTERNAL) - or (_givenValue ==ID) - or (_givenValue ==AT) - ): // 1827 - parameter_declaration_list(e) - elif ((_givenValue == RPAREN)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RPAREN) - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - tr=type_reference() - if 0 == inputState.guessing: - e.ReturnType = tr; - elif ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if ((LA(1)==LBRACE) and (tokenSet_41_.member(cast(int, LA(2))))): - block(body) - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 - returnValue=expression() - if 0 == inputState.guessing: - body.Add(returnValue) - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def simple_reference_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - id as IToken = null - - try: // for error handling - id = LT(1) - match(ID) - if 0 == inputState.guessing: - e = ReferenceExpression(ToLexicalInfo(id), Name: id.getText()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def typeof_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - synPredMatched215 as bool = false - if ((LA(1)==TYPEOF) and (tokenSet_12_.member(cast(int, LA(2))))): - _m215 as int = mark() - synPredMatched215 = true - ++inputState.guessing - try: - match(TYPEOF) - match(LPAREN) - expression() - match(RPAREN) - except x as RecognitionException: - synPredMatched215 = false - rewind(_m215) - --inputState.guessing - if synPredMatched215: - e=typeof_with_expression() - elif ((LA(1)==TYPEOF) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 - e=typeof_expression_alt() - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def member_reference_expression( - target as Expression - ) as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - lbrack as IToken = null - e = target; - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == LESS_THAN)): // 1831 - lbrack = LT(1) - match(LESS_THAN) - if 0 == inputState.guessing: - e = gre = GenericReferenceExpression(ToLexicalInfo(lbrack), Target: e) - genericArguments = gre.GenericArguments - type_reference_list(genericArguments) - match(GREATER_THAN) - elif ((_givenValue == GET) - or (_givenValue ==SET) - or (_givenValue ==ID) - ): // 1827 - memberName=member() - if 0 == inputState.guessing: - e = MemberReferenceExpression(ToLexicalInfo(memberName), Target: e, Name: memberName.getText()) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - protected def typeof_with_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - t as IToken = null - - try: // for error handling - t = LT(1) - match(TYPEOF) - if ((LA(1)==LPAREN) and (tokenSet_12_.member(cast(int, LA(2))))): - match(LPAREN) - arg=expression() - match(RPAREN) - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 - arg=expression() - else: - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - mie = MethodInvocationExpression(ToLexicalInfo(t)); - mie.Target = ReferenceExpression(ToLexicalInfo(t), Name: t.getText()) - mie.Arguments.Add(arg) - e = mie - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - protected def typeof_expression_alt() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - - try: // for error handling - synPredMatched218 as bool = false - if ((LA(1)==TYPEOF) and (LA(2)==LPAREN)): - _m218 as int = mark() - synPredMatched218 = true - ++inputState.guessing - try: - match(TYPEOF) - match(LPAREN) - type_reference() - match(RPAREN) - except x as RecognitionException: - synPredMatched218 = false - rewind(_m218) - --inputState.guessing - if synPredMatched218: - e=typeof_with_typeref() - elif ((LA(1)==TYPEOF) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 - e=typeof_with_expression() - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - protected def typeof_with_typeref() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - t as IToken = null - - try: // for error handling - t = LT(1) - match(TYPEOF) - match(LPAREN) - tr=type_reference() - match(RPAREN) - if 0 == inputState.guessing: - e = TypeofExpression(ToLexicalInfo(t), tr); - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def slice( - se as SlicingExpression - ) as void: //throws RecognitionException, TokenStreamException - - begin as Expression - end as Expression - step as Expression - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - if 0 == inputState.guessing: - begin = OmittedExpression.Default; - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - end=expression() - elif ((_givenValue == COLON)): // 1831 - match(COLON) - if 0 == inputState.guessing: - end = OmittedExpression.Default; - step=expression() - elif ((_givenValue == COMMA) - or (_givenValue ==RBRACK) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - elif ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - begin=expression() - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - end=expression() - elif ((_givenValue == COLON) - or (_givenValue ==COMMA) - or (_givenValue ==RBRACK) - ): // 1827 - if 0 == inputState.guessing: - end = OmittedExpression.Default; - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - _givenValue = LA(1) - if ((_givenValue == COLON)): // 1831 - match(COLON) - step=expression() - elif ((_givenValue == COMMA) - or (_givenValue ==RBRACK) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - elif ((_givenValue == COMMA) - or (_givenValue ==RBRACK) - ): // 1827 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - se.Indices.Add(Slice(begin, end, step)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_51_) - else: - raise - - public def slicing_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - lbrack as IToken = null - lparen as IToken = null - se as SlicingExpression - mce as MethodInvocationExpression - args as ExpressionCollection - - try: // for error handling - e=atom() - while true: - if ((LA(1)==LBRACK) and (tokenSet_52_.member(cast(int, LA(2))))): - lbrack = LT(1) - match(LBRACK) - if 0 == inputState.guessing: - se = SlicingExpression(ToLexicalInfo(lbrack)) - se.Target = e - e = se - slice(se) - while true: - if ((LA(1)==COMMA)): - match(COMMA) - slice(se) - else: - goto _loop242_breakloop - :_loop242_breakloop - match(RBRACK) - elif ((LA(1)==DOT) and (tokenSet_53_.member(cast(int, LA(2))))): // line 2102 - match(DOT) - e=member_reference_expression(e) - elif ((LA(1)==LPAREN) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 - lparen = LT(1) - match(LPAREN) - if 0 == inputState.guessing: - mce = MethodInvocationExpression(ToLexicalInfo(lparen)) - mce.Target = e - e = mce - args = mce.Arguments - expression_list(args) - match(RPAREN) - else: - goto _loop245_breakloop - :_loop245_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def postfix_unary_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - postinc as IToken = null - preinc as IToken = null - - try: // for error handling - e=slicing_expression() - if ((LA(1)==INCREMENT) and (tokenSet_19_.member(cast(int, LA(2))))): - postinc = LT(1) - match(INCREMENT) - if 0 == inputState.guessing: - token = postinc; operator = UnaryOperatorType.PostIncrement; - elif ((LA(1)==DECREMENT) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 - preinc = LT(1) - match(DECREMENT) - if 0 == inputState.guessing: - token = preinc; operator= UnaryOperatorType.PostDecrement; - elif ((tokenSet_19_.member(cast(int, LA(1)))) and (tokenSet_27_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - e = UnaryExpression(ToLexicalInfo(token), operator, e) if token is not null - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def unary_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - tc as IToken = null - c as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) - ): // 1827 - e=prefix_unary_expression() - elif ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - e=postfix_unary_expression() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if ((LA(1)==AS) and (LA(2)==FUNCTION or LA(2)==ID)): - tc = LT(1) - match(AS) - tr=type_reference() - if 0 == inputState.guessing: - e = TryCastExpression(ToLexicalInfo(tc), Target: e, Type: tr) - elif ((LA(1)==CAST) and (LA(2)==FUNCTION or LA(2)==ID)): // line 2102 - c = LT(1) - match(CAST) - tr=type_reference() - if 0 == inputState.guessing: - e = CastExpression(ToLexicalInfo(c), Target: e, Type: tr) - elif ((tokenSet_19_.member(cast(int, LA(1)))) and (tokenSet_27_.member(cast(int, LA(2))))): // line 2102 - pass // 947 - else: - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def prefix_unary_expression() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - sub as IToken = null - inc as IToken = null - dec as IToken = null - nt as IToken = null - oc as IToken = null - uOperator = UnaryOperatorType.None - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == SUBTRACT)): // 1831 - sub = LT(1) - match(SUBTRACT) - if 0 == inputState.guessing: - op = sub; uOperator = UnaryOperatorType.UnaryNegation; - elif ((_givenValue == INCREMENT)): // 1831 - inc = LT(1) - match(INCREMENT) - if 0 == inputState.guessing: - op = inc; uOperator = UnaryOperatorType.Increment; - elif ((_givenValue == DECREMENT)): // 1831 - dec = LT(1) - match(DECREMENT) - if 0 == inputState.guessing: - op = dec; uOperator = UnaryOperatorType.Decrement; - elif ((_givenValue == NOT)): // 1831 - nt = LT(1) - match(NOT) - if 0 == inputState.guessing: - op = nt; uOperator = UnaryOperatorType.LogicalNot; - elif ((_givenValue == BITWISE_NOT)): // 1831 - oc = LT(1) - match(BITWISE_NOT) - if 0 == inputState.guessing: - op = oc; uOperator = UnaryOperatorType.OnesComplement; - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - e=unary_expression() - if 0 == inputState.guessing: - e = UnaryExpression(ToLexicalInfo(op), uOperator, e) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def term() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - m as IToken = null - d as IToken = null - md as IToken = null - op = BinaryOperatorType.None - - try: // for error handling - e=unary_expression() - while true: - if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_12_.member(cast(int, LA(2))))): - _givenValue = LA(1) - if ((_givenValue == MULTIPLY)): // 1831 - m = LT(1) - match(MULTIPLY) - if 0 == inputState.guessing: - op=BinaryOperatorType.Multiply; token=m; - elif ((_givenValue == DIVISION)): // 1831 - d = LT(1) - match(DIVISION) - if 0 == inputState.guessing: - op=BinaryOperatorType.Division; token=d; - elif ((_givenValue == MODULUS)): // 1831 - md = LT(1) - match(MODULUS) - if 0 == inputState.guessing: - op=BinaryOperatorType.Modulus; token=md; - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - r=unary_expression() - if 0 == inputState.guessing: - be = BinaryExpression(ToLexicalInfo(token)) - be.Operator = op - be.Left = e - be.Right = r - e = be - else: - goto _loop256_breakloop - :_loop256_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def shift() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - sl as IToken = null - sr as IToken = null - - try: // for error handling - e=sum() - while true: - if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_12_.member(cast(int, LA(2))))): - _givenValue = LA(1) - if ((_givenValue == SHIFT_LEFT)): // 1831 - sl = LT(1) - match(SHIFT_LEFT) - if 0 == inputState.guessing: - op = BinaryOperatorType.ShiftLeft; token = sl - elif ((_givenValue == SHIFT_RIGHT)): // 1831 - sr = LT(1) - match(SHIFT_RIGHT) - if 0 == inputState.guessing: - op = BinaryOperatorType.ShiftRight; token = sr - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - r=sum() - if 0 == inputState.guessing: - e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) - else: - goto _loop264_breakloop - :_loop264_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def comparison() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - tin as IToken = null - tgt as IToken = null - tgte as IToken = null - tlt as IToken = null - tlte as IToken = null - tisa as IToken = null - r as Expression - op = BinaryOperatorType.None; - token as IToken - - try: // for error handling - e=shift() - while true: - if ((tokenSet_54_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): - _givenValue = LA(1) - if ((_givenValue == IN) - or (_givenValue ==LESS_THAN) - or (_givenValue ==LESS_THAN_OR_EQUAL) - or (_givenValue ==GREATER_THAN) - or (_givenValue ==GREATER_THAN_OR_EQUAL) - ): // 1827 - _givenValue = LA(1) - if ((_givenValue == IN)): // 1831 - tin = LT(1) - match(IN) - if 0 == inputState.guessing: - op = BinaryOperatorType.Member; token = tin; - elif ((_givenValue == GREATER_THAN)): // 1831 - tgt = LT(1) - match(GREATER_THAN) - if 0 == inputState.guessing: - op = BinaryOperatorType.GreaterThan; token = tgt; - elif ((_givenValue == GREATER_THAN_OR_EQUAL)): // 1831 - tgte = LT(1) - match(GREATER_THAN_OR_EQUAL) - if 0 == inputState.guessing: - op = BinaryOperatorType.GreaterThanOrEqual; token = tgte - elif ((_givenValue == LESS_THAN)): // 1831 - tlt = LT(1) - match(LESS_THAN) - if 0 == inputState.guessing: - op = BinaryOperatorType.LessThan; token = tlt; - elif ((_givenValue == LESS_THAN_OR_EQUAL)): // 1831 - tlte = LT(1) - match(LESS_THAN_OR_EQUAL) - if 0 == inputState.guessing: - op = BinaryOperatorType.LessThanOrEqual; token = tlte; - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - r=shift() - elif ((_givenValue == INSTANCEOF)): // 1831 - tisa = LT(1) - match(INSTANCEOF) - tr=type_reference() - if 0 == inputState.guessing: - op = BinaryOperatorType.TypeTest; - token = tisa; - r = TypeofExpression(tr.LexicalInfo, tr); - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - be = BinaryExpression(ToLexicalInfo(token)) - be.Operator = op - be.Left = e - be.Right = r - e = be - else: - goto _loop276_breakloop - :_loop276_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def equality() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - te as IToken = null - ti as IToken = null - re as IToken = null - rie as IToken = null - - try: // for error handling - e=comparison() - while true: - if ((tokenSet_55_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): - _givenValue = LA(1) - if ((_givenValue == EQUALITY)): // 1831 - te = LT(1) - match(EQUALITY) - if 0 == inputState.guessing: - op = BinaryOperatorType.Equality; token = te; - elif ((_givenValue == INEQUALITY)): // 1831 - ti = LT(1) - match(INEQUALITY) - if 0 == inputState.guessing: - op = BinaryOperatorType.Inequality; token = ti - elif ((_givenValue == REFERENCE_EQUALITY)): // 1831 - re = LT(1) - match(REFERENCE_EQUALITY) - if 0 == inputState.guessing: - op = BinaryOperatorType.ReferenceEquality; token = re - elif ((_givenValue == REFERENCE_INEQUALITY)): // 1831 - rie = LT(1) - match(REFERENCE_INEQUALITY) - if 0 == inputState.guessing: - op = BinaryOperatorType.ReferenceInequality; token = rie - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - r=comparison() - if 0 == inputState.guessing: - e = BinaryExpression(ToLexicalInfo(token), op, e, r) - else: - goto _loop284_breakloop - :_loop284_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def bitwise_and() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - token as IToken = null - - try: // for error handling - e=equality() - while true: - if ((LA(1)==BITWISE_AND) and (tokenSet_12_.member(cast(int, LA(2))))): - token = LT(1) - match(BITWISE_AND) - if 0 == inputState.guessing: - op = BinaryOperatorType.BitwiseAnd; - r=equality() - if 0 == inputState.guessing: - e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) - else: - goto _loop287_breakloop - :_loop287_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def bitwise_xor() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - token as IToken = null - - try: // for error handling - e=bitwise_and() - while true: - if ((LA(1)==BITWISE_XOR) and (tokenSet_12_.member(cast(int, LA(2))))): - token = LT(1) - match(BITWISE_XOR) - if 0 == inputState.guessing: - op = BinaryOperatorType.ExclusiveOr; - r=bitwise_and() - if 0 == inputState.guessing: - e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) - else: - goto _loop290_breakloop - :_loop290_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def bitwise_or() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - token as IToken = null - - try: // for error handling - e=bitwise_xor() - while true: - if ((LA(1)==BITWISE_OR) and (tokenSet_12_.member(cast(int, LA(2))))): - token = LT(1) - match(BITWISE_OR) - if 0 == inputState.guessing: - op = BinaryOperatorType.BitwiseOr; - r=bitwise_xor() - if 0 == inputState.guessing: - e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) - else: - goto _loop293_breakloop - :_loop293_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def logical_and() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - op as IToken = null - - try: // for error handling - e=bitwise_or() - while true: - if ((LA(1)==LOGICAL_AND) and (tokenSet_12_.member(cast(int, LA(2))))): - op = LT(1) - match(LOGICAL_AND) - rhs=bitwise_or() - if 0 == inputState.guessing: - e=BinaryExpression(ToLexicalInfo(op), - Operator: BinaryOperatorType.And, - Left: e, - Right: rhs) - else: - goto _loop296_breakloop - :_loop296_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def logical_or() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - op as IToken = null - - try: // for error handling - e=logical_and() - while true: - if ((LA(1)==LOGICAL_OR) and (tokenSet_12_.member(cast(int, LA(2))))): - op = LT(1) - match(LOGICAL_OR) - rhs=logical_and() - if 0 == inputState.guessing: - e = BinaryExpression(ToLexicalInfo(op), - Operator: BinaryOperatorType.Or, - Left: e, - Right: rhs) - else: - goto _loop299_breakloop - :_loop299_breakloop - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def string_literal() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - dqs as IToken = null - sqs as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == DOUBLE_QUOTED_STRING)): // 1831 - dqs = LT(1) - match(DOUBLE_QUOTED_STRING) - if 0 == inputState.guessing: - s = dqs; - elif ((_givenValue == SINGLE_QUOTED_STRING)): // 1831 - sqs = LT(1) - match(SINGLE_QUOTED_STRING) - if 0 == inputState.guessing: - s = sqs; - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - e = StringLiteralExpression(ToLexicalInfo(s), s.getText()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def array_literal() as Expression : //throws RecognitionException, TokenStreamException - e as Expression - - lbrack as IToken = null - - try: // for error handling - lbrack = LT(1) - match(LBRACK) - synPredMatched307 as bool = false - if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_56_.member(cast(int, LA(2))))): - _m307 as int = mark() - synPredMatched307 = true - ++inputState.guessing - try: - expression() - match(FOR) - except x as RecognitionException: - synPredMatched307 = false - rewind(_m307) - --inputState.guessing - if synPredMatched307: - projection=expression() - match(FOR) - match(LPAREN) - _givenValue = LA(1) - if ((_givenValue == FINAL) - or (_givenValue ==INTERNAL) - or (_givenValue ==ID) - ): // 1827 - id=identifier() - elif ((_givenValue == VAR)): // 1831 - variable=declaration() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(IN) - iterator=expression() - match(RPAREN) - _givenValue = LA(1) - if ((_givenValue == IF)): // 1831 - match(IF) - filter=expression() - elif ((_givenValue == RBRACK)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - if 0 == inputState.guessing: - if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) - e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) - elif ((tokenSet_57_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 - if 0 == inputState.guessing: - e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)); items = ale.Items; - expression_list(items) - else: - raise NoViableAltException(LT(1), getFilename()) - match(RBRACK) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def hash_literal() as HashLiteralExpression : //throws RecognitionException, TokenStreamException - dle as HashLiteralExpression - - lbrace as IToken = null - pair as ExpressionPair - - try: // for error handling - lbrace = LT(1) - match(LBRACE) - if 0 == inputState.guessing: - dle = HashLiteralExpression(ToLexicalInfo(lbrace)); - _givenValue = LA(1) - if ((_givenValue == FALSE) - or (_givenValue ==FUNCTION) - or (_givenValue ==NEW) - or (_givenValue ==NULL) - or (_givenValue ==SUPER) - or (_givenValue ==THIS) - or (_givenValue ==TRUE) - or (_givenValue ==TYPEOF) - or (_givenValue ==ID) - or (_givenValue ==DOUBLE_QUOTED_STRING) - or (_givenValue ==LBRACE) - or (_givenValue ==LPAREN) - or (_givenValue ==LBRACK) - or (_givenValue ==INCREMENT) - or (_givenValue ==DECREMENT) - or (_givenValue ==SUBTRACT) - or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) - or (_givenValue ==RE_LITERAL) - or (_givenValue ==DOUBLE) - or (_givenValue ==INT) - or (_givenValue ==LONG) - or (_givenValue ==SINGLE_QUOTED_STRING) - ): // 1827 - pair=expression_pair() - if 0 == inputState.guessing: - dle.Items.Add(pair); - while true: - if ((LA(1)==COMMA)): - match(COMMA) - pair=expression_pair() - if 0 == inputState.guessing: - dle.Items.Add(pair); - else: - goto _loop315_breakloop - :_loop315_breakloop - elif ((_givenValue == RBRACE)): // 1831 - pass // 947 - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(RBRACE) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return dle - - public def re_literal() as RELiteralExpression : //throws RecognitionException, TokenStreamException - re as RELiteralExpression - - value as IToken = null - - try: // for error handling - value = LT(1) - match(RE_LITERAL) - if 0 == inputState.guessing: - re = RELiteralExpression(ToLexicalInfo(value), value.getText()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return re - - public def bool_literal() as BoolLiteralExpression : //throws RecognitionException, TokenStreamException - e as BoolLiteralExpression - - t as IToken = null - f as IToken = null - - try: // for error handling - _givenValue = LA(1) - if ((_givenValue == TRUE)): // 1831 - t = LT(1) - match(TRUE) - if 0 == inputState.guessing: - e = BoolLiteralExpression(ToLexicalInfo(t), Value: true) - elif ((_givenValue == FALSE)): // 1831 - f = LT(1) - match(FALSE) - if 0 == inputState.guessing: - e = BoolLiteralExpression(ToLexicalInfo(f), Value: false) - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def null_literal() as NullLiteralExpression : //throws RecognitionException, TokenStreamException - e as NullLiteralExpression - - t as IToken = null - - try: // for error handling - t = LT(1) - match(NULL) - if 0 == inputState.guessing: - e = NullLiteralExpression(ToLexicalInfo(t)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def self_literal() as SelfLiteralExpression : //throws RecognitionException, TokenStreamException - e as SelfLiteralExpression - - t as IToken = null - - try: // for error handling - t = LT(1) - match(THIS) - if 0 == inputState.guessing: - e = SelfLiteralExpression(ToLexicalInfo(t)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def super_literal() as SuperLiteralExpression : //throws RecognitionException, TokenStreamException - e as SuperLiteralExpression - - t as IToken = null - - try: // for error handling - t = LT(1) - match(SUPER) - if 0 == inputState.guessing: - e = SuperLiteralExpression(ToLexicalInfo(t)) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return e - - public def double_literal() as DoubleLiteralExpression : //throws RecognitionException, TokenStreamException - rle as DoubleLiteralExpression - - value as IToken = null - - try: // for error handling - value = LT(1) - match(DOUBLE) - if 0 == inputState.guessing: - rle = CodeFactory.NewDoubleLiteralExpression(ToLexicalInfo(value), value.getText()) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_19_) - else: - raise - return rle - - public def expression_pair() as ExpressionPair : //throws RecognitionException, TokenStreamException - ep as ExpressionPair - - t as IToken = null - - try: // for error handling - key=expression() - t = LT(1) - match(COLON) - value=expression() - if 0 == inputState.guessing: - ep = ExpressionPair(ToLexicalInfo(t), key, value) - except ex as RecognitionException: - if (0 == inputState.guessing): - reportError(ex) - recover(ex,tokenSet_39_) - else: - raise - return ep - - - public static final tokenNames_ = ( - '<0>', - 'EOF', - '<2>', - 'NULL_TREE_LOOKAHEAD', - 'as', - 'break', - 'cast', - 'catch', - 'class', - 'continue', - 'do', - 'else', - 'enum', - 'extends', - 'false', - 'final', - 'finally', - 'for', - 'function', - 'get', - 'if', - 'import', - 'implements', - 'in', - 'interface', - 'instanceof', - 'new', - 'null', - 'return', - 'public', - 'protected', - 'internal', - 'override', - 'partial', - 'private', - 'set', - 'static', - 'super', - 'this', - 'throw', - 'true', - 'try', - 'typeof', - 'var', - 'virtual', - 'while', - 'yield', - 'switch', - 'case', - 'default', - '/=', - '+=', - '-=', - '*=', - '//', - 'pragma on', - 'pragma off', - 'an identifier', - 'a string', - '{', - '}', - '(', - ')', - '.', - ':', - ',', - '[', - ']', - '|', - '|=', - '&', - '^', - '&=', - '||', - '&&', - ';', - '=', - '++', - '--', - '+', - '-', - '%', - '*', - '==', - '!=', - '?', - '~', - '===', - '!==', - '<', - '<=', - '<<', - '<<=', - '>', - '>=', - '>>', - '>>=', - '@', - '@script', - '@assembly', - 'INPLACE_BITWISE_XOR', - 'NOT', - 'DIVISION', - 'RE_LITERAL', - 'DOUBLE', - 'INT', - 'LONG', - 'SINGLE_QUOTED_STRING', - 'DOUBLE_SUFFIX', - 'EXPONENT', - 'PRAGMA_WHITE_SPACE', - 'WHITE_SPACE', - 'DQS_ESC', - 'SQS_ESC', - 'SESC', - 'ML_COMMENT', - 'RE_CHAR', - 'RE_ESC', - 'NEWLINE', - 'ID_LETTER', - 'DIGIT', - 'HEXDIGIT', - ) - - private static def mk_tokenSet_0_() as (long): - data = (26486543520000L, 0L, ) - return data - public static final tokenSet_0_ = BitSet(mk_tokenSet_0_()) - private static def mk_tokenSet_1_() as (long): - data = (144141674619375872L, 0L, ) - return data - public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) - private static def mk_tokenSet_2_() as (long): - data = (3314913105927882272L, 17179873470468L, 0L, 0L, ) - return data - public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) - private static def mk_tokenSet_3_() as (long): - data = (-4738631237225228430L, 17540646436860L, 0L, 0L, ) - return data - public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) - private static def mk_tokenSet_4_() as (long): - data = (2L, 0L, ) - return data - public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) - private static def mk_tokenSet_5_() as (long): - data = (3423017187437106978L, 17188463405060L, 0L, 0L, ) - return data - public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) - private static def mk_tokenSet_6_() as (long): - data = (144141678981452032L, 0L, ) - return data - public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) - private static def mk_tokenSet_7_() as (long): - data = (26477936541696L, 0L, ) - return data - public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) - private static def mk_tokenSet_8_() as (long): - data = (144141666012397568L, 0L, ) - return data - public static final tokenSet_8_ = BitSet(mk_tokenSet_8_()) - private static def mk_tokenSet_9_() as (long): - data = (17690450497792L, 0L, ) - return data - public static final tokenSet_9_ = BitSet(mk_tokenSet_9_()) - private static def mk_tokenSet_10_() as (long): - data = (144132878526353664L, 0L, ) - return data - public static final tokenSet_10_ = BitSet(mk_tokenSet_10_()) - private static def mk_tokenSet_11_() as (long): - data = (3314930796378117922L, 17188463405060L, 0L, 0L, ) - return data - public static final tokenSet_11_ = BitSet(mk_tokenSet_11_()) - private static def mk_tokenSet_12_() as (long): - data = (3314655235821289472L, 17179873468420L, 0L, 0L, ) - return data - public static final tokenSet_12_ = BitSet(mk_tokenSet_12_()) - private static def mk_tokenSet_13_() as (long): - data = (3314913071567619616L, 17179873468420L, 0L, 0L, ) - return data - public static final tokenSet_13_ = BitSet(mk_tokenSet_13_()) - private static def mk_tokenSet_14_() as (long): - data = (-4737786812295028750L, 17540646436860L, 0L, 0L, ) - return data - public static final tokenSet_14_ = BitSet(mk_tokenSet_14_()) - private static def mk_tokenSet_15_() as (long): - data = (4468696725915164578L, 17188463405060L, 0L, 0L, ) - return data - public static final tokenSet_15_ = BitSet(mk_tokenSet_15_()) - private static def mk_tokenSet_16_() as (long): - data = (-144109277957308336L, 17458773616350L, 0L, 0L, ) - return data - public static final tokenSet_16_ = BitSet(mk_tokenSet_16_()) - private static def mk_tokenSet_17_() as (long): - data = (4611686018427387904L, 2L, 0L, 0L, ) - return data - public static final tokenSet_17_ = BitSet(mk_tokenSet_17_()) - private static def mk_tokenSet_18_() as (long): - data = (2305843009213693952L, 4096L, 0L, 0L, ) - return data - public static final tokenSet_18_ = BitSet(mk_tokenSet_18_()) - private static def mk_tokenSet_19_() as (long): - data = (-126100789572673550L, 17540646436863L, 0L, 0L, ) - return data - public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) - private static def mk_tokenSet_20_() as (long): - data = (144141678981452032L, 8589934592L, 0L, 0L, ) - return data - public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) - private static def mk_tokenSet_21_() as (long): - data = (7926341254248677376L, 17179873468420L, 0L, 0L, ) - return data - public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) - private static def mk_tokenSet_22_() as (long): - data = (3423017191732074274L, 17188463405060L, 0L, 0L, ) - return data - public static final tokenSet_22_ = BitSet(mk_tokenSet_22_()) - private static def mk_tokenSet_23_() as (long): - data = (-18858823443884174L, 17540646436863L, 0L, 0L, ) - return data - public static final tokenSet_23_ = BitSet(mk_tokenSet_23_()) - private static def mk_tokenSet_24_() as (long): - data = (-18014398509490190L, 17540646436863L, 0L, 0L, ) - return data - public static final tokenSet_24_ = BitSet(mk_tokenSet_24_()) - private static def mk_tokenSet_25_() as (long): - data = (8804700000512L, 0L, ) - return data - public static final tokenSet_25_ = BitSet(mk_tokenSet_25_()) - private static def mk_tokenSet_26_() as (long): - data = (4576783121269120930L, 17188463405060L, 0L, 0L, ) - return data - public static final tokenSet_26_ = BitSet(mk_tokenSet_26_()) - private static def mk_tokenSet_27_() as (long): - data = (-18014398513684494L, 17540646436863L, 0L, 0L, ) - return data - public static final tokenSet_27_ = BitSet(mk_tokenSet_27_()) - private static def mk_tokenSet_28_() as (long): - data = (26490905596160L, 8589934592L, 0L, 0L, ) - return data - public static final tokenSet_28_ = BitSet(mk_tokenSet_28_()) - private static def mk_tokenSet_29_() as (long): - data = (26490905596160L, 0L, ) - return data - public static final tokenSet_29_ = BitSet(mk_tokenSet_29_()) - private static def mk_tokenSet_30_() as (long): - data = (144141713341714688L, 0L, ) - return data - public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) - private static def mk_tokenSet_31_() as (long): - data = (144115224583635200L, 0L, ) - return data - public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) - private static def mk_tokenSet_32_() as (long): - data = (4467852305279932194L, 17188463405060L, 0L, 0L, ) - return data - public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) - private static def mk_tokenSet_33_() as (long): - data = (-126100789568479246L, 17540646436863L, 0L, 0L, ) - return data - public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) - private static def mk_tokenSet_34_() as (long): - data = (576460752303423488L, 536870912L, 0L, 0L, ) - return data - public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) - private static def mk_tokenSet_35_() as (long): - data = (1152947995512443136L, 8589934592L, 0L, 0L, ) - return data - public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) - private static def mk_tokenSet_36_() as (long): - data = (1152921504607109120L, 8589934592L, 0L, 0L, ) - return data - public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) - private static def mk_tokenSet_37_() as (long): - data = (9080382748645908386L, 17188463409159L, 0L, 0L, ) - return data - public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) - private static def mk_tokenSet_38_() as (long): - data = (4611686018427387904L, 0L, ) - return data - public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) - private static def mk_tokenSet_39_() as (long): - data = (1152921504606846976L, 2L, 0L, 0L, ) - return data - public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) - private static def mk_tokenSet_40_() as (long): - data = (4468696730210131874L, 17188463405060L, 0L, 0L, ) - return data - public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) - private static def mk_tokenSet_41_() as (long): - data = (4467834610534729248L, 17179873470468L, 0L, 0L, ) - return data - public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) - private static def mk_tokenSet_42_() as (long): - data = (-4755537426278103440L, 17458773618398L, 0L, 0L, ) - return data - public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) - private static def mk_tokenSet_43_() as (long): - data = (144123986316394496L, 0L, ) - return data - public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) - private static def mk_tokenSet_44_() as (long): - data = (144115190231760896L, 0L, ) - return data - public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) - private static def mk_tokenSet_45_() as (long): - data = (3314664031914311680L, 17179873470468L, 0L, 0L, ) - return data - public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) - private static def mk_tokenSet_46_() as (long): - data = (-4738906795634540464L, 17532056502268L, 0L, 0L, ) - return data - public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) - private static def mk_tokenSet_47_() as (long): - data = (-4754675310897668110L, 17467363552988L, 0L, 0L, ) - return data - public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) - private static def mk_tokenSet_48_() as (long): - data = (4468696725923553186L, 17188463409156L, 0L, 0L, ) - return data - public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) - private static def mk_tokenSet_49_() as (long): - data = (9080382744342552482L, 17188463405060L, 0L, 0L, ) - return data - public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) - private static def mk_tokenSet_50_() as (long): - data = (5188146770730811392L, 8L, 0L, 0L, ) - return data - public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) - private static def mk_tokenSet_51_() as (long): - data = (0L, 10L, 0L, 0L, ) - return data - public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) - private static def mk_tokenSet_52_() as (long): - data = (3314655235821289472L, 17179873468421L, 0L, 0L, ) - return data - public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) - private static def mk_tokenSet_53_() as (long): - data = (144115222436118528L, 33554432L, 0L, 0L, ) - return data - public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) - private static def mk_tokenSet_54_() as (long): - data = (41943040L, 1711276032L, 0L, 0L, ) - return data - public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) - private static def mk_tokenSet_55_() as (long): - data = (0L, 26738688L, 0L, 0L, ) - return data - public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) - private static def mk_tokenSet_56_() as (long): - data = (-4755795296384565168L, 17458773616348L, 0L, 0L, ) - return data - public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) - private static def mk_tokenSet_57_() as (long): - data = (3314655235821289472L, 17179873468428L, 0L, 0L, ) - return data - public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) - + + protected def initialize(): + tokenNames = tokenNames_ + + + protected def constructor(tokenBuf as TokenBuffer, k as int): + super(tokenBuf, k) + initialize() + + def constructor(tokenBuf as TokenBuffer): + self(tokenBuf, 2) + + protected def constructor(lexer as TokenStream, k as int): + super(lexer, k) + initialize() + + public def constructor(lexer as TokenStream): + self(lexer, 2) + + public def constructor(state as ParserSharedInputState): + super(state, 2) + initialize() + + public def start( + cu as CompileUnit + ) as void: //throws RecognitionException, TokenStreamException + + eof as IToken = null + module = Module(LexicalInfo(getFilename(), 1, 1)) + module.Name = CreateModuleName(getFilename()) + cu.Modules.Add(module) + globals = module.Globals + + try: // for error handling + while true: + _givenValue = LA(1) + if ((_givenValue == IMPORT)): // 1831 + import_directive(module) + elif ((_givenValue == PRAGMA_ON) + or (_givenValue ==PRAGMA_OFF) + ): // 1827 + pragma_directive(module) + else: // line 1969 + synPredMatched4 as bool = false + if ((LA(1)==AT) and (LA(2)==ID)): + _m4 as int = mark() + synPredMatched4 = true + ++inputState.guessing + try: + match(AT) + match(ID) + match(ID) + except x as RecognitionException: + synPredMatched4 = false + rewind(_m4) + --inputState.guessing + if synPredMatched4: + script_or_assembly_attribute(module) + else: + goto _loop5_breakloop + :_loop5_breakloop + while true: + synPredMatched8 as bool = false + if ((LA(1)==AT) and (LA(2)==ID)): + _m8 as int = mark() + synPredMatched8 = true + ++inputState.guessing + try: + match(AT) + match(ID) + match(ID) + except x as RecognitionException: + synPredMatched8 = false + rewind(_m8) + --inputState.guessing + if synPredMatched8: + script_or_assembly_attribute(module) + elif ((LA(1)==AT) and (LA(2)==ID)): // line 2102 + attributes() + module_member(module) + elif ((tokenSet_0_.member(cast(int, LA(1)))) and (tokenSet_1_.member(cast(int, LA(2))))): // line 2102 + module_member(module) + elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_3_.member(cast(int, LA(2))))): // line 2102 + statement(globals) + else: + goto _loop10_breakloop + :_loop10_breakloop + eof = LT(1) + match(Token.EOF_TYPE) + if 0 == inputState.guessing: + SetEndSourceLocation(module, eof) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_4_) + else: + raise + + public def import_directive( + container as Module + ) as void: //throws RecognitionException, TokenStreamException + + imp as IToken = null + + try: // for error handling + imp = LT(1) + match(IMPORT) + ns=qname() + eos() + if 0 == inputState.guessing: + container.Imports.Add( + Import(ToLexicalInfo(imp), ReferenceExpression(ToLexicalInfo(ns), ns.getText()))) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_5_) + else: + raise + + public def pragma_directive( + container as Module + ) as void: //throws RecognitionException, TokenStreamException + + on as IToken = null + off as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == PRAGMA_ON)): // 1831 + on = LT(1) + match(PRAGMA_ON) + if 0 == inputState.guessing: + id=on + elif ((_givenValue == PRAGMA_OFF)): // 1831 + off = LT(1) + match(PRAGMA_OFF) + if 0 == inputState.guessing: + id=off + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + pragma = id.getText() + if Pragmas.IsValid(pragma): + if on is not null: + Pragmas.TryToEnableOn(container, pragma) + else: + Pragmas.DisableOn(container, pragma) + else: + ReportError(UnityScriptCompilerErrors.UnknownPragma(ToLexicalInfo(id), pragma)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_5_) + else: + raise + + public def script_or_assembly_attribute( + m as Module + ) as void: //throws RecognitionException, TokenStreamException + + attributeKindToken as IToken = null + + try: // for error handling + match(AT) + attributeKindToken = LT(1) + match(ID) + attr=attribute_constructor() + if 0 == inputState.guessing: + attributeKind = attributeKindToken.getText() + if attributeKind == "assembly": + m.AssemblyAttributes.Add(attr) + elif attributeKind == "script": + m.Attributes.Add(attr) + else: + UnexpectedToken(attributeKindToken) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_5_) + else: + raise + + public def attributes() as void: //throws RecognitionException, TokenStreamException + + _attributes.Clear() + + try: // for error handling + _cnt18 as int = 0 + while true: + if ((LA(1)==AT)): + attribute() + else: + if (_cnt18 >= 1): + goto _loop18_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) + ++_cnt18 + :_loop18_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_6_) + else: + raise + + public def module_member( + module as Module + ) as void: //throws RecognitionException, TokenStreamException + + globals = module.Globals + + try: // for error handling + synPredMatched27 as bool = false + if (((tokenSet_7_.member(cast(int, LA(1)))) and (tokenSet_8_.member(cast(int, LA(2))))) and (GlobalVariablesBecomeFields())): + _m27 as int = mark() + synPredMatched27 = true + ++inputState.guessing + try: + module_member_modifiers() + match(VAR) + except x as RecognitionException: + synPredMatched27 = false + rewind(_m27) + --inputState.guessing + if synPredMatched27: + module_field(module) + elif ((LA(1)==VAR) and (LA(2)==FINAL or LA(2)==INTERNAL or LA(2)==ID)): // line 2102 + declaration_statement(globals) + eos() + elif ((tokenSet_9_.member(cast(int, LA(1)))) and (tokenSet_10_.member(cast(int, LA(2))))): // line 2102 + mod=module_member_modifiers() + _givenValue = LA(1) + if ((_givenValue == CLASS) + or (_givenValue ==PARTIAL) + ): // 1827 + mm=class_declaration(module) + elif ((_givenValue == INTERFACE)): // 1831 + mm=interface_declaration(module) + elif ((_givenValue == ENUM)): // 1831 + mm=enum_declaration(module) + elif ((_givenValue == FUNCTION)): // 1831 + mm=function_member(module) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + mm.Modifiers |= mod if mm is not null + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_11_) + else: + raise + + public def statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + synPredMatched107 as bool = false + if ((LA(1)==GET or LA(1)==SET or LA(1)==ID) and (tokenSet_12_.member(cast(int, LA(2))))): + _m107 as int = mark() + synPredMatched107 = true + ++inputState.guessing + try: + macro_application_test() + except x as RecognitionException: + synPredMatched107 = false + rewind(_m107) + --inputState.guessing + if synPredMatched107: + macro_application_block(b) + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + builtin_statement(b) + elif ((LA(1)==EOS)): // line 2102 + _cnt109 as int = 0 + while true: + if ((LA(1)==EOS) and (tokenSet_15_.member(cast(int, LA(2))))): + match(EOS) + else: + if (_cnt109 >= 1): + goto _loop109_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) + ++_cnt109 + :_loop109_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def attribute_parameter( + attr as Ast.Attribute + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + synPredMatched13 as bool = false + if ((LA(1)==ID) and (LA(2)==DOT or LA(2)==ASSIGN)): + _m13 as int = mark() + synPredMatched13 = true + ++inputState.guessing + try: + match(ID) + match(ASSIGN) + except x as RecognitionException: + synPredMatched13 = false + rewind(_m13) + --inputState.guessing + if synPredMatched13: + name=reference_expression() + match(ASSIGN) + value=expression() + if 0 == inputState.guessing: + attr.NamedArguments.Add(ExpressionPair(name, value)) + elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 + value=expression() + if 0 == inputState.guessing: + attr.Arguments.Add(value) + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_17_) + else: + raise + + public def reference_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + e=simple_reference_expression() + while true: + if ((LA(1)==DOT)): + match(DOT) + e=member_reference_expression(e) + else: + goto _loop207_breakloop + :_loop207_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_18_) + else: + raise + return e + + public def expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + e=conditional_expression() + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def attribute() as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + match(AT) + attr=attribute_constructor() + if 0 == inputState.guessing: + _attributes.Add(attr) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_20_) + else: + raise + + public def attribute_constructor() as Boo.Lang.Compiler.Ast.Attribute : //throws RecognitionException, TokenStreamException + attr as Boo.Lang.Compiler.Ast.Attribute + + + try: // for error handling + name=qname() + if 0 == inputState.guessing: + attr = Ast.Attribute(ToLexicalInfo(name), name.getText()) + if ((LA(1)==LPAREN) and (tokenSet_21_.member(cast(int, LA(2))))): + match(LPAREN) + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + attribute_parameter(attr) + while true: + if ((LA(1)==COMMA)): + match(COMMA) + attribute_parameter(attr) + else: + goto _loop24_breakloop + :_loop24_breakloop + elif ((_givenValue == RPAREN)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RPAREN) + elif ((tokenSet_22_.member(cast(int, LA(1)))) and (tokenSet_23_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_22_) + else: + raise + return attr + + public def qname() as Token : //throws RecognitionException, TokenStreamException + id as Token + + start as IToken = null + other as IToken = null + + try: // for error handling + start = LT(1) + match(ID) + if 0 == inputState.guessing: + id = start + buffer = StringBuilder() + buffer.Append(start.getText()) + while true: + if ((LA(1)==DOT) and (LA(2)==ID)): + match(DOT) + other = LT(1) + match(ID) + if 0 == inputState.guessing: + buffer.Append(".") + buffer.Append(other.getText()) + else: + goto _loop35_breakloop + :_loop35_breakloop + if 0 == inputState.guessing: + id.setText(buffer.ToString()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_24_) + else: + raise + return id + + public def module_member_modifiers() as TypeMemberModifiers : //throws RecognitionException, TokenStreamException + m as TypeMemberModifiers + + v as IToken = null + m = TypeMemberModifiers.None + + try: // for error handling + while true: + _givenValue = LA(1) + if ((_givenValue == FINAL)): // 1831 + match(FINAL) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Final + elif ((_givenValue == PUBLIC)): // 1831 + match(PUBLIC) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Public + elif ((_givenValue == PRIVATE)): // 1831 + match(PRIVATE) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Private + elif ((_givenValue == PROTECTED)): // 1831 + match(PROTECTED) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Protected + elif ((_givenValue == INTERNAL)): // 1831 + match(INTERNAL) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Internal + elif ((_givenValue == STATIC)): // 1831 + match(STATIC) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Static + elif ((_givenValue == VIRTUAL)): // 1831 + v = LT(1) + match(VIRTUAL) + if 0 == inputState.guessing: + VirtualKeywordHasNoEffect(v) + else: // line 1969 + goto _loop45_breakloop + :_loop45_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_25_) + else: + raise + return m + + public def module_field( + m as Module + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + mod=module_member_modifiers() + f=field_member(m) + if 0 == inputState.guessing: + f.Modifiers |= mod + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_11_) + else: + raise + + public def declaration_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + d=declaration() + _givenValue = LA(1) + if ((_givenValue == ASSIGN)): // 1831 + match(ASSIGN) + i=expression() + elif ((_givenValue == EOF) + or (_givenValue ==BREAK) + or (_givenValue ==CATCH) + or (_givenValue ==CLASS) + or (_givenValue ==CONTINUE) + or (_givenValue ==DO) + or (_givenValue ==ELSE) + or (_givenValue ==ENUM) + or (_givenValue ==FALSE) + or (_givenValue ==FINAL) + or (_givenValue ==FINALLY) + or (_givenValue ==FOR) + or (_givenValue ==FUNCTION) + or (_givenValue ==GET) + or (_givenValue ==IF) + or (_givenValue ==INTERFACE) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==RETURN) + or (_givenValue ==PUBLIC) + or (_givenValue ==PROTECTED) + or (_givenValue ==INTERNAL) + or (_givenValue ==PARTIAL) + or (_givenValue ==PRIVATE) + or (_givenValue ==SET) + or (_givenValue ==STATIC) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==THROW) + or (_givenValue ==TRUE) + or (_givenValue ==TRY) + or (_givenValue ==TYPEOF) + or (_givenValue ==VAR) + or (_givenValue ==VIRTUAL) + or (_givenValue ==WHILE) + or (_givenValue ==YIELD) + or (_givenValue ==SWITCH) + or (_givenValue ==CASE) + or (_givenValue ==DEFAULT) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==RBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==EOS) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==AT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + stmt = DeclarationStatement(d.LexicalInfo, Declaration: d, Initializer: i) + b.Add(stmt) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def eos() as antlr.IToken : //throws RecognitionException, TokenStreamException + firstEOS as antlr.IToken + + t as IToken = null + + try: // for error handling + if ((LA(1)==EOS) and (tokenSet_26_.member(cast(int, LA(2))))): + _cnt42 as int = 0 + while true: + if ((LA(1)==EOS) and (tokenSet_26_.member(cast(int, LA(2))))): + t = LT(1) + match(EOS) + if 0 == inputState.guessing: + if firstEOS is null: firstEOS = t + else: + if (_cnt42 >= 1): + goto _loop42_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) + ++_cnt42 + :_loop42_breakloop + elif ((tokenSet_26_.member(cast(int, LA(1)))) and (tokenSet_27_.member(cast(int, LA(2))))): // line 2102 + if 0 == inputState.guessing: + SemicolonExpected() + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_26_) + else: + raise + return firstEOS + + public def class_declaration( + parent as TypeDefinition + ) as TypeMember : //throws RecognitionException, TokenStreamException + member as TypeMember + + p as IToken = null + name as IToken = null + rbrace as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == PARTIAL)): // 1831 + p = LT(1) + match(PARTIAL) + elif ((_givenValue == CLASS)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(CLASS) + name = LT(1) + match(ID) + _givenValue = LA(1) + if ((_givenValue == EXTENDS)): // 1831 + match(EXTENDS) + baseType=type_reference() + elif ((_givenValue == IMPLEMENTS) + or (_givenValue ==LBRACE) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + member = cd = ClassDefinition(ToLexicalInfo(name), Name: name.getText()) + baseTypes = cd.BaseTypes + if baseType is not null: + baseTypes.Add(baseType) + cd.Modifiers |= TypeMemberModifiers.Partial if p is not null + FlushAttributes(cd) + parent.Members.Add(cd) + _givenValue = LA(1) + if ((_givenValue == IMPLEMENTS)): // 1831 + match(IMPLEMENTS) + type_reference_list(baseTypes) + elif ((_givenValue == LBRACE)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + for typeRef in baseTypes: + if typeRef is baseType: + BaseTypeAnnotations.AnnotateExtends(typeRef) + else: + BaseTypeAnnotations.AnnotateImplements(typeRef) + match(LBRACE) + while true: + if ((tokenSet_28_.member(cast(int, LA(1))))): + if 0 == inputState.guessing: + mod = TypeMemberModifiers.None + _givenValue = LA(1) + if ((_givenValue == AT)): // 1831 + attributes() + elif ((_givenValue == CLASS) + or (_givenValue ==ENUM) + or (_givenValue ==FINAL) + or (_givenValue ==FUNCTION) + or (_givenValue ==INTERFACE) + or (_givenValue ==NEW) + or (_givenValue ==PUBLIC) + or (_givenValue ==PROTECTED) + or (_givenValue ==INTERNAL) + or (_givenValue ==OVERRIDE) + or (_givenValue ==PARTIAL) + or (_givenValue ==PRIVATE) + or (_givenValue ==STATIC) + or (_givenValue ==VAR) + or (_givenValue ==VIRTUAL) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_30_.member(cast(int, LA(2))))): + mod=member_modifiers() + elif ((tokenSet_25_.member(cast(int, LA(1)))) and (tokenSet_31_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + _givenValue = LA(1) + if ((_givenValue == FUNCTION)): // 1831 + m=function_member(cd) + elif ((_givenValue == VAR)): // 1831 + m=field_member(cd) + elif ((_givenValue == ENUM)): // 1831 + m=enum_declaration(cd) + elif ((_givenValue == CLASS) + or (_givenValue ==PARTIAL) + ): // 1827 + m=class_declaration(cd) + elif ((_givenValue == INTERFACE)): // 1831 + m=interface_declaration(cd) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + m.Modifiers |= mod if m is not null + else: + goto _loop57_breakloop + :_loop57_breakloop + rbrace = LT(1) + match(RBRACE) + if 0 == inputState.guessing: + SetEndSourceLocation(cd, rbrace) + while true: + if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): + match(EOS) + else: + goto _loop59_breakloop + :_loop59_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + return member + + public def interface_declaration( + parent as TypeDefinition + ) as TypeMember : //throws RecognitionException, TokenStreamException + member as TypeMember + + name as IToken = null + rbrace as IToken = null + + try: // for error handling + match(INTERFACE) + name = LT(1) + match(ID) + if 0 == inputState.guessing: + member = td = InterfaceDefinition(ToLexicalInfo(name), Name: name.getText()) + baseTypes = td.BaseTypes + FlushAttributes(td) + parent.Members.Add(td) + _givenValue = LA(1) + if ((_givenValue == EXTENDS)): // 1831 + match(EXTENDS) + type_reference_list(baseTypes) + elif ((_givenValue == LBRACE)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(LBRACE) + while true: + if ((LA(1)==FUNCTION or LA(1)==AT)): + _givenValue = LA(1) + if ((_givenValue == AT)): // 1831 + attributes() + elif ((_givenValue == FUNCTION)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + interface_member(td) + else: + goto _loop64_breakloop + :_loop64_breakloop + rbrace = LT(1) + match(RBRACE) + if 0 == inputState.guessing: + SetEndSourceLocation(td, rbrace) + while true: + if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): + match(EOS) + else: + goto _loop66_breakloop + :_loop66_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + return member + + public def enum_declaration( + container as TypeDefinition + ) as TypeMember : //throws RecognitionException, TokenStreamException + member as TypeMember + + name as IToken = null + rbrace as IToken = null + + try: // for error handling + match(ENUM) + name = LT(1) + match(ID) + if 0 == inputState.guessing: + member = ed = EnumDefinition(ToLexicalInfo(name), Name: name.getText()) + FlushAttributes(member); + container.Members.Add(ed) + match(LBRACE) + _givenValue = LA(1) + if ((_givenValue == ID) + or (_givenValue ==AT) + ): // 1827 + enum_member(ed) + while true: + if ((LA(1)==COMMA) and (LA(2)==ID or LA(2)==AT)): + match(COMMA) + enum_member(ed) + else: + goto _loop76_breakloop + :_loop76_breakloop + _givenValue = LA(1) + if ((_givenValue == COMMA)): // 1831 + match(COMMA) + elif ((_givenValue == RBRACE)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + elif ((_givenValue == RBRACE)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + rbrace = LT(1) + match(RBRACE) + if 0 == inputState.guessing: + SetEndSourceLocation(ed, rbrace) + while true: + if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): + match(EOS) + else: + goto _loop79_breakloop + :_loop79_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + return member + + public def function_member( + cd as TypeDefinition + ) as TypeMember : //throws RecognitionException, TokenStreamException + member as TypeMember + + getter as IToken = null + setter as IToken = null + + try: // for error handling + match(FUNCTION) + _givenValue = LA(1) + if ((_givenValue == GET)): // 1831 + getter = LT(1) + match(GET) + elif ((_givenValue == SET)): // 1831 + setter = LT(1) + match(SET) + elif ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + memberName=identifier() + if 0 == inputState.guessing: + member = function = AddFunctionTo(cd, memberName, getter, setter) + function_body(function) + if 0 == inputState.guessing: + ValidateFunctionDeclaration(function, getter, setter) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + return member + + public def field_member( + cd as TypeDefinition + ) as TypeMember : //throws RecognitionException, TokenStreamException + member as TypeMember + + + try: // for error handling + match(VAR) + name=identifier() + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + elif ((_givenValue == EOF) + or (_givenValue ==BREAK) + or (_givenValue ==CLASS) + or (_givenValue ==CONTINUE) + or (_givenValue ==DO) + or (_givenValue ==ENUM) + or (_givenValue ==FALSE) + or (_givenValue ==FINAL) + or (_givenValue ==FOR) + or (_givenValue ==FUNCTION) + or (_givenValue ==GET) + or (_givenValue ==IF) + or (_givenValue ==INTERFACE) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==RETURN) + or (_givenValue ==PUBLIC) + or (_givenValue ==PROTECTED) + or (_givenValue ==INTERNAL) + or (_givenValue ==OVERRIDE) + or (_givenValue ==PARTIAL) + or (_givenValue ==PRIVATE) + or (_givenValue ==SET) + or (_givenValue ==STATIC) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==THROW) + or (_givenValue ==TRUE) + or (_givenValue ==TRY) + or (_givenValue ==TYPEOF) + or (_givenValue ==VAR) + or (_givenValue ==VIRTUAL) + or (_givenValue ==WHILE) + or (_givenValue ==YIELD) + or (_givenValue ==SWITCH) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==RBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==EOS) + or (_givenValue ==ASSIGN) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==AT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + _givenValue = LA(1) + if ((_givenValue == ASSIGN)): // 1831 + match(ASSIGN) + initializer=expression() + elif ((_givenValue == EOF) + or (_givenValue ==BREAK) + or (_givenValue ==CLASS) + or (_givenValue ==CONTINUE) + or (_givenValue ==DO) + or (_givenValue ==ENUM) + or (_givenValue ==FALSE) + or (_givenValue ==FINAL) + or (_givenValue ==FOR) + or (_givenValue ==FUNCTION) + or (_givenValue ==GET) + or (_givenValue ==IF) + or (_givenValue ==INTERFACE) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==RETURN) + or (_givenValue ==PUBLIC) + or (_givenValue ==PROTECTED) + or (_givenValue ==INTERNAL) + or (_givenValue ==OVERRIDE) + or (_givenValue ==PARTIAL) + or (_givenValue ==PRIVATE) + or (_givenValue ==SET) + or (_givenValue ==STATIC) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==THROW) + or (_givenValue ==TRUE) + or (_givenValue ==TRY) + or (_givenValue ==TYPEOF) + or (_givenValue ==VAR) + or (_givenValue ==VIRTUAL) + or (_givenValue ==WHILE) + or (_givenValue ==YIELD) + or (_givenValue ==SWITCH) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==RBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==EOS) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==AT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + finalToken=eos() + if 0 == inputState.guessing: + member = Field(ToLexicalInfo(name), + Name: name.getText(), + Type: tr, + Initializer: initializer) + if finalToken is not null: SetEndSourceLocation(member, finalToken) + FlushAttributes(member) + cd.Members.Add(member) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + return member + + public def member_modifiers() as TypeMemberModifiers : //throws RecognitionException, TokenStreamException + m as TypeMemberModifiers + + v as IToken = null + m = TypeMemberModifiers.None + + try: // for error handling + while true: + _givenValue = LA(1) + if ((_givenValue == FINAL)): // 1831 + match(FINAL) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Final + elif ((_givenValue == OVERRIDE)): // 1831 + match(OVERRIDE) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Override + elif ((_givenValue == PUBLIC)): // 1831 + match(PUBLIC) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Public + elif ((_givenValue == PRIVATE)): // 1831 + match(PRIVATE) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Private + elif ((_givenValue == PROTECTED)): // 1831 + match(PROTECTED) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Protected + elif ((_givenValue == INTERNAL)): // 1831 + match(INTERNAL) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Internal + elif ((_givenValue == STATIC)): // 1831 + match(STATIC) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.Static + elif ((_givenValue == NEW)): // 1831 + match(NEW) + if 0 == inputState.guessing: + m |= TypeMemberModifiers.New + elif ((_givenValue == VIRTUAL)): // 1831 + v = LT(1) + match(VIRTUAL) + if 0 == inputState.guessing: + VirtualKeywordHasNoEffect(v) + else: // line 1969 + goto _loop48_breakloop + :_loop48_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_25_) + else: + raise + return m + + public def type_reference() as TypeReference : //throws RecognitionException, TokenStreamException + tr as TypeReference + + lbrack as IToken = null + rank = 1 + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + tr=simple_type_reference() + elif ((_givenValue == FUNCTION)): // 1831 + tr=anonymous_function_type() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if ((LA(1)==LBRACK) and (LA(2)==COMMA or LA(2)==RBRACK)): + lbrack = LT(1) + match(LBRACK) + while true: + if ((LA(1)==COMMA)): + match(COMMA) + if 0 == inputState.guessing: + ++rank + else: + goto _loop176_breakloop + :_loop176_breakloop + match(RBRACK) + if 0 == inputState.guessing: + tr = ArrayTypeReference(tr.LexicalInfo, tr, IntegerLiteralExpression(ToLexicalInfo(lbrack), rank)) + elif ((tokenSet_33_.member(cast(int, LA(1)))) and (tokenSet_24_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_33_) + else: + raise + return tr + + public def type_reference_list( + typeReferences as TypeReferenceCollection + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + tr=type_reference() + if 0 == inputState.guessing: + typeReferences.Add(tr) + while true: + if ((LA(1)==COMMA)): + match(COMMA) + tr=type_reference() + if 0 == inputState.guessing: + typeReferences.Add(tr) + else: + goto _loop192_breakloop + :_loop192_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_34_) + else: + raise + + public def interface_member( + parent as TypeDefinition + ) as void: //throws RecognitionException, TokenStreamException + + getter as IToken = null + setter as IToken = null + + try: // for error handling + match(FUNCTION) + _givenValue = LA(1) + if ((_givenValue == GET)): // 1831 + getter = LT(1) + match(GET) + elif ((_givenValue == SET)): // 1831 + setter = LT(1) + match(SET) + elif ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + memberName=identifier() + if 0 == inputState.guessing: + function = AddFunctionTo(parent, memberName, getter, setter) + match(LPAREN) + _givenValue = LA(1) + if ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) + or (_givenValue ==AT) + ): // 1827 + parameter_declaration_list(function) + elif ((_givenValue == RPAREN)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RPAREN) + if 0 == inputState.guessing: + ValidateFunctionDeclaration(function, getter, setter) + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + if 0 == inputState.guessing: + function.ReturnType = tr; + elif ((_givenValue == FUNCTION) + or (_givenValue ==RBRACE) + or (_givenValue ==EOS) + or (_givenValue ==AT) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + while true: + if ((LA(1)==EOS)): + match(EOS) + else: + goto _loop72_breakloop + :_loop72_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_35_) + else: + raise + + public def identifier() as antlr.IToken : //throws RecognitionException, TokenStreamException + token as antlr.IToken + + name as IToken = null + f as IToken = null + i as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + name = LT(1) + match(ID) + if 0 == inputState.guessing: + token = name; + elif ((_givenValue == FINAL)): // 1831 + f = LT(1) + match(FINAL) + if 0 == inputState.guessing: + token = f; KeywordCannotBeUsedAsAnIdentifier(token); + elif ((_givenValue == INTERNAL)): // 1831 + i = LT(1) + match(INTERNAL) + if 0 == inputState.guessing: + token = i; KeywordCannotBeUsedAsAnIdentifier(token); + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_36_) + else: + raise + return token + + public def parameter_declaration_list( + m as INodeWithParameters + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + parameter_declaration(m) + while true: + if ((LA(1)==COMMA)): + match(COMMA) + parameter_declaration(m) + else: + goto _loop94_breakloop + :_loop94_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_37_) + else: + raise + + public def enum_member( + container as EnumDefinition + ) as void: //throws RecognitionException, TokenStreamException + + name as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == AT)): // 1831 + attributes() + elif ((_givenValue == ID)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + name = LT(1) + match(ID) + _givenValue = LA(1) + if ((_givenValue == ASSIGN)): // 1831 + match(ASSIGN) + initializer=integer_literal() + elif ((_givenValue == RBRACE) + or (_givenValue ==COMMA) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + em = EnumMember(ToLexicalInfo(name), Name: name.getText(), Initializer: initializer) + FlushAttributes(em) + container.Members.Add(em) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_38_) + else: + raise + + public def integer_literal() as IntegerLiteralExpression : //throws RecognitionException, TokenStreamException + e as IntegerLiteralExpression + + i as IToken = null + l as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == INT)): // 1831 + i = LT(1) + match(INT) + if 0 == inputState.guessing: + e = ParseIntegerLiteralExpression(i, i.getText(), false); + elif ((_givenValue == LONG)): // 1831 + l = LT(1) + match(LONG) + if 0 == inputState.guessing: + s = l.getText() + e = ParseIntegerLiteralExpression(l, s[:-1], true) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def function_body( + method as Method + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + match(LPAREN) + _givenValue = LA(1) + if ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) + or (_givenValue ==AT) + ): // 1827 + parameter_declaration_list(method) + elif ((_givenValue == RPAREN)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RPAREN) + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + if 0 == inputState.guessing: + method.ReturnType = tr; + elif ((_givenValue == LBRACE)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + compound_statement(method.Body) + if 0 == inputState.guessing: + method.EndSourceLocation = method.Body.EndSourceLocation + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_32_) + else: + raise + + public def compound_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + block(b) + while true: + if ((LA(1)==EOS) and (tokenSet_39_.member(cast(int, LA(2))))): + match(EOS) + else: + goto _loop101_breakloop + :_loop101_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_39_) + else: + raise + + public def parameter_declaration( + m as INodeWithParameters + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == AT)): // 1831 + attributes() + elif ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + id=identifier() + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + elif ((_givenValue == RPAREN) + or (_givenValue ==COMMA) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + parameter = ParameterDeclaration(ToLexicalInfo(id), Name: id.getText(), Type: tr) + m.Parameters.Add(parameter) + FlushAttributes(parameter) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_17_) + else: + raise + + public def compound_or_single_stmt( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + if ((LA(1)==LBRACE) and (tokenSet_40_.member(cast(int, LA(2))))): + compound_statement(b) + elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + statement(b) + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def block( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + rbrace as IToken = null + + try: // for error handling + match(LBRACE) + while true: + if ((tokenSet_2_.member(cast(int, LA(1))))): + statement(b) + else: + goto _loop104_breakloop + :_loop104_breakloop + rbrace = LT(1) + match(RBRACE) + if 0 == inputState.guessing: + SetEndSourceLocation(b, rbrace) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + + public def macro_application_test() as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + if ((LA(1)==GET or LA(1)==SET or LA(1)==ID) and (LA(2)==LBRACE)): + member() + match(LBRACE) + elif ((LA(1)==GET or LA(1)==SET or LA(1)==ID) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + member() + expression_list(null) + match(LBRACE) + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_4_) + else: + raise + + public def macro_application_block( + container as Block + ) as void: //throws RecognitionException, TokenStreamException + + m = MacroStatement() + args = m.Arguments + b = m.Body + + try: // for error handling + macroName=member() + synPredMatched145 as bool = false + if ((LA(1)==LBRACE) and (tokenSet_40_.member(cast(int, LA(2))))): + _m145 as int = mark() + synPredMatched145 = true + ++inputState.guessing + try: + match(LBRACE) + except x as RecognitionException: + synPredMatched145 = false + rewind(_m145) + --inputState.guessing + if synPredMatched145: + compound_statement(b) + elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 + expression_list(args) + compound_statement(b) + else: + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + m.LexicalInfo = ToLexicalInfo(macroName) + m.Name = macroName.getText() + container.Add(m) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def builtin_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == DO) + or (_givenValue ==FOR) + or (_givenValue ==IF) + or (_givenValue ==TRY) + or (_givenValue ==WHILE) + or (_givenValue ==SWITCH) + ): // 1827 + _givenValue = LA(1) + if ((_givenValue == DO)): // 1831 + do_while_statement(b) + elif ((_givenValue == WHILE)): // 1831 + while_statement(b) + elif ((_givenValue == FOR)): // 1831 + for_statement(b) + elif ((_givenValue == IF)): // 1831 + if_statement(b) + elif ((_givenValue == TRY)): // 1831 + try_statement(b) + elif ((_givenValue == SWITCH)): // 1831 + switch_statement(b) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + elif ((_givenValue == BREAK) + or (_givenValue ==CONTINUE) + or (_givenValue ==FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==RETURN) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==THROW) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==VAR) + or (_givenValue ==YIELD) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + expression_statement(b) + elif ((_givenValue == YIELD)): // 1831 + yield_statement(b) + elif ((_givenValue == RETURN)): // 1831 + return_statement(b) + elif ((_givenValue == BREAK)): // 1831 + break_statement(b) + elif ((_givenValue == CONTINUE)): // 1831 + continue_statement(b) + elif ((_givenValue == THROW)): // 1831 + throw_statement(b) + elif ((_givenValue == VAR)): // 1831 + declaration_statement(b) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + eos() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def do_while_statement( + container as Block + ) as void: //throws RecognitionException, TokenStreamException + + d as IToken = null + w as IToken = null + + try: // for error handling + d = LT(1) + match(DO) + if 0 == inputState.guessing: + ws = WhileStatement(ToLexicalInfo(d), Condition: BoolLiteralExpression(true)) + b = ws.Block + container.Add(ws) + EnterLoop(ws) + block(b) + w = LT(1) + match(WHILE) + e=paren_expression() + eos() + if 0 == inputState.guessing: + b.Add(BreakStatement(ToLexicalInfo(w), Modifier: StatementModifier(StatementModifierType.Unless, e))) + LeaveLoop(ws) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def while_statement( + container as Block + ) as void: //throws RecognitionException, TokenStreamException + + w as IToken = null + + try: // for error handling + w = LT(1) + match(WHILE) + e=paren_expression() + if 0 == inputState.guessing: + ws = WhileStatement(ToLexicalInfo(w), Condition: e) + b = ws.Block + container.Add(ws) + EnterLoop(ws) + compound_or_single_stmt(b) + if 0 == inputState.guessing: + LeaveLoop(ws) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def for_statement( + container as Block + ) as void: //throws RecognitionException, TokenStreamException + + f as IToken = null + + try: // for error handling + f = LT(1) + match(FOR) + match(LPAREN) + synPredMatched129 as bool = false + if ((tokenSet_42_.member(cast(int, LA(1)))) and (tokenSet_43_.member(cast(int, LA(2))))): + _m129 as int = mark() + synPredMatched129 = true + ++inputState.guessing + try: + _givenValue = LA(1) + if ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) + ): // 1827 + identifier() + elif ((_givenValue == VAR)): // 1831 + declaration() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(IN) + except x as RecognitionException: + synPredMatched129 = false + rewind(_m129) + --inputState.guessing + if synPredMatched129: + stmt=for_in(container) + elif ((tokenSet_44_.member(cast(int, LA(1)))) and (tokenSet_45_.member(cast(int, LA(2))))): // line 2102 + stmt=for_c(container) + else: + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + stmt.LexicalInfo = ToLexicalInfo(f) if stmt is not null + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def if_statement( + container as Block + ) as void: //throws RecognitionException, TokenStreamException + + it as IToken = null + et as IToken = null + + try: // for error handling + it = LT(1) + match(IF) + e=paren_expression() + if 0 == inputState.guessing: + s = IfStatement(ToLexicalInfo(it), Condition: e) + b = s.TrueBlock = Block() + container.Add(s) + compound_or_single_stmt(b) + if ((LA(1)==ELSE) and (tokenSet_2_.member(cast(int, LA(2))))): + et = LT(1) + match(ELSE) + if 0 == inputState.guessing: + b = s.FalseBlock = Block(ToLexicalInfo(et)) + compound_or_single_stmt(b) + elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def try_statement( + container as Block + ) as void: //throws RecognitionException, TokenStreamException + + tt as IToken = null + ct as IToken = null + id as IToken = null + + try: // for error handling + tt = LT(1) + match(TRY) + if 0 == inputState.guessing: + s = TryStatement(ToLexicalInfo(tt)) + b = s.ProtectedBlock + container.Add(s) + compound_or_single_stmt(b) + while true: + if ((LA(1)==CATCH) and (LA(2)==LPAREN)): + ct = LT(1) + match(CATCH) + match(LPAREN) + id = LT(1) + match(ID) + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + elif ((_givenValue == RPAREN)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RPAREN) + if 0 == inputState.guessing: + tr = SimpleTypeReference(ToLexicalInfo(id), "System.Exception") if tr is null + handler = ExceptionHandler( + ToLexicalInfo(ct), + Declaration: Declaration(ToLexicalInfo(id), Name: id.getText(), Type: tr)) + s.ExceptionHandlers.Add(handler) + b = handler.Block + tr = null + compound_or_single_stmt(b) + else: + goto _loop164_breakloop + :_loop164_breakloop + if ((LA(1)==FINALLY) and (tokenSet_2_.member(cast(int, LA(2))))): + finally_block(s) + elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def switch_statement( + container as Block + ) as void: //throws RecognitionException, TokenStreamException + + s as IToken = null + c as IToken = null + fallthrough as IToken = null + d as IToken = null + + try: // for error handling + s = LT(1) + match(SWITCH) + e=paren_expression() + if 0 == inputState.guessing: + switchMacro = MacroStatement(ToLexicalInfo(s), Name: MacroName(s.getText())) + switchMacro.Arguments.Add(e) + switchBlock = switchMacro.Body + container.Add(switchMacro) + match(LBRACE) + while true: + if ((LA(1)==CASE)): + c = LT(1) + match(CASE) + e=expression() + match(COLON) + if 0 == inputState.guessing: + item = MacroStatement(ToLexicalInfo(c), Name: c.getText()) + item.Arguments.Add(e) + itemBlock = item.Body + switchBlock.Add(item) + while true: + if ((LA(1)==CASE)): + fallthrough = LT(1) + match(CASE) + e=expression() + match(COLON) + if 0 == inputState.guessing: + item.Arguments.Add(e); + else: + goto _loop152_breakloop + :_loop152_breakloop + _cnt154 as int = 0 + while true: + if ((tokenSet_2_.member(cast(int, LA(1))))): + statement(itemBlock) + else: + if (_cnt154 >= 1): + goto _loop154_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) + ++_cnt154 + :_loop154_breakloop + else: + goto _loop155_breakloop + :_loop155_breakloop + _givenValue = LA(1) + if ((_givenValue == DEFAULT)): // 1831 + d = LT(1) + match(DEFAULT) + match(COLON) + if 0 == inputState.guessing: + item = MacroStatement(ToLexicalInfo(d), Name: d.getText()) + itemBlock = item.Body + switchBlock.Add(item) + _cnt158 as int = 0 + while true: + if ((tokenSet_2_.member(cast(int, LA(1))))): + statement(itemBlock) + else: + if (_cnt158 >= 1): + goto _loop158_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) + ++_cnt158 + :_loop158_breakloop + elif ((_givenValue == RBRACE)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RBRACE) + while true: + if ((LA(1)==EOS) and (tokenSet_15_.member(cast(int, LA(2))))): + match(EOS) + else: + goto _loop160_breakloop + :_loop160_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def expression_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + e=assignment_expression() + if 0 == inputState.guessing: + b.Add(ExpressionStatement(e)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def yield_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + yt as IToken = null + + try: // for error handling + yt = LT(1) + match(YIELD) + if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): + e=expression() + elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + b.Add(YieldStatement(ToLexicalInfo(yt), Expression: e)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def return_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + ret as IToken = null + + try: // for error handling + ret = LT(1) + match(RETURN) + if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): + e=expression() + elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + b.Add(ReturnStatement(ToLexicalInfo(ret), Expression: e)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def break_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + t as IToken = null + + try: // for error handling + t = LT(1) + match(BREAK) + if 0 == inputState.guessing: + b.Add(BreakStatement(ToLexicalInfo(t))) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def continue_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + t as IToken = null + + try: // for error handling + t = LT(1) + match(CONTINUE) + if 0 == inputState.guessing: + gotoLabel = GetCurrentLoopLabel() + if gotoLabel is not null: + // we might be inside a c style for statement + b.Add(GotoStatement(ToLexicalInfo(t), Label: ReferenceExpression(gotoLabel))) + else: + b.Add(ContinueStatement(ToLexicalInfo(t))) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def throw_statement( + b as Block + ) as void: //throws RecognitionException, TokenStreamException + + t as IToken = null + + try: // for error handling + t = LT(1) + match(THROW) + if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): + e=expression() + elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + b.Add(RaiseStatement(ToLexicalInfo(t), Exception: e)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def declaration() as Declaration : //throws RecognitionException, TokenStreamException + d as Declaration + + + try: // for error handling + match(VAR) + id=identifier() + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + elif ((_givenValue == EOF) + or (_givenValue ==BREAK) + or (_givenValue ==CATCH) + or (_givenValue ==CLASS) + or (_givenValue ==CONTINUE) + or (_givenValue ==DO) + or (_givenValue ==ELSE) + or (_givenValue ==ENUM) + or (_givenValue ==FALSE) + or (_givenValue ==FINAL) + or (_givenValue ==FINALLY) + or (_givenValue ==FOR) + or (_givenValue ==FUNCTION) + or (_givenValue ==GET) + or (_givenValue ==IF) + or (_givenValue ==IN) + or (_givenValue ==INTERFACE) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==RETURN) + or (_givenValue ==PUBLIC) + or (_givenValue ==PROTECTED) + or (_givenValue ==INTERNAL) + or (_givenValue ==PARTIAL) + or (_givenValue ==PRIVATE) + or (_givenValue ==SET) + or (_givenValue ==STATIC) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==THROW) + or (_givenValue ==TRUE) + or (_givenValue ==TRY) + or (_givenValue ==TYPEOF) + or (_givenValue ==VAR) + or (_givenValue ==VIRTUAL) + or (_givenValue ==WHILE) + or (_givenValue ==YIELD) + or (_givenValue ==SWITCH) + or (_givenValue ==CASE) + or (_givenValue ==DEFAULT) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==RBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==EOS) + or (_givenValue ==ASSIGN) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==AT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + d = Declaration(ToLexicalInfo(id), Name: id.getText(), Type: tr) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_47_) + else: + raise + return d + + public def assignment_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + a as IToken = null + ipa as IToken = null + ips as IToken = null + ipm as IToken = null + ipd as IToken = null + ipbo as IToken = null + ipba as IToken = null + ipxo as IToken = null + ipsl as IToken = null + ipsr as IToken = null + + try: // for error handling + e=conditional_expression() + _givenValue = LA(1) + if ((_givenValue == INPLACE_DIVISION) + or (_givenValue ==INPLACE_ADD) + or (_givenValue ==INPLACE_SUBTRACT) + or (_givenValue ==INPLACE_MULTIPLY) + or (_givenValue ==INPLACE_BITWISE_OR) + or (_givenValue ==INPLACE_BITWISE_AND) + or (_givenValue ==ASSIGN) + or (_givenValue ==INPLACE_SHIFT_LEFT) + or (_givenValue ==INPLACE_SHIFT_RIGHT) + or (_givenValue ==INPLACE_BITWISE_XOR) + ): // 1827 + _givenValue = LA(1) + if ((_givenValue == ASSIGN)): // 1831 + a = LT(1) + match(ASSIGN) + if 0 == inputState.guessing: + token = a; op = BinaryOperatorType.Assign + elif ((_givenValue == INPLACE_ADD)): // 1831 + ipa = LT(1) + match(INPLACE_ADD) + if 0 == inputState.guessing: + token = ipa; op = BinaryOperatorType.InPlaceAddition + elif ((_givenValue == INPLACE_SUBTRACT)): // 1831 + ips = LT(1) + match(INPLACE_SUBTRACT) + if 0 == inputState.guessing: + token = ips; op = BinaryOperatorType.InPlaceSubtraction + elif ((_givenValue == INPLACE_MULTIPLY)): // 1831 + ipm = LT(1) + match(INPLACE_MULTIPLY) + if 0 == inputState.guessing: + token = ipm; op = BinaryOperatorType.InPlaceMultiply + elif ((_givenValue == INPLACE_DIVISION)): // 1831 + ipd = LT(1) + match(INPLACE_DIVISION) + if 0 == inputState.guessing: + token = ipd; op = BinaryOperatorType.InPlaceDivision + elif ((_givenValue == INPLACE_BITWISE_OR)): // 1831 + ipbo = LT(1) + match(INPLACE_BITWISE_OR) + if 0 == inputState.guessing: + token = ipbo; op = BinaryOperatorType.InPlaceBitwiseOr + elif ((_givenValue == INPLACE_BITWISE_AND)): // 1831 + ipba = LT(1) + match(INPLACE_BITWISE_AND) + if 0 == inputState.guessing: + token = ipba; op = BinaryOperatorType.InPlaceBitwiseAnd + elif ((_givenValue == INPLACE_BITWISE_XOR)): // 1831 + ipxo = LT(1) + match(INPLACE_BITWISE_XOR) + if 0 == inputState.guessing: + token = ipxo; op = BinaryOperatorType.InPlaceExclusiveOr + elif ((_givenValue == INPLACE_SHIFT_LEFT)): // 1831 + ipsl = LT(1) + match(INPLACE_SHIFT_LEFT) + if 0 == inputState.guessing: + token = ipsl; op = BinaryOperatorType.InPlaceShiftLeft + elif ((_givenValue == INPLACE_SHIFT_RIGHT)): // 1831 + ipsr = LT(1) + match(INPLACE_SHIFT_RIGHT) + if 0 == inputState.guessing: + token = ipsr; op = BinaryOperatorType.InPlaceShiftRight + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + r=assignment_expression() + if 0 == inputState.guessing: + be = BinaryExpression(ToLexicalInfo(token)) + be.Operator = op + be.Left = e + be.Right = r + e = be + elif ((_givenValue == EOF) + or (_givenValue ==BREAK) + or (_givenValue ==CATCH) + or (_givenValue ==CLASS) + or (_givenValue ==CONTINUE) + or (_givenValue ==DO) + or (_givenValue ==ELSE) + or (_givenValue ==ENUM) + or (_givenValue ==FALSE) + or (_givenValue ==FINAL) + or (_givenValue ==FINALLY) + or (_givenValue ==FOR) + or (_givenValue ==FUNCTION) + or (_givenValue ==GET) + or (_givenValue ==IF) + or (_givenValue ==INTERFACE) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==RETURN) + or (_givenValue ==PUBLIC) + or (_givenValue ==PROTECTED) + or (_givenValue ==INTERNAL) + or (_givenValue ==PARTIAL) + or (_givenValue ==PRIVATE) + or (_givenValue ==SET) + or (_givenValue ==STATIC) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==THROW) + or (_givenValue ==TRUE) + or (_givenValue ==TRY) + or (_givenValue ==TYPEOF) + or (_givenValue ==VAR) + or (_givenValue ==VIRTUAL) + or (_givenValue ==WHILE) + or (_givenValue ==YIELD) + or (_givenValue ==SWITCH) + or (_givenValue ==CASE) + or (_givenValue ==DEFAULT) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==RBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==RPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==EOS) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==AT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_48_) + else: + raise + return e + + public def for_in( + container as Block + ) as Statement : //throws RecognitionException, TokenStreamException + stmt as Statement + + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) + ): // 1827 + id=identifier() + if 0 == inputState.guessing: + d = Declaration(ToLexicalInfo(id), Name: id.getText()) + elif ((_givenValue == VAR)): // 1831 + d=declaration() + if 0 == inputState.guessing: + DeclarationAnnotations.ForceNewVariable(d) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(IN) + iterator=expression() + if 0 == inputState.guessing: + fs = ForStatement(Iterator: iterator) + fs.Declarations.Add(d) + b = fs.Block + stmt = fs + container.Add(stmt) + EnterLoop(stmt) + match(RPAREN) + compound_or_single_stmt(b) + if 0 == inputState.guessing: + LeaveLoop(stmt) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + return stmt + + public def for_c( + container as Block + ) as Statement : //throws RecognitionException, TokenStreamException + stmt as Statement + + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == VAR)): // 1831 + declaration_statement(container) + if 0 == inputState.guessing: + stmt = container.Statements[-1] as DeclarationStatement + stmt.Annotate("PrivateScope") if stmt is not null + elif ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + expression_statement(container) + elif ((_givenValue == EOS)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(EOS) + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + condition=expression() + elif ((_givenValue == EOS)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(EOS) + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + update=assignment_expression() + elif ((_givenValue == RPAREN)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + ws = WhileStatement(Condition: condition) + if condition is null: + ws.Condition = BoolLiteralExpression(Value: true) + b = ws.Block + stmt = ws + // support for 'continue' + label = SetUpLoopLabel(ws) + container.Add(stmt) + EnterLoop(ws) + match(RPAREN) + compound_or_single_stmt(b) + if 0 == inputState.guessing: + LeaveLoop(ws) + if IsLabelInUse(ws): + b.Add(LabelStatement(Name: label)) + b.Add(update) if update is not null + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + return stmt + + public def member() as Token : //throws RecognitionException, TokenStreamException + name as Token + + id as IToken = null + st as IToken = null + gt as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + id = LT(1) + match(ID) + if 0 == inputState.guessing: + name=id; + elif ((_givenValue == SET)): // 1831 + st = LT(1) + match(SET) + if 0 == inputState.guessing: + name=st; + elif ((_givenValue == GET)): // 1831 + gt = LT(1) + match(GET) + if 0 == inputState.guessing: + name=gt; + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return name + + public def expression_list( + ec as ExpressionCollection + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): + e=expression() + if 0 == inputState.guessing: + ec.Add(e); + while true: + if ((LA(1)==COMMA)): + match(COMMA) + e=expression() + if 0 == inputState.guessing: + ec.Add(e); + else: + goto _loop225_breakloop + :_loop225_breakloop + elif ((LA(1)==LBRACE or LA(1)==RPAREN or LA(1)==RBRACK) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_49_) + else: + raise + + public def paren_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + match(LPAREN) + e=expression() + match(RPAREN) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def finally_block( + s as TryStatement + ) as void: //throws RecognitionException, TokenStreamException + + ft as IToken = null + + try: // for error handling + ft = LT(1) + match(FINALLY) + if 0 == inputState.guessing: + finallyBlock = s.EnsureBlock = Block(ToLexicalInfo(ft)) + compound_or_single_stmt(finallyBlock) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_15_) + else: + raise + + public def conditional_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + qm as IToken = null + + try: // for error handling + e=logical_or() + if ((LA(1)==QUESTION_MARK) and (tokenSet_12_.member(cast(int, LA(2))))): + qm = LT(1) + match(QUESTION_MARK) + trueValue=logical_or() + match(COLON) + falseValue=conditional_expression() + if 0 == inputState.guessing: + e = ConditionalExpression(ToLexicalInfo(qm), + Condition: e, + TrueValue: trueValue, + FalseValue: falseValue) + elif ((tokenSet_19_.member(cast(int, LA(1)))) and (tokenSet_27_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def simple_type_reference() as TypeReference : //throws RecognitionException, TokenStreamException + tr as TypeReference + + + try: // for error handling + typeName=qname() + if ((LA(1)==DOT) and (LA(2)==LESS_THAN)): + match(DOT) + match(LESS_THAN) + if 0 == inputState.guessing: + tr = gtr = GenericTypeReference(ToLexicalInfo(typeName), typeName.getText()); + arguments = gtr.GenericArguments + type_reference_list(arguments) + match(GREATER_THAN) + elif ((tokenSet_33_.member(cast(int, LA(1)))) and (tokenSet_24_.member(cast(int, LA(2))))): // line 2102 + if 0 == inputState.guessing: + tr = SimpleTypeReference(ToLexicalInfo(typeName), Name: typeName.getText()) + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_33_) + else: + raise + return tr + + public def anonymous_function_type() as TypeReference : //throws RecognitionException, TokenStreamException + tr as TypeReference + + fn as IToken = null + + try: // for error handling + fn = LT(1) + match(FUNCTION) + if 0 == inputState.guessing: + tr = callableTypeRef = CallableTypeReference(ToLexicalInfo(fn)) + parameters = callableTypeRef.Parameters + function_type_parameters(parameters) + if ((LA(1)==COLON) and (LA(2)==FUNCTION or LA(2)==ID)): + match(COLON) + returnType=type_reference() + if 0 == inputState.guessing: + callableTypeRef.ReturnType = returnType + elif ((tokenSet_33_.member(cast(int, LA(1)))) and (tokenSet_24_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_33_) + else: + raise + return tr + + public def function_type_parameters( + parameters as ParameterDeclarationCollection + ) as void: //throws RecognitionException, TokenStreamException + + + try: // for error handling + match(LPAREN) + _givenValue = LA(1) + if ((_givenValue == FUNCTION) + or (_givenValue ==ID) + ): // 1827 + parameterType=type_reference() + if 0 == inputState.guessing: + parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) + while true: + if ((LA(1)==COMMA)): + match(COMMA) + parameterType=type_reference() + if 0 == inputState.guessing: + parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) + else: + goto _loop182_breakloop + :_loop182_breakloop + elif ((_givenValue == RPAREN)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RPAREN) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_33_) + else: + raise + + public def array_initializer() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + dimensions = List of Expression(1) + + try: // for error handling + tr=simple_type_reference() + match(LBRACK) + size=sum() + if 0 == inputState.guessing: + dimensions.Add(size) + while true: + if ((LA(1)==COMMA)): + match(COMMA) + size=sum() + if 0 == inputState.guessing: + dimensions.Add(size) + else: + goto _loop185_breakloop + :_loop185_breakloop + match(RBRACK) + if 0 == inputState.guessing: + e = CodeFactory.NewArrayInitializer(tr.LexicalInfo, tr, dimensions) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def sum() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + add as IToken = null + sub as IToken = null + bOperator = BinaryOperatorType.None; + + try: // for error handling + e=term() + while true: + if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_12_.member(cast(int, LA(2))))): + _givenValue = LA(1) + if ((_givenValue == ADD)): // 1831 + add = LT(1) + match(ADD) + if 0 == inputState.guessing: + op=add; bOperator = BinaryOperatorType.Addition; + elif ((_givenValue == SUBTRACT)): // 1831 + sub = LT(1) + match(SUBTRACT) + if 0 == inputState.guessing: + op=sub; bOperator = BinaryOperatorType.Subtraction; + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + r=term() + if 0 == inputState.guessing: + be = BinaryExpression(ToLexicalInfo(op)) + be.Operator = bOperator + be.Left = e + be.Right = r + e = be + else: + goto _loop259_breakloop + :_loop259_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def new_array_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + match(NEW) + e=array_initializer() + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def new_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + synPredMatched196 as bool = false + if ((LA(1)==NEW) and (LA(2)==ID)): + _m196 as int = mark() + synPredMatched196 = true + ++inputState.guessing + try: + new_array_expression() + except x as RecognitionException: + synPredMatched196 = false + rewind(_m196) + --inputState.guessing + if synPredMatched196: + e=new_array_expression() + elif ((LA(1)==NEW) and (LA(2)==ID)): // line 2102 + match(NEW) + r=reference_expression() + if 0 == inputState.guessing: + e = mie = MethodInvocationExpression(r.LexicalInfo, Target: r) + args = mie.Arguments + match(LPAREN) + expression_list(args) + match(RPAREN) + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def atom() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LBRACK) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + e=literal() + elif ((_givenValue == FUNCTION)): // 1831 + e=function_expression() + elif ((_givenValue == ID)): // 1831 + e=simple_reference_expression() + elif ((_givenValue == LPAREN)): // 1831 + e=paren_expression() + elif ((_givenValue == NEW)): // 1831 + e=new_expression() + elif ((_givenValue == TYPEOF)): // 1831 + e=typeof_expression() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def literal() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == INT) + or (_givenValue ==LONG) + ): // 1827 + e=integer_literal() + elif ((_givenValue == DOUBLE_QUOTED_STRING) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + e=string_literal() + elif ((_givenValue == LBRACK)): // 1831 + e=array_literal() + elif ((_givenValue == LBRACE)): // 1831 + e=hash_literal() + elif ((_givenValue == RE_LITERAL)): // 1831 + e=re_literal() + elif ((_givenValue == FALSE) + or (_givenValue ==TRUE) + ): // 1827 + e=bool_literal() + elif ((_givenValue == NULL)): // 1831 + e=null_literal() + elif ((_givenValue == THIS)): // 1831 + e=self_literal() + elif ((_givenValue == SUPER)): // 1831 + e=super_literal() + elif ((_givenValue == DOUBLE)): // 1831 + e=double_literal() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def function_expression() as BlockExpression : //throws RecognitionException, TokenStreamException + e as BlockExpression + + fn as IToken = null + + try: // for error handling + fn = LT(1) + match(FUNCTION) + if 0 == inputState.guessing: + e = BlockExpression(ToLexicalInfo(fn)) + e.Annotate("inline"); + body = e.Body + match(LPAREN) + _givenValue = LA(1) + if ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) + or (_givenValue ==AT) + ): // 1827 + parameter_declaration_list(e) + elif ((_givenValue == RPAREN)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RPAREN) + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + tr=type_reference() + if 0 == inputState.guessing: + e.ReturnType = tr; + elif ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if ((LA(1)==LBRACE) and (tokenSet_40_.member(cast(int, LA(2))))): + block(body) + elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + returnValue=expression() + if 0 == inputState.guessing: + body.Add(returnValue) + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def simple_reference_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + id as IToken = null + + try: // for error handling + id = LT(1) + match(ID) + if 0 == inputState.guessing: + e = ReferenceExpression(ToLexicalInfo(id), Name: id.getText()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def typeof_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + synPredMatched214 as bool = false + if ((LA(1)==TYPEOF) and (tokenSet_12_.member(cast(int, LA(2))))): + _m214 as int = mark() + synPredMatched214 = true + ++inputState.guessing + try: + match(TYPEOF) + match(LPAREN) + expression() + match(RPAREN) + except x as RecognitionException: + synPredMatched214 = false + rewind(_m214) + --inputState.guessing + if synPredMatched214: + e=typeof_with_expression() + elif ((LA(1)==TYPEOF) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + e=typeof_expression_alt() + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def member_reference_expression( + target as Expression + ) as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + lbrack as IToken = null + e = target; + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == LESS_THAN)): // 1831 + lbrack = LT(1) + match(LESS_THAN) + if 0 == inputState.guessing: + e = gre = GenericReferenceExpression(ToLexicalInfo(lbrack), Target: e) + genericArguments = gre.GenericArguments + type_reference_list(genericArguments) + match(GREATER_THAN) + elif ((_givenValue == GET) + or (_givenValue ==SET) + or (_givenValue ==ID) + ): // 1827 + memberName=member() + if 0 == inputState.guessing: + e = MemberReferenceExpression(ToLexicalInfo(memberName), Target: e, Name: memberName.getText()) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + protected def typeof_with_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + t as IToken = null + + try: // for error handling + t = LT(1) + match(TYPEOF) + if ((LA(1)==LPAREN) and (tokenSet_12_.member(cast(int, LA(2))))): + match(LPAREN) + arg=expression() + match(RPAREN) + elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + arg=expression() + else: + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + mie = MethodInvocationExpression(ToLexicalInfo(t)); + mie.Target = ReferenceExpression(ToLexicalInfo(t), Name: t.getText()) + mie.Arguments.Add(arg) + e = mie + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + protected def typeof_expression_alt() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + + try: // for error handling + synPredMatched217 as bool = false + if ((LA(1)==TYPEOF) and (LA(2)==LPAREN)): + _m217 as int = mark() + synPredMatched217 = true + ++inputState.guessing + try: + match(TYPEOF) + match(LPAREN) + type_reference() + match(RPAREN) + except x as RecognitionException: + synPredMatched217 = false + rewind(_m217) + --inputState.guessing + if synPredMatched217: + e=typeof_with_typeref() + elif ((LA(1)==TYPEOF) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + e=typeof_with_expression() + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + protected def typeof_with_typeref() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + t as IToken = null + + try: // for error handling + t = LT(1) + match(TYPEOF) + match(LPAREN) + tr=type_reference() + match(RPAREN) + if 0 == inputState.guessing: + e = TypeofExpression(ToLexicalInfo(t), tr); + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def slice( + se as SlicingExpression + ) as void: //throws RecognitionException, TokenStreamException + + begin as Expression + end as Expression + step as Expression + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + if 0 == inputState.guessing: + begin = OmittedExpression.Default; + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + end=expression() + elif ((_givenValue == COLON)): // 1831 + match(COLON) + if 0 == inputState.guessing: + end = OmittedExpression.Default; + step=expression() + elif ((_givenValue == COMMA) + or (_givenValue ==RBRACK) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + elif ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + begin=expression() + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + end=expression() + elif ((_givenValue == COLON) + or (_givenValue ==COMMA) + or (_givenValue ==RBRACK) + ): // 1827 + if 0 == inputState.guessing: + end = OmittedExpression.Default; + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + _givenValue = LA(1) + if ((_givenValue == COLON)): // 1831 + match(COLON) + step=expression() + elif ((_givenValue == COMMA) + or (_givenValue ==RBRACK) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + elif ((_givenValue == COMMA) + or (_givenValue ==RBRACK) + ): // 1827 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + se.Indices.Add(Slice(begin, end, step)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_50_) + else: + raise + + public def slicing_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + lbrack as IToken = null + lparen as IToken = null + se as SlicingExpression + mce as MethodInvocationExpression + args as ExpressionCollection + + try: // for error handling + e=atom() + while true: + if ((LA(1)==LBRACK) and (tokenSet_51_.member(cast(int, LA(2))))): + lbrack = LT(1) + match(LBRACK) + if 0 == inputState.guessing: + se = SlicingExpression(ToLexicalInfo(lbrack)) + se.Target = e + e = se + slice(se) + while true: + if ((LA(1)==COMMA)): + match(COMMA) + slice(se) + else: + goto _loop241_breakloop + :_loop241_breakloop + match(RBRACK) + elif ((LA(1)==DOT) and (tokenSet_52_.member(cast(int, LA(2))))): // line 2102 + match(DOT) + e=member_reference_expression(e) + elif ((LA(1)==LPAREN) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + lparen = LT(1) + match(LPAREN) + if 0 == inputState.guessing: + mce = MethodInvocationExpression(ToLexicalInfo(lparen)) + mce.Target = e + e = mce + args = mce.Arguments + expression_list(args) + match(RPAREN) + else: + goto _loop244_breakloop + :_loop244_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def postfix_unary_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + postinc as IToken = null + preinc as IToken = null + + try: // for error handling + e=slicing_expression() + if ((LA(1)==INCREMENT) and (tokenSet_19_.member(cast(int, LA(2))))): + postinc = LT(1) + match(INCREMENT) + if 0 == inputState.guessing: + token = postinc; operator = UnaryOperatorType.PostIncrement; + elif ((LA(1)==DECREMENT) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + preinc = LT(1) + match(DECREMENT) + if 0 == inputState.guessing: + token = preinc; operator= UnaryOperatorType.PostDecrement; + elif ((tokenSet_19_.member(cast(int, LA(1)))) and (tokenSet_27_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + e = UnaryExpression(ToLexicalInfo(token), operator, e) if token is not null + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def unary_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + tc as IToken = null + c as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + ): // 1827 + e=prefix_unary_expression() + elif ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + e=postfix_unary_expression() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if ((LA(1)==AS) and (LA(2)==FUNCTION or LA(2)==ID)): + tc = LT(1) + match(AS) + tr=type_reference() + if 0 == inputState.guessing: + e = TryCastExpression(ToLexicalInfo(tc), Target: e, Type: tr) + elif ((LA(1)==CAST) and (LA(2)==FUNCTION or LA(2)==ID)): // line 2102 + c = LT(1) + match(CAST) + tr=type_reference() + if 0 == inputState.guessing: + e = CastExpression(ToLexicalInfo(c), Target: e, Type: tr) + elif ((tokenSet_19_.member(cast(int, LA(1)))) and (tokenSet_27_.member(cast(int, LA(2))))): // line 2102 + pass // 947 + else: + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def prefix_unary_expression() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + sub as IToken = null + inc as IToken = null + dec as IToken = null + nt as IToken = null + oc as IToken = null + uOperator = UnaryOperatorType.None + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == SUBTRACT)): // 1831 + sub = LT(1) + match(SUBTRACT) + if 0 == inputState.guessing: + op = sub; uOperator = UnaryOperatorType.UnaryNegation; + elif ((_givenValue == INCREMENT)): // 1831 + inc = LT(1) + match(INCREMENT) + if 0 == inputState.guessing: + op = inc; uOperator = UnaryOperatorType.Increment; + elif ((_givenValue == DECREMENT)): // 1831 + dec = LT(1) + match(DECREMENT) + if 0 == inputState.guessing: + op = dec; uOperator = UnaryOperatorType.Decrement; + elif ((_givenValue == NOT)): // 1831 + nt = LT(1) + match(NOT) + if 0 == inputState.guessing: + op = nt; uOperator = UnaryOperatorType.LogicalNot; + elif ((_givenValue == BITWISE_NOT)): // 1831 + oc = LT(1) + match(BITWISE_NOT) + if 0 == inputState.guessing: + op = oc; uOperator = UnaryOperatorType.OnesComplement; + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + e=unary_expression() + if 0 == inputState.guessing: + e = UnaryExpression(ToLexicalInfo(op), uOperator, e) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def term() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + m as IToken = null + d as IToken = null + md as IToken = null + op = BinaryOperatorType.None + + try: // for error handling + e=unary_expression() + while true: + if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_12_.member(cast(int, LA(2))))): + _givenValue = LA(1) + if ((_givenValue == MULTIPLY)): // 1831 + m = LT(1) + match(MULTIPLY) + if 0 == inputState.guessing: + op=BinaryOperatorType.Multiply; token=m; + elif ((_givenValue == DIVISION)): // 1831 + d = LT(1) + match(DIVISION) + if 0 == inputState.guessing: + op=BinaryOperatorType.Division; token=d; + elif ((_givenValue == MODULUS)): // 1831 + md = LT(1) + match(MODULUS) + if 0 == inputState.guessing: + op=BinaryOperatorType.Modulus; token=md; + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + r=unary_expression() + if 0 == inputState.guessing: + be = BinaryExpression(ToLexicalInfo(token)) + be.Operator = op + be.Left = e + be.Right = r + e = be + else: + goto _loop255_breakloop + :_loop255_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def shift() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + sl as IToken = null + sr as IToken = null + + try: // for error handling + e=sum() + while true: + if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_12_.member(cast(int, LA(2))))): + _givenValue = LA(1) + if ((_givenValue == SHIFT_LEFT)): // 1831 + sl = LT(1) + match(SHIFT_LEFT) + if 0 == inputState.guessing: + op = BinaryOperatorType.ShiftLeft; token = sl + elif ((_givenValue == SHIFT_RIGHT)): // 1831 + sr = LT(1) + match(SHIFT_RIGHT) + if 0 == inputState.guessing: + op = BinaryOperatorType.ShiftRight; token = sr + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + r=sum() + if 0 == inputState.guessing: + e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) + else: + goto _loop263_breakloop + :_loop263_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def comparison() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + tin as IToken = null + tgt as IToken = null + tgte as IToken = null + tlt as IToken = null + tlte as IToken = null + tisa as IToken = null + r as Expression + op = BinaryOperatorType.None; + token as IToken + + try: // for error handling + e=shift() + while true: + if ((tokenSet_53_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): + _givenValue = LA(1) + if ((_givenValue == IN) + or (_givenValue ==LESS_THAN) + or (_givenValue ==LESS_THAN_OR_EQUAL) + or (_givenValue ==GREATER_THAN) + or (_givenValue ==GREATER_THAN_OR_EQUAL) + ): // 1827 + _givenValue = LA(1) + if ((_givenValue == IN)): // 1831 + tin = LT(1) + match(IN) + if 0 == inputState.guessing: + op = BinaryOperatorType.Member; token = tin; + elif ((_givenValue == GREATER_THAN)): // 1831 + tgt = LT(1) + match(GREATER_THAN) + if 0 == inputState.guessing: + op = BinaryOperatorType.GreaterThan; token = tgt; + elif ((_givenValue == GREATER_THAN_OR_EQUAL)): // 1831 + tgte = LT(1) + match(GREATER_THAN_OR_EQUAL) + if 0 == inputState.guessing: + op = BinaryOperatorType.GreaterThanOrEqual; token = tgte + elif ((_givenValue == LESS_THAN)): // 1831 + tlt = LT(1) + match(LESS_THAN) + if 0 == inputState.guessing: + op = BinaryOperatorType.LessThan; token = tlt; + elif ((_givenValue == LESS_THAN_OR_EQUAL)): // 1831 + tlte = LT(1) + match(LESS_THAN_OR_EQUAL) + if 0 == inputState.guessing: + op = BinaryOperatorType.LessThanOrEqual; token = tlte; + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + r=shift() + elif ((_givenValue == INSTANCEOF)): // 1831 + tisa = LT(1) + match(INSTANCEOF) + tr=type_reference() + if 0 == inputState.guessing: + op = BinaryOperatorType.TypeTest; + token = tisa; + r = TypeofExpression(tr.LexicalInfo, tr); + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + be = BinaryExpression(ToLexicalInfo(token)) + be.Operator = op + be.Left = e + be.Right = r + e = be + else: + goto _loop275_breakloop + :_loop275_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def equality() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + te as IToken = null + ti as IToken = null + re as IToken = null + rie as IToken = null + + try: // for error handling + e=comparison() + while true: + if ((tokenSet_54_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): + _givenValue = LA(1) + if ((_givenValue == EQUALITY)): // 1831 + te = LT(1) + match(EQUALITY) + if 0 == inputState.guessing: + op = BinaryOperatorType.Equality; token = te; + elif ((_givenValue == INEQUALITY)): // 1831 + ti = LT(1) + match(INEQUALITY) + if 0 == inputState.guessing: + op = BinaryOperatorType.Inequality; token = ti + elif ((_givenValue == REFERENCE_EQUALITY)): // 1831 + re = LT(1) + match(REFERENCE_EQUALITY) + if 0 == inputState.guessing: + op = BinaryOperatorType.ReferenceEquality; token = re + elif ((_givenValue == REFERENCE_INEQUALITY)): // 1831 + rie = LT(1) + match(REFERENCE_INEQUALITY) + if 0 == inputState.guessing: + op = BinaryOperatorType.ReferenceInequality; token = rie + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + r=comparison() + if 0 == inputState.guessing: + e = BinaryExpression(ToLexicalInfo(token), op, e, r) + else: + goto _loop283_breakloop + :_loop283_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def bitwise_and() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + token as IToken = null + + try: // for error handling + e=equality() + while true: + if ((LA(1)==BITWISE_AND) and (tokenSet_12_.member(cast(int, LA(2))))): + token = LT(1) + match(BITWISE_AND) + if 0 == inputState.guessing: + op = BinaryOperatorType.BitwiseAnd; + r=equality() + if 0 == inputState.guessing: + e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) + else: + goto _loop286_breakloop + :_loop286_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def bitwise_xor() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + token as IToken = null + + try: // for error handling + e=bitwise_and() + while true: + if ((LA(1)==BITWISE_XOR) and (tokenSet_12_.member(cast(int, LA(2))))): + token = LT(1) + match(BITWISE_XOR) + if 0 == inputState.guessing: + op = BinaryOperatorType.ExclusiveOr; + r=bitwise_and() + if 0 == inputState.guessing: + e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) + else: + goto _loop289_breakloop + :_loop289_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def bitwise_or() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + token as IToken = null + + try: // for error handling + e=bitwise_xor() + while true: + if ((LA(1)==BITWISE_OR) and (tokenSet_12_.member(cast(int, LA(2))))): + token = LT(1) + match(BITWISE_OR) + if 0 == inputState.guessing: + op = BinaryOperatorType.BitwiseOr; + r=bitwise_xor() + if 0 == inputState.guessing: + e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) + else: + goto _loop292_breakloop + :_loop292_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def logical_and() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + op as IToken = null + + try: // for error handling + e=bitwise_or() + while true: + if ((LA(1)==LOGICAL_AND) and (tokenSet_12_.member(cast(int, LA(2))))): + op = LT(1) + match(LOGICAL_AND) + rhs=bitwise_or() + if 0 == inputState.guessing: + e=BinaryExpression(ToLexicalInfo(op), + Operator: BinaryOperatorType.And, + Left: e, + Right: rhs) + else: + goto _loop295_breakloop + :_loop295_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def logical_or() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + op as IToken = null + + try: // for error handling + e=logical_and() + while true: + if ((LA(1)==LOGICAL_OR) and (tokenSet_12_.member(cast(int, LA(2))))): + op = LT(1) + match(LOGICAL_OR) + rhs=logical_and() + if 0 == inputState.guessing: + e = BinaryExpression(ToLexicalInfo(op), + Operator: BinaryOperatorType.Or, + Left: e, + Right: rhs) + else: + goto _loop298_breakloop + :_loop298_breakloop + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def string_literal() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + dqs as IToken = null + sqs as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == DOUBLE_QUOTED_STRING)): // 1831 + dqs = LT(1) + match(DOUBLE_QUOTED_STRING) + if 0 == inputState.guessing: + s = dqs; + elif ((_givenValue == SINGLE_QUOTED_STRING)): // 1831 + sqs = LT(1) + match(SINGLE_QUOTED_STRING) + if 0 == inputState.guessing: + s = sqs; + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + e = StringLiteralExpression(ToLexicalInfo(s), s.getText()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def array_literal() as Expression : //throws RecognitionException, TokenStreamException + e as Expression + + lbrack as IToken = null + + try: // for error handling + lbrack = LT(1) + match(LBRACK) + synPredMatched306 as bool = false + if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_55_.member(cast(int, LA(2))))): + _m306 as int = mark() + synPredMatched306 = true + ++inputState.guessing + try: + expression() + match(FOR) + except x as RecognitionException: + synPredMatched306 = false + rewind(_m306) + --inputState.guessing + if synPredMatched306: + projection=expression() + match(FOR) + match(LPAREN) + _givenValue = LA(1) + if ((_givenValue == FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) + ): // 1827 + id=identifier() + elif ((_givenValue == VAR)): // 1831 + variable=declaration() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(IN) + iterator=expression() + match(RPAREN) + _givenValue = LA(1) + if ((_givenValue == IF)): // 1831 + match(IF) + filter=expression() + elif ((_givenValue == RBRACK)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + if 0 == inputState.guessing: + if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) + e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) + elif ((tokenSet_56_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + if 0 == inputState.guessing: + e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)); items = ale.Items; + expression_list(items) + else: + raise NoViableAltException(LT(1), getFilename()) + match(RBRACK) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def hash_literal() as HashLiteralExpression : //throws RecognitionException, TokenStreamException + dle as HashLiteralExpression + + lbrace as IToken = null + pair as ExpressionPair + + try: // for error handling + lbrace = LT(1) + match(LBRACE) + if 0 == inputState.guessing: + dle = HashLiteralExpression(ToLexicalInfo(lbrace)); + _givenValue = LA(1) + if ((_givenValue == FALSE) + or (_givenValue ==FUNCTION) + or (_givenValue ==NEW) + or (_givenValue ==NULL) + or (_givenValue ==SUPER) + or (_givenValue ==THIS) + or (_givenValue ==TRUE) + or (_givenValue ==TYPEOF) + or (_givenValue ==ID) + or (_givenValue ==DOUBLE_QUOTED_STRING) + or (_givenValue ==LBRACE) + or (_givenValue ==LPAREN) + or (_givenValue ==LBRACK) + or (_givenValue ==INCREMENT) + or (_givenValue ==DECREMENT) + or (_givenValue ==SUBTRACT) + or (_givenValue ==BITWISE_NOT) + or (_givenValue ==NOT) + or (_givenValue ==RE_LITERAL) + or (_givenValue ==DOUBLE) + or (_givenValue ==INT) + or (_givenValue ==LONG) + or (_givenValue ==SINGLE_QUOTED_STRING) + ): // 1827 + pair=expression_pair() + if 0 == inputState.guessing: + dle.Items.Add(pair); + while true: + if ((LA(1)==COMMA)): + match(COMMA) + pair=expression_pair() + if 0 == inputState.guessing: + dle.Items.Add(pair); + else: + goto _loop314_breakloop + :_loop314_breakloop + elif ((_givenValue == RBRACE)): // 1831 + pass // 947 + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(RBRACE) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return dle + + public def re_literal() as RELiteralExpression : //throws RecognitionException, TokenStreamException + re as RELiteralExpression + + value as IToken = null + + try: // for error handling + value = LT(1) + match(RE_LITERAL) + if 0 == inputState.guessing: + re = RELiteralExpression(ToLexicalInfo(value), value.getText()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return re + + public def bool_literal() as BoolLiteralExpression : //throws RecognitionException, TokenStreamException + e as BoolLiteralExpression + + t as IToken = null + f as IToken = null + + try: // for error handling + _givenValue = LA(1) + if ((_givenValue == TRUE)): // 1831 + t = LT(1) + match(TRUE) + if 0 == inputState.guessing: + e = BoolLiteralExpression(ToLexicalInfo(t), Value: true) + elif ((_givenValue == FALSE)): // 1831 + f = LT(1) + match(FALSE) + if 0 == inputState.guessing: + e = BoolLiteralExpression(ToLexicalInfo(f), Value: false) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def null_literal() as NullLiteralExpression : //throws RecognitionException, TokenStreamException + e as NullLiteralExpression + + t as IToken = null + + try: // for error handling + t = LT(1) + match(NULL) + if 0 == inputState.guessing: + e = NullLiteralExpression(ToLexicalInfo(t)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def self_literal() as SelfLiteralExpression : //throws RecognitionException, TokenStreamException + e as SelfLiteralExpression + + t as IToken = null + + try: // for error handling + t = LT(1) + match(THIS) + if 0 == inputState.guessing: + e = SelfLiteralExpression(ToLexicalInfo(t)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def super_literal() as SuperLiteralExpression : //throws RecognitionException, TokenStreamException + e as SuperLiteralExpression + + t as IToken = null + + try: // for error handling + t = LT(1) + match(SUPER) + if 0 == inputState.guessing: + e = SuperLiteralExpression(ToLexicalInfo(t)) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return e + + public def double_literal() as DoubleLiteralExpression : //throws RecognitionException, TokenStreamException + rle as DoubleLiteralExpression + + value as IToken = null + + try: // for error handling + value = LT(1) + match(DOUBLE) + if 0 == inputState.guessing: + rle = CodeFactory.NewDoubleLiteralExpression(ToLexicalInfo(value), value.getText()) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_19_) + else: + raise + return rle + + public def expression_pair() as ExpressionPair : //throws RecognitionException, TokenStreamException + ep as ExpressionPair + + t as IToken = null + + try: // for error handling + key=expression() + t = LT(1) + match(COLON) + value=expression() + if 0 == inputState.guessing: + ep = ExpressionPair(ToLexicalInfo(t), key, value) + except ex as RecognitionException: + if (0 == inputState.guessing): + reportError(ex) + recover(ex,tokenSet_38_) + else: + raise + return ep + + + public static final tokenNames_ = ( + '<0>', + 'EOF', + '<2>', + 'NULL_TREE_LOOKAHEAD', + 'as', + 'break', + 'cast', + 'catch', + 'class', + 'continue', + 'do', + 'else', + 'enum', + 'extends', + 'false', + 'final', + 'finally', + 'for', + 'function', + 'get', + 'if', + 'import', + 'implements', + 'in', + 'interface', + 'instanceof', + 'new', + 'null', + 'return', + 'public', + 'protected', + 'internal', + 'override', + 'partial', + 'private', + 'set', + 'static', + 'super', + 'this', + 'throw', + 'true', + 'try', + 'typeof', + 'var', + 'virtual', + 'while', + 'yield', + 'switch', + 'case', + 'default', + '/=', + '+=', + '-=', + '*=', + '//', + 'pragma on', + 'pragma off', + 'an identifier', + 'a string', + '{', + '}', + '(', + ')', + '.', + ':', + ',', + '[', + ']', + '|', + '|=', + '&', + '^', + '&=', + '||', + '&&', + ';', + '=', + '++', + '--', + '+', + '-', + '%', + '*', + '==', + '!=', + '?', + '~', + '===', + '!==', + '<', + '<=', + '<<', + '<<=', + '>', + '>=', + '>>', + '>>=', + '@', + '@script', + '@assembly', + 'INPLACE_BITWISE_XOR', + 'NOT', + 'DIVISION', + 'RE_LITERAL', + 'DOUBLE', + 'INT', + 'LONG', + 'SINGLE_QUOTED_STRING', + 'DOUBLE_SUFFIX', + 'EXPONENT', + 'PRAGMA_WHITE_SPACE', + 'WHITE_SPACE', + 'DQS_ESC', + 'SQS_ESC', + 'SESC', + 'ML_COMMENT', + 'RE_CHAR', + 'RE_ESC', + 'NEWLINE', + 'ID_LETTER', + 'DIGIT', + 'HEXDIGIT', + ) + + private static def mk_tokenSet_0_() as (long): + data = (26486543520000L, 0L, ) + return data + public static final tokenSet_0_ = BitSet(mk_tokenSet_0_()) + private static def mk_tokenSet_1_() as (long): + data = (144141708979638528L, 0L, ) + return data + public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) + private static def mk_tokenSet_2_() as (long): + data = (3314913105927882272L, 17179873470468L, 0L, 0L, ) + return data + public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) + private static def mk_tokenSet_3_() as (long): + data = (-4738631237225228430L, 17540646436860L, 0L, 0L, ) + return data + public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) + private static def mk_tokenSet_4_() as (long): + data = (2L, 0L, ) + return data + public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) + private static def mk_tokenSet_5_() as (long): + data = (3423017187437106978L, 17188463405060L, 0L, 0L, ) + return data + public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) + private static def mk_tokenSet_6_() as (long): + data = (144141678981452032L, 0L, ) + return data + public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) + private static def mk_tokenSet_7_() as (long): + data = (26477936541696L, 0L, ) + return data + public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) + private static def mk_tokenSet_8_() as (long): + data = (144141666012397568L, 0L, ) + return data + public static final tokenSet_8_ = BitSet(mk_tokenSet_8_()) + private static def mk_tokenSet_9_() as (long): + data = (17690450497792L, 0L, ) + return data + public static final tokenSet_9_ = BitSet(mk_tokenSet_9_()) + private static def mk_tokenSet_10_() as (long): + data = (144132912886616320L, 0L, ) + return data + public static final tokenSet_10_ = BitSet(mk_tokenSet_10_()) + private static def mk_tokenSet_11_() as (long): + data = (3314930796378117922L, 17188463405060L, 0L, 0L, ) + return data + public static final tokenSet_11_ = BitSet(mk_tokenSet_11_()) + private static def mk_tokenSet_12_() as (long): + data = (3314655235821289472L, 17179873468420L, 0L, 0L, ) + return data + public static final tokenSet_12_ = BitSet(mk_tokenSet_12_()) + private static def mk_tokenSet_13_() as (long): + data = (3314913071567619616L, 17179873468420L, 0L, 0L, ) + return data + public static final tokenSet_13_ = BitSet(mk_tokenSet_13_()) + private static def mk_tokenSet_14_() as (long): + data = (-4737786812295028750L, 17540646436860L, 0L, 0L, ) + return data + public static final tokenSet_14_ = BitSet(mk_tokenSet_14_()) + private static def mk_tokenSet_15_() as (long): + data = (4468696725915164578L, 17188463405060L, 0L, 0L, ) + return data + public static final tokenSet_15_ = BitSet(mk_tokenSet_15_()) + private static def mk_tokenSet_16_() as (long): + data = (-144109277957308336L, 17458773616350L, 0L, 0L, ) + return data + public static final tokenSet_16_ = BitSet(mk_tokenSet_16_()) + private static def mk_tokenSet_17_() as (long): + data = (4611686018427387904L, 2L, 0L, 0L, ) + return data + public static final tokenSet_17_ = BitSet(mk_tokenSet_17_()) + private static def mk_tokenSet_18_() as (long): + data = (2305843009213693952L, 4096L, 0L, 0L, ) + return data + public static final tokenSet_18_ = BitSet(mk_tokenSet_18_()) + private static def mk_tokenSet_19_() as (long): + data = (-126100789572673550L, 17540646436863L, 0L, 0L, ) + return data + public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) + private static def mk_tokenSet_20_() as (long): + data = (144141678981452032L, 8589934592L, 0L, 0L, ) + return data + public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) + private static def mk_tokenSet_21_() as (long): + data = (7926341254248677376L, 17179873468420L, 0L, 0L, ) + return data + public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) + private static def mk_tokenSet_22_() as (long): + data = (3423017191732074274L, 17188463405060L, 0L, 0L, ) + return data + public static final tokenSet_22_ = BitSet(mk_tokenSet_22_()) + private static def mk_tokenSet_23_() as (long): + data = (-18858823443884174L, 17540646436863L, 0L, 0L, ) + return data + public static final tokenSet_23_ = BitSet(mk_tokenSet_23_()) + private static def mk_tokenSet_24_() as (long): + data = (-18014398509490190L, 17540646436863L, 0L, 0L, ) + return data + public static final tokenSet_24_ = BitSet(mk_tokenSet_24_()) + private static def mk_tokenSet_25_() as (long): + data = (8804700000512L, 0L, ) + return data + public static final tokenSet_25_ = BitSet(mk_tokenSet_25_()) + private static def mk_tokenSet_26_() as (long): + data = (4576783121269120930L, 17188463405060L, 0L, 0L, ) + return data + public static final tokenSet_26_ = BitSet(mk_tokenSet_26_()) + private static def mk_tokenSet_27_() as (long): + data = (-18014398513684494L, 17540646436863L, 0L, 0L, ) + return data + public static final tokenSet_27_ = BitSet(mk_tokenSet_27_()) + private static def mk_tokenSet_28_() as (long): + data = (26490905596160L, 8589934592L, 0L, 0L, ) + return data + public static final tokenSet_28_ = BitSet(mk_tokenSet_28_()) + private static def mk_tokenSet_29_() as (long): + data = (26490905596160L, 0L, ) + return data + public static final tokenSet_29_ = BitSet(mk_tokenSet_29_()) + private static def mk_tokenSet_30_() as (long): + data = (144141713341714688L, 0L, ) + return data + public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) + private static def mk_tokenSet_31_() as (long): + data = (144115224583635200L, 0L, ) + return data + public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) + private static def mk_tokenSet_32_() as (long): + data = (4467852305279932194L, 17188463405060L, 0L, 0L, ) + return data + public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) + private static def mk_tokenSet_33_() as (long): + data = (-126100789568479246L, 17540646436863L, 0L, 0L, ) + return data + public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) + private static def mk_tokenSet_34_() as (long): + data = (576460752303423488L, 536870912L, 0L, 0L, ) + return data + public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) + private static def mk_tokenSet_35_() as (long): + data = (1152921504607109120L, 8589934592L, 0L, 0L, ) + return data + public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) + private static def mk_tokenSet_36_() as (long): + data = (9080382748645908386L, 17188463409159L, 0L, 0L, ) + return data + public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) + private static def mk_tokenSet_37_() as (long): + data = (4611686018427387904L, 0L, ) + return data + public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) + private static def mk_tokenSet_38_() as (long): + data = (1152921504606846976L, 2L, 0L, 0L, ) + return data + public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) + private static def mk_tokenSet_39_() as (long): + data = (4468696730210131874L, 17188463405060L, 0L, 0L, ) + return data + public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) + private static def mk_tokenSet_40_() as (long): + data = (4467834610534729248L, 17179873470468L, 0L, 0L, ) + return data + public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) + private static def mk_tokenSet_41_() as (long): + data = (-4755537426278103440L, 17458773618398L, 0L, 0L, ) + return data + public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) + private static def mk_tokenSet_42_() as (long): + data = (144123986316394496L, 0L, ) + return data + public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) + private static def mk_tokenSet_43_() as (long): + data = (144115190231760896L, 0L, ) + return data + public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) + private static def mk_tokenSet_44_() as (long): + data = (3314664031914311680L, 17179873470468L, 0L, 0L, ) + return data + public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) + private static def mk_tokenSet_45_() as (long): + data = (-4738906795634540464L, 17532056502268L, 0L, 0L, ) + return data + public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) + private static def mk_tokenSet_46_() as (long): + data = (-4754675310897668110L, 17467363552988L, 0L, 0L, ) + return data + public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) + private static def mk_tokenSet_47_() as (long): + data = (4468696725923553186L, 17188463409156L, 0L, 0L, ) + return data + public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) + private static def mk_tokenSet_48_() as (long): + data = (9080382744342552482L, 17188463405060L, 0L, 0L, ) + return data + public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) + private static def mk_tokenSet_49_() as (long): + data = (5188146770730811392L, 8L, 0L, 0L, ) + return data + public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) + private static def mk_tokenSet_50_() as (long): + data = (0L, 10L, 0L, 0L, ) + return data + public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) + private static def mk_tokenSet_51_() as (long): + data = (3314655235821289472L, 17179873468421L, 0L, 0L, ) + return data + public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) + private static def mk_tokenSet_52_() as (long): + data = (144115222436118528L, 33554432L, 0L, 0L, ) + return data + public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) + private static def mk_tokenSet_53_() as (long): + data = (41943040L, 1711276032L, 0L, 0L, ) + return data + public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) + private static def mk_tokenSet_54_() as (long): + data = (0L, 26738688L, 0L, 0L, ) + return data + public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) + private static def mk_tokenSet_55_() as (long): + data = (-4755795296384565168L, 17458773616348L, 0L, 0L, ) + return data + public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) + private static def mk_tokenSet_56_() as (long): + data = (3314655235821289472L, 17179873468428L, 0L, 0L, ) + return data + public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) + diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.boo b/src/UnityScript/Parser/UnityScriptTokenTypes.boo index 34e5f3c..c1d304f 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.boo +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.boo @@ -1,125 +1,125 @@ -// $ANTLR 2.7.5 (20050517): "UnityScript.g" -> "UnityScriptLexer.boo"$ - -namespace UnityScript.Parser -class UnityScriptTokenTypes: - public static final EOF = 1 - public static final NULL_TREE_LOOKAHEAD = 3 - public static final AS = 4 - public static final BREAK = 5 - public static final CAST = 6 - public static final CATCH = 7 - public static final CLASS = 8 - public static final CONTINUE = 9 - public static final DO = 10 - public static final ELSE = 11 - public static final ENUM = 12 - public static final EXTENDS = 13 - public static final FALSE = 14 - public static final FINAL = 15 - public static final FINALLY = 16 - public static final FOR = 17 - public static final FUNCTION = 18 - public static final GET = 19 - public static final IF = 20 - public static final IMPORT = 21 - public static final IMPLEMENTS = 22 - public static final IN = 23 - public static final INTERFACE = 24 - public static final INSTANCEOF = 25 - public static final NEW = 26 - public static final NULL = 27 - public static final RETURN = 28 - public static final PUBLIC = 29 - public static final PROTECTED = 30 - public static final INTERNAL = 31 - public static final OVERRIDE = 32 - public static final PARTIAL = 33 - public static final PRIVATE = 34 - public static final SET = 35 - public static final STATIC = 36 - public static final SUPER = 37 - public static final THIS = 38 - public static final THROW = 39 - public static final TRUE = 40 - public static final TRY = 41 - public static final TYPEOF = 42 - public static final VAR = 43 - public static final VIRTUAL = 44 - public static final WHILE = 45 - public static final YIELD = 46 - public static final SWITCH = 47 - public static final CASE = 48 - public static final DEFAULT = 49 - public static final INPLACE_DIVISION = 50 - public static final INPLACE_ADD = 51 - public static final INPLACE_SUBTRACT = 52 - public static final INPLACE_MULTIPLY = 53 - public static final SL_COMMENT = 54 - public static final PRAGMA_ON = 55 - public static final PRAGMA_OFF = 56 - public static final ID = 57 - public static final DOUBLE_QUOTED_STRING = 58 - public static final LBRACE = 59 - public static final RBRACE = 60 - public static final LPAREN = 61 - public static final RPAREN = 62 - public static final DOT = 63 - public static final COLON = 64 - public static final COMMA = 65 - public static final LBRACK = 66 - public static final RBRACK = 67 - public static final BITWISE_OR = 68 - public static final INPLACE_BITWISE_OR = 69 - public static final BITWISE_AND = 70 - public static final BITWISE_XOR = 71 - public static final INPLACE_BITWISE_AND = 72 - public static final LOGICAL_OR = 73 - public static final LOGICAL_AND = 74 - public static final EOS = 75 - public static final ASSIGN = 76 - public static final INCREMENT = 77 - public static final DECREMENT = 78 - public static final ADD = 79 - public static final SUBTRACT = 80 - public static final MODULUS = 81 - public static final MULTIPLY = 82 - public static final EQUALITY = 83 - public static final INEQUALITY = 84 - public static final QUESTION_MARK = 85 - public static final BITWISE_NOT = 86 - public static final REFERENCE_EQUALITY = 87 - public static final REFERENCE_INEQUALITY = 88 - public static final LESS_THAN = 89 - public static final LESS_THAN_OR_EQUAL = 90 - public static final SHIFT_LEFT = 91 - public static final INPLACE_SHIFT_LEFT = 92 - public static final GREATER_THAN = 93 - public static final GREATER_THAN_OR_EQUAL = 94 - public static final SHIFT_RIGHT = 95 - public static final INPLACE_SHIFT_RIGHT = 96 - public static final AT = 97 - public static final SCRIPT_ATTRIBUTE_MARKER = 98 - public static final ASSEMBLY_ATTRIBUTE_MARKER = 99 - public static final INPLACE_BITWISE_XOR = 100 - public static final NOT = 101 - public static final DIVISION = 102 - public static final RE_LITERAL = 103 - public static final DOUBLE = 104 - public static final INT = 105 - public static final LONG = 106 - public static final SINGLE_QUOTED_STRING = 107 - public static final DOUBLE_SUFFIX = 108 - public static final EXPONENT = 109 - public static final PRAGMA_WHITE_SPACE = 110 - public static final WHITE_SPACE = 111 - public static final DQS_ESC = 112 - public static final SQS_ESC = 113 - public static final SESC = 114 - public static final ML_COMMENT = 115 - public static final RE_CHAR = 116 - public static final RE_ESC = 117 - public static final NEWLINE = 118 - public static final ID_LETTER = 119 - public static final DIGIT = 120 - public static final HEXDIGIT = 121 - +// $ANTLR 2.7.5 (20050517): "src/UnityScript/UnityScript.g" -> "UnityScriptLexer.boo"$ + +namespace UnityScript.Parser +class UnityScriptTokenTypes: + public static final EOF = 1 + public static final NULL_TREE_LOOKAHEAD = 3 + public static final AS = 4 + public static final BREAK = 5 + public static final CAST = 6 + public static final CATCH = 7 + public static final CLASS = 8 + public static final CONTINUE = 9 + public static final DO = 10 + public static final ELSE = 11 + public static final ENUM = 12 + public static final EXTENDS = 13 + public static final FALSE = 14 + public static final FINAL = 15 + public static final FINALLY = 16 + public static final FOR = 17 + public static final FUNCTION = 18 + public static final GET = 19 + public static final IF = 20 + public static final IMPORT = 21 + public static final IMPLEMENTS = 22 + public static final IN = 23 + public static final INTERFACE = 24 + public static final INSTANCEOF = 25 + public static final NEW = 26 + public static final NULL = 27 + public static final RETURN = 28 + public static final PUBLIC = 29 + public static final PROTECTED = 30 + public static final INTERNAL = 31 + public static final OVERRIDE = 32 + public static final PARTIAL = 33 + public static final PRIVATE = 34 + public static final SET = 35 + public static final STATIC = 36 + public static final SUPER = 37 + public static final THIS = 38 + public static final THROW = 39 + public static final TRUE = 40 + public static final TRY = 41 + public static final TYPEOF = 42 + public static final VAR = 43 + public static final VIRTUAL = 44 + public static final WHILE = 45 + public static final YIELD = 46 + public static final SWITCH = 47 + public static final CASE = 48 + public static final DEFAULT = 49 + public static final INPLACE_DIVISION = 50 + public static final INPLACE_ADD = 51 + public static final INPLACE_SUBTRACT = 52 + public static final INPLACE_MULTIPLY = 53 + public static final SL_COMMENT = 54 + public static final PRAGMA_ON = 55 + public static final PRAGMA_OFF = 56 + public static final ID = 57 + public static final DOUBLE_QUOTED_STRING = 58 + public static final LBRACE = 59 + public static final RBRACE = 60 + public static final LPAREN = 61 + public static final RPAREN = 62 + public static final DOT = 63 + public static final COLON = 64 + public static final COMMA = 65 + public static final LBRACK = 66 + public static final RBRACK = 67 + public static final BITWISE_OR = 68 + public static final INPLACE_BITWISE_OR = 69 + public static final BITWISE_AND = 70 + public static final BITWISE_XOR = 71 + public static final INPLACE_BITWISE_AND = 72 + public static final LOGICAL_OR = 73 + public static final LOGICAL_AND = 74 + public static final EOS = 75 + public static final ASSIGN = 76 + public static final INCREMENT = 77 + public static final DECREMENT = 78 + public static final ADD = 79 + public static final SUBTRACT = 80 + public static final MODULUS = 81 + public static final MULTIPLY = 82 + public static final EQUALITY = 83 + public static final INEQUALITY = 84 + public static final QUESTION_MARK = 85 + public static final BITWISE_NOT = 86 + public static final REFERENCE_EQUALITY = 87 + public static final REFERENCE_INEQUALITY = 88 + public static final LESS_THAN = 89 + public static final LESS_THAN_OR_EQUAL = 90 + public static final SHIFT_LEFT = 91 + public static final INPLACE_SHIFT_LEFT = 92 + public static final GREATER_THAN = 93 + public static final GREATER_THAN_OR_EQUAL = 94 + public static final SHIFT_RIGHT = 95 + public static final INPLACE_SHIFT_RIGHT = 96 + public static final AT = 97 + public static final SCRIPT_ATTRIBUTE_MARKER = 98 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 99 + public static final INPLACE_BITWISE_XOR = 100 + public static final NOT = 101 + public static final DIVISION = 102 + public static final RE_LITERAL = 103 + public static final DOUBLE = 104 + public static final INT = 105 + public static final LONG = 106 + public static final SINGLE_QUOTED_STRING = 107 + public static final DOUBLE_SUFFIX = 108 + public static final EXPONENT = 109 + public static final PRAGMA_WHITE_SPACE = 110 + public static final WHITE_SPACE = 111 + public static final DQS_ESC = 112 + public static final SQS_ESC = 113 + public static final SESC = 114 + public static final ML_COMMENT = 115 + public static final RE_CHAR = 116 + public static final RE_ESC = 117 + public static final NEWLINE = 118 + public static final ID_LETTER = 119 + public static final DIGIT = 120 + public static final HEXDIGIT = 121 + diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.txt b/src/UnityScript/Parser/UnityScriptTokenTypes.txt index 97a883f..b3aa8d2 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.txt +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.txt @@ -1,120 +1,120 @@ -// $ANTLR 2.7.5 (20050517): UnityScript.g -> UnityScriptTokenTypes.txt$ -UnityScript // output token vocab name -AS="as"=4 -BREAK="break"=5 -CAST="cast"=6 -CATCH="catch"=7 -CLASS="class"=8 -CONTINUE="continue"=9 -DO="do"=10 -ELSE="else"=11 -ENUM="enum"=12 -EXTENDS="extends"=13 -FALSE="false"=14 -FINAL="final"=15 -FINALLY="finally"=16 -FOR="for"=17 -FUNCTION="function"=18 -GET="get"=19 -IF="if"=20 -IMPORT="import"=21 -IMPLEMENTS="implements"=22 -IN="in"=23 -INTERFACE="interface"=24 -INSTANCEOF="instanceof"=25 -NEW="new"=26 -NULL="null"=27 -RETURN="return"=28 -PUBLIC="public"=29 -PROTECTED="protected"=30 -INTERNAL="internal"=31 -OVERRIDE="override"=32 -PARTIAL="partial"=33 -PRIVATE="private"=34 -SET="set"=35 -STATIC="static"=36 -SUPER="super"=37 -THIS="this"=38 -THROW="throw"=39 -TRUE="true"=40 -TRY="try"=41 -TYPEOF="typeof"=42 -VAR="var"=43 -VIRTUAL="virtual"=44 -WHILE="while"=45 -YIELD="yield"=46 -SWITCH="switch"=47 -CASE="case"=48 -DEFAULT="default"=49 -INPLACE_DIVISION="/="=50 -INPLACE_ADD="+="=51 -INPLACE_SUBTRACT="-="=52 -INPLACE_MULTIPLY="*="=53 -SL_COMMENT="//"=54 -PRAGMA_ON="pragma on"=55 -PRAGMA_OFF="pragma off"=56 -ID="an identifier"=57 -DOUBLE_QUOTED_STRING="a string"=58 -LBRACE="{"=59 -RBRACE="}"=60 -LPAREN="("=61 -RPAREN=")"=62 -DOT="."=63 -COLON=":"=64 -COMMA=","=65 -LBRACK="["=66 -RBRACK="]"=67 -BITWISE_OR="|"=68 -INPLACE_BITWISE_OR="|="=69 -BITWISE_AND="&"=70 -BITWISE_XOR="^"=71 -INPLACE_BITWISE_AND="&="=72 -LOGICAL_OR="||"=73 -LOGICAL_AND="&&"=74 -EOS=";"=75 -ASSIGN="="=76 -INCREMENT="++"=77 -DECREMENT="--"=78 -ADD="+"=79 -SUBTRACT="-"=80 -MODULUS="%"=81 -MULTIPLY="*"=82 -EQUALITY="=="=83 -INEQUALITY="!="=84 -QUESTION_MARK="?"=85 -BITWISE_NOT="~"=86 -REFERENCE_EQUALITY="==="=87 -REFERENCE_INEQUALITY="!=="=88 -LESS_THAN="<"=89 -LESS_THAN_OR_EQUAL="<="=90 -SHIFT_LEFT="<<"=91 -INPLACE_SHIFT_LEFT="<<="=92 -GREATER_THAN=">"=93 -GREATER_THAN_OR_EQUAL=">="=94 -SHIFT_RIGHT=">>"=95 -INPLACE_SHIFT_RIGHT=">>="=96 -AT="@"=97 -SCRIPT_ATTRIBUTE_MARKER="@script"=98 -ASSEMBLY_ATTRIBUTE_MARKER="@assembly"=99 -INPLACE_BITWISE_XOR=100 -NOT=101 -DIVISION=102 -RE_LITERAL=103 -DOUBLE=104 -INT=105 -LONG=106 -SINGLE_QUOTED_STRING=107 -DOUBLE_SUFFIX=108 -EXPONENT=109 -PRAGMA_WHITE_SPACE=110 -WHITE_SPACE=111 -DQS_ESC=112 -SQS_ESC=113 -SESC=114 -ML_COMMENT=115 -RE_CHAR=116 -RE_ESC=117 -NEWLINE=118 -ID_LETTER=119 -DIGIT=120 -HEXDIGIT=121 +// $ANTLR 2.7.5 (20050517): src/UnityScript/UnityScript.g -> UnityScriptTokenTypes.txt$ +UnityScript // output token vocab name +AS="as"=4 +BREAK="break"=5 +CAST="cast"=6 +CATCH="catch"=7 +CLASS="class"=8 +CONTINUE="continue"=9 +DO="do"=10 +ELSE="else"=11 +ENUM="enum"=12 +EXTENDS="extends"=13 +FALSE="false"=14 +FINAL="final"=15 +FINALLY="finally"=16 +FOR="for"=17 +FUNCTION="function"=18 +GET="get"=19 +IF="if"=20 +IMPORT="import"=21 +IMPLEMENTS="implements"=22 +IN="in"=23 +INTERFACE="interface"=24 +INSTANCEOF="instanceof"=25 +NEW="new"=26 +NULL="null"=27 +RETURN="return"=28 +PUBLIC="public"=29 +PROTECTED="protected"=30 +INTERNAL="internal"=31 +OVERRIDE="override"=32 +PARTIAL="partial"=33 +PRIVATE="private"=34 +SET="set"=35 +STATIC="static"=36 +SUPER="super"=37 +THIS="this"=38 +THROW="throw"=39 +TRUE="true"=40 +TRY="try"=41 +TYPEOF="typeof"=42 +VAR="var"=43 +VIRTUAL="virtual"=44 +WHILE="while"=45 +YIELD="yield"=46 +SWITCH="switch"=47 +CASE="case"=48 +DEFAULT="default"=49 +INPLACE_DIVISION="/="=50 +INPLACE_ADD="+="=51 +INPLACE_SUBTRACT="-="=52 +INPLACE_MULTIPLY="*="=53 +SL_COMMENT="//"=54 +PRAGMA_ON="pragma on"=55 +PRAGMA_OFF="pragma off"=56 +ID="an identifier"=57 +DOUBLE_QUOTED_STRING="a string"=58 +LBRACE="{"=59 +RBRACE="}"=60 +LPAREN="("=61 +RPAREN=")"=62 +DOT="."=63 +COLON=":"=64 +COMMA=","=65 +LBRACK="["=66 +RBRACK="]"=67 +BITWISE_OR="|"=68 +INPLACE_BITWISE_OR="|="=69 +BITWISE_AND="&"=70 +BITWISE_XOR="^"=71 +INPLACE_BITWISE_AND="&="=72 +LOGICAL_OR="||"=73 +LOGICAL_AND="&&"=74 +EOS=";"=75 +ASSIGN="="=76 +INCREMENT="++"=77 +DECREMENT="--"=78 +ADD="+"=79 +SUBTRACT="-"=80 +MODULUS="%"=81 +MULTIPLY="*"=82 +EQUALITY="=="=83 +INEQUALITY="!="=84 +QUESTION_MARK="?"=85 +BITWISE_NOT="~"=86 +REFERENCE_EQUALITY="==="=87 +REFERENCE_INEQUALITY="!=="=88 +LESS_THAN="<"=89 +LESS_THAN_OR_EQUAL="<="=90 +SHIFT_LEFT="<<"=91 +INPLACE_SHIFT_LEFT="<<="=92 +GREATER_THAN=">"=93 +GREATER_THAN_OR_EQUAL=">="=94 +SHIFT_RIGHT=">>"=95 +INPLACE_SHIFT_RIGHT=">>="=96 +AT="@"=97 +SCRIPT_ATTRIBUTE_MARKER="@script"=98 +ASSEMBLY_ATTRIBUTE_MARKER="@assembly"=99 +INPLACE_BITWISE_XOR=100 +NOT=101 +DIVISION=102 +RE_LITERAL=103 +DOUBLE=104 +INT=105 +LONG=106 +SINGLE_QUOTED_STRING=107 +DOUBLE_SUFFIX=108 +EXPONENT=109 +PRAGMA_WHITE_SPACE=110 +WHITE_SPACE=111 +DQS_ESC=112 +SQS_ESC=113 +SESC=114 +ML_COMMENT=115 +RE_CHAR=116 +RE_ESC=117 +NEWLINE=118 +ID_LETTER=119 +DIGIT=120 +HEXDIGIT=121 diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g old mode 100644 new mode 100755 index 13f35af..c3ef074 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -232,12 +232,15 @@ tokens static def CreateModuleName(fname as string): return System.IO.Path.GetFileNameWithoutExtension(fname) + static def IsConstructorName(name as string, type as TypeDefinition): + return type.NodeType != NodeType.Module and name == type.Name + def AddFunctionTo(type as TypeDefinition, nameToken as IToken, getter as IToken, setter as IToken): name = nameToken.getText() location = ToLexicalInfo(nameToken) - function as Method = (Constructor(location) if name == type.Name else Method(location, Name: name)) + function as Method = (Constructor(location) if IsConstructorName(name, type) else Method(location, Name: name)) if getter is not null or setter is not null: p = type.Members[name] as Property if p is null: @@ -364,24 +367,12 @@ module_member[Module module] mm=class_declaration[module] | mm=interface_declaration[module] | mm=enum_declaration[module] - | mm=module_function[module] + | mm=function_member[module] ) { mm.Modifiers |= mod if mm is not null } ) ; -module_function[TypeDefinition parent] returns [TypeMember member] -{ -}: - FUNCTION name:ID - { - member = method = Method(ToLexicalInfo(name), Name: name.getText()) - FlushAttributes(method) - parent.Members.Add(method) - } - function_body[method] -; - script_or_assembly_attribute[Module m] { }: @@ -629,7 +620,7 @@ field_member[TypeDefinition cd] returns [TypeMember member] } ; -function_member[ClassDefinition cd] returns [TypeMember member] +function_member[TypeDefinition cd] returns [TypeMember member] { }: FUNCTION (getter:GET | setter:SET)? memberName=identifier diff --git a/tests/integration/script-properties.js b/tests/integration/script-properties.js new file mode 100755 index 0000000..bf5d609 --- /dev/null +++ b/tests/integration/script-properties.js @@ -0,0 +1,17 @@ +/* +42 +-1 +*/ +private var _v = 42; + +function get v() { + return _v; +} + +function set v(value) { + _v = value; +} + +print(v); +v = -1; +print(v); From 806e0521cf80635c89b9e0ecf97933a212270db1 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 9 Apr 2012 16:37:15 -0300 Subject: [PATCH 228/276] parameterize tab size used by the parser to calculate line, column information --- .../Parser/UnityScriptParserExtensions.boo | 14 +++++++++++--- src/UnityScript/UnityScriptCompilerParameters.boo | 4 ++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/UnityScript/Parser/UnityScriptParserExtensions.boo b/src/UnityScript/Parser/UnityScriptParserExtensions.boo index 00480a6..4c1d68c 100755 --- a/src/UnityScript/Parser/UnityScriptParserExtensions.boo +++ b/src/UnityScript/Parser/UnityScriptParserExtensions.boo @@ -3,11 +3,12 @@ namespace UnityScript.Parser import System.IO import Boo.Lang.Compiler import Boo.Lang.Compiler.Ast +import PatternMatching partial class UnityScriptParser: static def ParseReader(reader as TextReader, fileName as string, context as CompilerContext, targetCompileUnit as CompileUnit): - lexer = UnityScriptLexerFor(reader, fileName) + lexer = UnityScriptLexerFor(reader, fileName, TabSizeFromContext(context)) if lexer is null: targetCompileUnit.Modules.Add(Module(LexicalInfo(fileName, 1, 1))) return @@ -29,7 +30,7 @@ partial class UnityScriptParser: Otherwise tries to parse an expression reporting errors in the compiler context passed as argument. """ - lexer = UnityScriptLexerFor(expression, fileName) + lexer = UnityScriptLexerFor(expression, fileName, TabSizeFromContext(context)) if lexer is null: return null @@ -41,13 +42,20 @@ partial class UnityScriptParser: except x as antlr.TokenStreamRecognitionException: parser.reportError(x.recog) - static def UnityScriptLexerFor(reader as TextReader, fileName as string): + static def UnityScriptLexerFor(reader as TextReader, fileName as string, tabSize as int): if reader.Peek() == -1: return null lexer = UnityScriptLexer(reader) lexer.setFilename(fileName) lexer.setTokenCreator(Boo.Lang.Parser.BooToken.BooTokenCreator()) + lexer.setTabSize(tabSize) return lexer + static def TabSizeFromContext(context as CompilerContext): + match context: + case CompilerContext(Parameters: UnityScriptCompilerParameters(TabSize: t)): + return t + otherwise: + return UnityScriptCompilerParameters.DefaultTabSize \ No newline at end of file diff --git a/src/UnityScript/UnityScriptCompilerParameters.boo b/src/UnityScript/UnityScriptCompilerParameters.boo index 84cd9e3..6bf46d0 100755 --- a/src/UnityScript/UnityScriptCompilerParameters.boo +++ b/src/UnityScript/UnityScriptCompilerParameters.boo @@ -10,6 +10,8 @@ import UnityScript.TypeSystem class UnityScriptCompilerParameters(CompilerParameters): + public static final DefaultTabSize = 8 + property ScriptBaseType as System.Type property ScriptMainMethod as string @@ -22,6 +24,8 @@ class UnityScriptCompilerParameters(CompilerParameters): property DisableEval as string + property TabSize = DefaultTabSize + def constructor(loadDefaultReferences as bool): super(Boo.Lang.Compiler.TypeSystem.Reflection.ReflectionTypeSystemProvider(), loadDefaultReferences) self.Checked = false From 784f5c46c205dc4eee59ba2311ad80b656519058 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 12 Apr 2012 03:04:40 +0200 Subject: [PATCH 229/276] Extend => AddRange --- src/UnityScript/Parser/CodeFactory.boo | 2 +- src/UnityScript/Parser/UnityScriptParser.boo | 2 +- src/UnityScript/Steps/ApplySemantics.boo | 6 +++--- .../Steps/EvaluationDomainProviderImplementor.boo | 2 +- src/UnityScript/UnityScript.g | 2 +- src/us/UnityScriptCompilerFactory.boo | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) mode change 100644 => 100755 src/UnityScript/Steps/ApplySemantics.boo diff --git a/src/UnityScript/Parser/CodeFactory.boo b/src/UnityScript/Parser/CodeFactory.boo index ad15300..7ac9aa2 100755 --- a/src/UnityScript/Parser/CodeFactory.boo +++ b/src/UnityScript/Parser/CodeFactory.boo @@ -17,7 +17,7 @@ static class CodeFactory: size = dimensions[0] return [| Boo.Lang.Builtins.array[of $elementType](cast(int, $size)) |].WithLocation(location) initializer = [| Boo.Lang.Builtins.matrix[of $elementType]() |].WithLocation(location) - initializer.Arguments.Extend(dimensions) + initializer.Arguments.AddRange(dimensions) return initializer def NewDoubleLiteralExpression(location as LexicalInfo, literal as string): diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 2a6b551..53a04c9 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -186,7 +186,7 @@ partial class UnityScriptParser(antlr.LLkParser): return node.ContainsAnnotation("LabelInUse") def FlushAttributes(node as INodeWithAttributes): - node.Attributes.Extend(_attributes) + node.Attributes.AddRange(_attributes) _attributes.Clear() def GlobalVariablesBecomeFields(): diff --git a/src/UnityScript/Steps/ApplySemantics.boo b/src/UnityScript/Steps/ApplySemantics.boo old mode 100644 new mode 100755 index 82fed36..181983e --- a/src/UnityScript/Steps/ApplySemantics.boo +++ b/src/UnityScript/Steps/ApplySemantics.boo @@ -68,7 +68,7 @@ class ApplySemantics(AbstractVisitorCompilerStep): else: Warnings.Add(UnityScriptWarnings.ScriptMainMethodIsImplicitlyDefined(main.LexicalInfo, main.Name)) - main.Body.Statements.Extend(module.Globals.Statements) + main.Body.Statements.AddRange(module.Globals.Statements) module.Globals.Statements.Clear() def TransformGlobalVariablesIntoFields(module as Module, script as TypeDefinition): @@ -92,7 +92,7 @@ class ApplySemantics(AbstractVisitorCompilerStep): module.Imports.Add(Import(ns)) def MoveAttributes(fromType as TypeDefinition, toType as TypeDefinition): - toType.Attributes.Extend(fromType.Attributes) + toType.Attributes.AddRange(fromType.Attributes) fromType.Attributes.Clear() def MoveMembers(fromType as TypeDefinition, toType as TypeDefinition): @@ -128,7 +128,7 @@ class ApplySemantics(AbstractVisitorCompilerStep): EndSourceLocation: method.EndSourceLocation) def FindOrCreateScriptClass(module as Module): - for existing as ClassDefinition in module.Members.Select(NodeType.ClassDefinition): + for existing in module.Members.OfType of ClassDefinition(): if existing.Name == module.Name: module.Members.Remove(existing) if existing.IsPartial: AddScriptBaseType(existing) diff --git a/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo b/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo index 164c84c..dbdc0ae 100755 --- a/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo +++ b/src/UnityScript/Steps/EvaluationDomainProviderImplementor.boo @@ -40,7 +40,7 @@ class EvaluationDomainProviderImplementor(AbstractCompilerComponent): private def ImportsArrayFor(node as ClassDefinition): result = [| (of $string:,) |] - result.Items.Extend([| $(i.Namespace) |] for i in node.EnclosingModule.Imports) + result.Items.AddRange([| $(i.Namespace) |] for i in node.EnclosingModule.Imports) return result private def CreateStaticEvaluationDomainProviderReferenceOn(node as ClassDefinition): diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index c3ef074..629986c 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -164,7 +164,7 @@ tokens return node.ContainsAnnotation("LabelInUse") def FlushAttributes(node as INodeWithAttributes): - node.Attributes.Extend(_attributes) + node.Attributes.AddRange(_attributes) _attributes.Clear() def GlobalVariablesBecomeFields(): diff --git a/src/us/UnityScriptCompilerFactory.boo b/src/us/UnityScriptCompilerFactory.boo index c10b440..786b6fb 100755 --- a/src/us/UnityScriptCompilerFactory.boo +++ b/src/us/UnityScriptCompilerFactory.boo @@ -63,7 +63,7 @@ class UnityScriptCompilerFactory: compiler.Parameters.Debug = options.Debug compiler.Parameters.Expando = options.Expando compiler.Parameters.DisableEval = options.DisableEval - compiler.Parameters.Imports.Extend(options.Imports) + compiler.Parameters.Imports.AddRange(options.Imports) if options.TypeInferenceRuleAttribute: compiler.Parameters.AddToEnvironment( From a94a1f2c19efe3bd0e9ba081b8df6dfc37bb3985 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 4 May 2012 23:29:10 +0200 Subject: [PATCH 230/276] update to latest boo api --- src/UnityScript/Steps/CheckBaseTypes.boo | 1 - src/UnityScript/Steps/ProcessUnityScriptMethods.boo | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) mode change 100644 => 100755 src/UnityScript/Steps/CheckBaseTypes.boo mode change 100644 => 100755 src/UnityScript/Steps/ProcessUnityScriptMethods.boo diff --git a/src/UnityScript/Steps/CheckBaseTypes.boo b/src/UnityScript/Steps/CheckBaseTypes.boo old mode 100644 new mode 100755 index e3974b8..08f9fba --- a/src/UnityScript/Steps/CheckBaseTypes.boo +++ b/src/UnityScript/Steps/CheckBaseTypes.boo @@ -3,7 +3,6 @@ namespace UnityScript.Steps import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.Steps import Boo.Lang.Compiler.TypeSystem -import Boo.Lang.Compiler.TypeSystem.IEntityExtensions import UnityScript.Core diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo old mode 100644 new mode 100755 index 48ce875..456c78d --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -147,7 +147,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): override protected def ProcessBuiltinInvocation(node as MethodInvocationExpression, function as BuiltinFunction): if function is UnityScriptTypeSystem.UnityScriptEval: - EvalAnnotation.Mark(_currentMethod.Method) + EvalAnnotation.Mark(CurrentMethod) BindExpressionType(node, TypeSystemServices.ObjectType) return if function is UnityScriptTypeSystem.UnityScriptTypeof: @@ -245,7 +245,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): def TransformIteration(node as ForStatement): iterator = CodeBuilder.DeclareLocal( - _currentMethod.Method, + CurrentMethod, _context.GetUniqueName("iterator"), TypeSystemServices.IEnumeratorType) iterator.IsUsed = true From d202f57ae2b675aed13dab12ee94584ddc86118a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 4 May 2012 23:30:21 +0200 Subject: [PATCH 231/276] test case for type checking of array index --- .../ErrorMessagesTestFixture.Generated.boo | 4 ++++ tests/error-messages/invalid-array-index.js | 13 +++++++++++++ 2 files changed, 17 insertions(+) create mode 100755 tests/error-messages/invalid-array-index.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index 72380ec..ce530ab 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -82,6 +82,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/interface-errors.js") + [Test] def invalid_array_index(): + RunTestCase("tests/error-messages/invalid-array-index.js") + + [Test] def invalid_attribute_sequence(): RunTestCase("tests/error-messages/invalid-attribute-sequence.js") diff --git a/tests/error-messages/invalid-array-index.js b/tests/error-messages/invalid-array-index.js new file mode 100755 index 0000000..14b1db6 --- /dev/null +++ b/tests/error-messages/invalid-array-index.js @@ -0,0 +1,13 @@ +/* +invalid-array-index.js(11,25): BCE0022: Cannot convert 'UnityScript.Tests.CSharp.Vector3' to 'int'. +*/ +import UnityScript.Tests.CSharp; + +var tiles : int[,]; +var v2 = Vector3(1, 1, 1); + +function Start () { + tiles = new int[5, 5]; + print (tiles[0, v2]); +} + From dd4aa4704987473ff05d379a67521c64e1e0461d Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 25 Jul 2012 10:29:00 -0300 Subject: [PATCH 232/276] introduce 'each' contextual keyword so that 'for each' is accepted as a valid construct --- src/UnityScript/UnityScript.g | 26 +++++++++++++++++--------- tests/parser/for-each-in-1.js | 15 +++++++++++++++ tests/parser/for-each-in-2.js | 16 ++++++++++++++++ 3 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 tests/parser/for-each-in-1.js create mode 100644 tests/parser/for-each-in-2.js diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 629986c..bafbb33 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -32,6 +32,7 @@ tokens CONTINUE="continue"; DO="do"; ELSE="else"; + EACH="each"; ENUM="enum"; EXTENDS="extends"; FALSE="false"; @@ -603,6 +604,7 @@ identifier returns [antlr.IToken token] name:ID { token = name; } | f:FINAL { token = f; KeywordCannotBeUsedAsAnIdentifier(token); } | i:INTERNAL { token = i; KeywordCannotBeUsedAsAnIdentifier(token); } + | e:EACH { token = e; } ; field_member[TypeDefinition cd] returns [TypeMember member] @@ -781,14 +783,18 @@ for_statement [Block container] { }: f:FOR - LPAREN ( - ((identifier | declaration) IN)=>stmt=for_in[container] - | stmt=for_c[container] + (EACH LPAREN stmt=for_in[container]) + | + ( + LPAREN + ( + ((identifier | declaration) IN) => stmt=for_in[container] + | stmt=for_c[container] + ) + ) ) - { - stmt.LexicalInfo = ToLexicalInfo(f) if stmt is not null - } + { stmt.LexicalInfo = ToLexicalInfo(f) if stmt is not null } ; for_c [Block container] returns [Statement stmt] @@ -1026,7 +1032,8 @@ member returns [Token name] }: id:ID { name=id; } | st:SET { name=st; } | - gt:GET { name=gt; } + gt:GET { name=gt; } | + eh:EACH { name=eh; } ; type_reference returns [TypeReference tr] @@ -1176,9 +1183,10 @@ function_expression returns [BlockExpression e] ; simple_reference_expression returns [Expression e] -{ +{ }: - id:ID { e = ReferenceExpression(ToLexicalInfo(id), Name: id.getText()) } + (id:ID | each:EACH { id = each }) + { e = ReferenceExpression(ToLexicalInfo(id), Name: id.getText()) } ; reference_expression returns [Expression e] diff --git a/tests/parser/for-each-in-1.js b/tests/parser/for-each-in-1.js new file mode 100644 index 0000000..314b968 --- /dev/null +++ b/tests/parser/for-each-in-1.js @@ -0,0 +1,15 @@ +/* +testString = 'Test' + +for i in testString: + print(i) +for k in testString: + print(k) +*/ +var testString = "Test"; +for each (var i in testString) { + print (i); +} +for each (k in testString) { + print (k); +} \ No newline at end of file diff --git a/tests/parser/for-each-in-2.js b/tests/parser/for-each-in-2.js new file mode 100644 index 0000000..a40d828 --- /dev/null +++ b/tests/parser/for-each-in-2.js @@ -0,0 +1,16 @@ +/* +def each(each as Object): + pass + +each = 'Test' + +for each in (1, 2, 3): + print(i) +*/ + +function each(each: Object) { +} + +var each = "Test"; +for each (var each in [1, 2, 3]) + print (i); \ No newline at end of file From 2f2481772dbf7cb3f1928a8f5be2740e2bb67581 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 25 Jul 2012 10:31:31 -0300 Subject: [PATCH 233/276] put back 'not in' operator (fixes regression #372593) --- src/UnityScript.Tests/DuckyIntegrationTestFixture.boo | 4 ++++ .../StrictIntegrationTestFixture.Generated.boo | 4 ++++ src/UnityScript/UnityScript.g | 6 ++++-- tests/integration/not-in.js | 7 +++++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 tests/integration/not-in.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 68ceccb..c3d1ade 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -458,6 +458,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/new-1.js") + [Test] def not_in(): + RunTestCase("tests/integration/not-in.js") + + [Test] def null_initializer(): RunTestCase("tests/integration/null-initializer.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo index b27b7fc..0c08598 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo @@ -456,6 +456,10 @@ partial class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/new-1.js") + [Test] def not_in(): + RunTestCase("tests/integration/not-in.js") + + [Test] def null_initializer(): RunTestCase("tests/integration/null-initializer.js") diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index bafbb33..cc9201b 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -48,6 +48,7 @@ tokens INTERFACE="interface"; INSTANCEOF="instanceof"; NEW="new"; + NOT="not"; NULL="null"; RETURN="return"; PUBLIC="public"; @@ -1421,7 +1422,7 @@ prefix_unary_expression returns [Expression e] sub:SUBTRACT { op = sub; uOperator = UnaryOperatorType.UnaryNegation; } | inc:INCREMENT { op = inc; uOperator = UnaryOperatorType.Increment; } | dec:DECREMENT { op = dec; uOperator = UnaryOperatorType.Decrement; } | - nt:NOT { op = nt; uOperator = UnaryOperatorType.LogicalNot; } | + nt:LOGICAL_NOT { op = nt; uOperator = UnaryOperatorType.LogicalNot; } | oc:BITWISE_NOT { op = oc; uOperator = UnaryOperatorType.OnesComplement; } ) e=unary_expression { e = UnaryExpression(ToLexicalInfo(op), uOperator, e) } @@ -1498,6 +1499,7 @@ comparison returns [Expression e] ( ( ( + (tni:NOT IN { op = BinaryOperatorType.NotMember; token = tni; } ) | (tin:IN { op = BinaryOperatorType.Member; token = tin; } ) | (tgt:GREATER_THAN { op = BinaryOperatorType.GreaterThan; token = tgt; } ) | (tgte:GREATER_THAN_OR_EQUAL { op = BinaryOperatorType.GreaterThanOrEqual; token = tgte }) | @@ -1887,7 +1889,7 @@ EQUALITY: "=="; INEQUALITY: "!="; -NOT: '!'; +LOGICAL_NOT: '!'; QUESTION_MARK: '?'; diff --git a/tests/integration/not-in.js b/tests/integration/not-in.js new file mode 100644 index 0000000..0fe9712 --- /dev/null +++ b/tests/integration/not-in.js @@ -0,0 +1,7 @@ +/* +not +yeah +*/ +var array = ["apple", "orange", "kiwi"]; +for each (var item in ["microsoft", "apple"]) + print(item not in array ? "not" : "yeah"); \ No newline at end of file From aac36f81e4edfe4f26ddc3394c8c295a88c94075 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 25 Jul 2012 10:43:06 -0300 Subject: [PATCH 234/276] update generated files --- .../ParserTestFixture.Generated.boo | 8 + src/UnityScript/Parser/UnityScriptLexer.boo | 532 ++++----- src/UnityScript/Parser/UnityScriptParser.boo | 1053 +++++++++-------- .../Parser/UnityScriptTokenTypes.boo | 222 ++-- .../Parser/UnityScriptTokenTypes.txt | 222 ++-- 5 files changed, 1068 insertions(+), 969 deletions(-) diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index 7694223..12a967f 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -66,6 +66,14 @@ partial class ParserTestFixture: RunTestCase("tests/parser/for-1.js") + [Test] def for_each_in_1(): + RunTestCase("tests/parser/for-each-in-1.js") + + + [Test] def for_each_in_2(): + RunTestCase("tests/parser/for-each-in-2.js") + + [Test] def for_loop_with_array_1(): RunTestCase("tests/parser/for-loop-with-array-1.js") diff --git a/src/UnityScript/Parser/UnityScriptLexer.boo b/src/UnityScript/Parser/UnityScriptLexer.boo index dd8fbb1..6e01560 100644 --- a/src/UnityScript/Parser/UnityScriptLexer.boo +++ b/src/UnityScript/Parser/UnityScriptLexer.boo @@ -40,116 +40,118 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): public static final CONTINUE = 9 public static final DO = 10 public static final ELSE = 11 - public static final ENUM = 12 - public static final EXTENDS = 13 - public static final FALSE = 14 - public static final FINAL = 15 - public static final FINALLY = 16 - public static final FOR = 17 - public static final FUNCTION = 18 - public static final GET = 19 - public static final IF = 20 - public static final IMPORT = 21 - public static final IMPLEMENTS = 22 - public static final IN = 23 - public static final INTERFACE = 24 - public static final INSTANCEOF = 25 - public static final NEW = 26 - public static final NULL = 27 - public static final RETURN = 28 - public static final PUBLIC = 29 - public static final PROTECTED = 30 - public static final INTERNAL = 31 - public static final OVERRIDE = 32 - public static final PARTIAL = 33 - public static final PRIVATE = 34 - public static final SET = 35 - public static final STATIC = 36 - public static final SUPER = 37 - public static final THIS = 38 - public static final THROW = 39 - public static final TRUE = 40 - public static final TRY = 41 - public static final TYPEOF = 42 - public static final VAR = 43 - public static final VIRTUAL = 44 - public static final WHILE = 45 - public static final YIELD = 46 - public static final SWITCH = 47 - public static final CASE = 48 - public static final DEFAULT = 49 - public static final INPLACE_DIVISION = 50 - public static final INPLACE_ADD = 51 - public static final INPLACE_SUBTRACT = 52 - public static final INPLACE_MULTIPLY = 53 - public static final SL_COMMENT = 54 - public static final PRAGMA_ON = 55 - public static final PRAGMA_OFF = 56 - public static final ID = 57 - public static final DOUBLE_QUOTED_STRING = 58 - public static final LBRACE = 59 - public static final RBRACE = 60 - public static final LPAREN = 61 - public static final RPAREN = 62 - public static final DOT = 63 - public static final COLON = 64 - public static final COMMA = 65 - public static final LBRACK = 66 - public static final RBRACK = 67 - public static final BITWISE_OR = 68 - public static final INPLACE_BITWISE_OR = 69 - public static final BITWISE_AND = 70 - public static final BITWISE_XOR = 71 - public static final INPLACE_BITWISE_AND = 72 - public static final LOGICAL_OR = 73 - public static final LOGICAL_AND = 74 - public static final EOS = 75 - public static final ASSIGN = 76 - public static final INCREMENT = 77 - public static final DECREMENT = 78 - public static final ADD = 79 - public static final SUBTRACT = 80 - public static final MODULUS = 81 - public static final MULTIPLY = 82 - public static final EQUALITY = 83 - public static final INEQUALITY = 84 - public static final QUESTION_MARK = 85 - public static final BITWISE_NOT = 86 - public static final REFERENCE_EQUALITY = 87 - public static final REFERENCE_INEQUALITY = 88 - public static final LESS_THAN = 89 - public static final LESS_THAN_OR_EQUAL = 90 - public static final SHIFT_LEFT = 91 - public static final INPLACE_SHIFT_LEFT = 92 - public static final GREATER_THAN = 93 - public static final GREATER_THAN_OR_EQUAL = 94 - public static final SHIFT_RIGHT = 95 - public static final INPLACE_SHIFT_RIGHT = 96 - public static final AT = 97 - public static final SCRIPT_ATTRIBUTE_MARKER = 98 - public static final ASSEMBLY_ATTRIBUTE_MARKER = 99 - public static final INPLACE_BITWISE_XOR = 100 - public static final NOT = 101 - public static final DIVISION = 102 - public static final RE_LITERAL = 103 - public static final DOUBLE = 104 - public static final INT = 105 - public static final LONG = 106 - public static final SINGLE_QUOTED_STRING = 107 - public static final DOUBLE_SUFFIX = 108 - public static final EXPONENT = 109 - public static final PRAGMA_WHITE_SPACE = 110 - public static final WHITE_SPACE = 111 - public static final DQS_ESC = 112 - public static final SQS_ESC = 113 - public static final SESC = 114 - public static final ML_COMMENT = 115 - public static final RE_CHAR = 116 - public static final RE_ESC = 117 - public static final NEWLINE = 118 - public static final ID_LETTER = 119 - public static final DIGIT = 120 - public static final HEXDIGIT = 121 + public static final EACH = 12 + public static final ENUM = 13 + public static final EXTENDS = 14 + public static final FALSE = 15 + public static final FINAL = 16 + public static final FINALLY = 17 + public static final FOR = 18 + public static final FUNCTION = 19 + public static final GET = 20 + public static final IF = 21 + public static final IMPORT = 22 + public static final IMPLEMENTS = 23 + public static final IN = 24 + public static final INTERFACE = 25 + public static final INSTANCEOF = 26 + public static final NEW = 27 + public static final NOT = 28 + public static final NULL = 29 + public static final RETURN = 30 + public static final PUBLIC = 31 + public static final PROTECTED = 32 + public static final INTERNAL = 33 + public static final OVERRIDE = 34 + public static final PARTIAL = 35 + public static final PRIVATE = 36 + public static final SET = 37 + public static final STATIC = 38 + public static final SUPER = 39 + public static final THIS = 40 + public static final THROW = 41 + public static final TRUE = 42 + public static final TRY = 43 + public static final TYPEOF = 44 + public static final VAR = 45 + public static final VIRTUAL = 46 + public static final WHILE = 47 + public static final YIELD = 48 + public static final SWITCH = 49 + public static final CASE = 50 + public static final DEFAULT = 51 + public static final INPLACE_DIVISION = 52 + public static final INPLACE_ADD = 53 + public static final INPLACE_SUBTRACT = 54 + public static final INPLACE_MULTIPLY = 55 + public static final SL_COMMENT = 56 + public static final PRAGMA_ON = 57 + public static final PRAGMA_OFF = 58 + public static final ID = 59 + public static final DOUBLE_QUOTED_STRING = 60 + public static final LBRACE = 61 + public static final RBRACE = 62 + public static final LPAREN = 63 + public static final RPAREN = 64 + public static final DOT = 65 + public static final COLON = 66 + public static final COMMA = 67 + public static final LBRACK = 68 + public static final RBRACK = 69 + public static final BITWISE_OR = 70 + public static final INPLACE_BITWISE_OR = 71 + public static final BITWISE_AND = 72 + public static final BITWISE_XOR = 73 + public static final INPLACE_BITWISE_AND = 74 + public static final LOGICAL_OR = 75 + public static final LOGICAL_AND = 76 + public static final EOS = 77 + public static final ASSIGN = 78 + public static final INCREMENT = 79 + public static final DECREMENT = 80 + public static final ADD = 81 + public static final SUBTRACT = 82 + public static final MODULUS = 83 + public static final MULTIPLY = 84 + public static final EQUALITY = 85 + public static final INEQUALITY = 86 + public static final QUESTION_MARK = 87 + public static final BITWISE_NOT = 88 + public static final REFERENCE_EQUALITY = 89 + public static final REFERENCE_INEQUALITY = 90 + public static final LESS_THAN = 91 + public static final LESS_THAN_OR_EQUAL = 92 + public static final SHIFT_LEFT = 93 + public static final INPLACE_SHIFT_LEFT = 94 + public static final GREATER_THAN = 95 + public static final GREATER_THAN_OR_EQUAL = 96 + public static final SHIFT_RIGHT = 97 + public static final INPLACE_SHIFT_RIGHT = 98 + public static final AT = 99 + public static final SCRIPT_ATTRIBUTE_MARKER = 100 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 101 + public static final INPLACE_BITWISE_XOR = 102 + public static final LOGICAL_NOT = 103 + public static final DIVISION = 104 + public static final RE_LITERAL = 105 + public static final DOUBLE = 106 + public static final INT = 107 + public static final LONG = 108 + public static final SINGLE_QUOTED_STRING = 109 + public static final DOUBLE_SUFFIX = 110 + public static final EXPONENT = 111 + public static final PRAGMA_WHITE_SPACE = 112 + public static final WHITE_SPACE = 113 + public static final DQS_ESC = 114 + public static final SQS_ESC = 115 + public static final SESC = 116 + public static final ML_COMMENT = 117 + public static final RE_CHAR = 118 + public static final RE_ESC = 119 + public static final NEWLINE = 120 + public static final ID_LETTER = 121 + public static final DIGIT = 122 + public static final HEXDIGIT = 123 property PreserveComments = false @@ -173,102 +175,104 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): caseSensitiveLiterals = true setCaseSensitive(true) literals = Hashtable(100, 0.4, null, Comparer.Default) - literals.Add(",", 65) - literals.Add("public", 29) - literals.Add("a string", 58) - literals.Add("an identifier", 57) - literals.Add("]", 67) - literals.Add("case", 48) + literals.Add(",", 67) + literals.Add("public", 31) + literals.Add("a string", 60) + literals.Add("an identifier", 59) + literals.Add("]", 69) + literals.Add("case", 50) literals.Add("break", 5) - literals.Add("while", 45) - literals.Add("new", 26) - literals.Add("||", 73) - literals.Add("+", 79) - literals.Add("instanceof", 25) - literals.Add("implements", 22) - literals.Add("*", 82) - literals.Add("|=", 69) - literals.Add("typeof", 42) - literals.Add("@assembly", 99) - literals.Add("[", 66) - literals.Add(">>=", 96) - literals.Add("return", 28) - literals.Add("throw", 39) - literals.Add("var", 43) - literals.Add(")", 62) - literals.Add("==", 83) - literals.Add("null", 27) - literals.Add("protected", 30) - literals.Add("pragma off", 56) - literals.Add("@script", 98) + literals.Add("while", 47) + literals.Add("new", 27) + literals.Add("||", 75) + literals.Add("+", 81) + literals.Add("instanceof", 26) + literals.Add("implements", 23) + literals.Add("*", 84) + literals.Add("|=", 71) + literals.Add("typeof", 44) + literals.Add("@assembly", 101) + literals.Add("[", 68) + literals.Add(">>=", 98) + literals.Add("not", 28) + literals.Add("return", 30) + literals.Add("throw", 41) + literals.Add("var", 45) + literals.Add(")", 64) + literals.Add("==", 85) + literals.Add("null", 29) + literals.Add("protected", 32) + literals.Add("pragma off", 58) + literals.Add("@script", 100) literals.Add("class", 8) - literals.Add("(", 61) + literals.Add("(", 63) literals.Add("do", 10) - literals.Add("~", 86) - literals.Add("function", 18) - literals.Add("/=", 50) - literals.Add("super", 37) - literals.Add("@", 97) - literals.Add("-=", 52) - literals.Add("set", 35) - literals.Add("+=", 51) - literals.Add("!==", 88) - literals.Add("}", 60) - literals.Add("interface", 24) - literals.Add("?", 85) - literals.Add("&", 70) - literals.Add("internal", 31) - literals.Add("final", 15) - literals.Add("yield", 46) - literals.Add("!=", 84) - literals.Add("//", 54) - literals.Add("===", 87) - literals.Add("if", 20) - literals.Add("|", 68) - literals.Add("override", 32) - literals.Add(">", 93) + literals.Add("~", 88) + literals.Add("function", 19) + literals.Add("/=", 52) + literals.Add("super", 39) + literals.Add("each", 12) + literals.Add("@", 99) + literals.Add("-=", 54) + literals.Add("set", 37) + literals.Add("+=", 53) + literals.Add("!==", 90) + literals.Add("}", 62) + literals.Add("interface", 25) + literals.Add("?", 87) + literals.Add("&", 72) + literals.Add("internal", 33) + literals.Add("final", 16) + literals.Add("yield", 48) + literals.Add("!=", 86) + literals.Add("//", 56) + literals.Add("===", 89) + literals.Add("if", 21) + literals.Add("|", 70) + literals.Add("override", 34) + literals.Add(">", 95) literals.Add("as", 4) - literals.Add("%", 81) + literals.Add("%", 83) literals.Add("catch", 7) - literals.Add("try", 41) - literals.Add("{", 59) - literals.Add("=", 76) - literals.Add("enum", 12) - literals.Add("for", 17) - literals.Add(">>", 95) - literals.Add("extends", 13) - literals.Add("private", 34) - literals.Add("default", 49) - literals.Add("--", 78) - literals.Add("<", 89) - literals.Add("false", 14) - literals.Add("this", 38) - literals.Add("static", 36) - literals.Add(">=", 94) - literals.Add("<=", 90) - literals.Add("partial", 33) - literals.Add(";", 75) - literals.Add("get", 19) - literals.Add("<<=", 92) + literals.Add("try", 43) + literals.Add("{", 61) + literals.Add("=", 78) + literals.Add("enum", 13) + literals.Add("for", 18) + literals.Add(">>", 97) + literals.Add("extends", 14) + literals.Add("private", 36) + literals.Add("default", 51) + literals.Add("--", 80) + literals.Add("<", 91) + literals.Add("false", 15) + literals.Add("this", 40) + literals.Add("static", 38) + literals.Add(">=", 96) + literals.Add("<=", 92) + literals.Add("partial", 35) + literals.Add(";", 77) + literals.Add("get", 20) + literals.Add("<<=", 94) literals.Add("continue", 9) - literals.Add("&&", 74) + literals.Add("&&", 76) literals.Add("cast", 6) - literals.Add("<<", 91) - literals.Add("pragma on", 55) - literals.Add(".", 63) - literals.Add("finally", 16) + literals.Add("<<", 93) + literals.Add("pragma on", 57) + literals.Add(".", 65) + literals.Add("finally", 17) literals.Add("else", 11) - literals.Add("import", 21) - literals.Add("++", 77) - literals.Add(":", 64) - literals.Add("in", 23) - literals.Add("switch", 47) - literals.Add("true", 40) - literals.Add("-", 80) - literals.Add("*=", 53) - literals.Add("virtual", 44) - literals.Add("^", 71) - literals.Add("&=", 72) + literals.Add("import", 22) + literals.Add("++", 79) + literals.Add(":", 66) + literals.Add("in", 24) + literals.Add("switch", 49) + literals.Add("true", 42) + literals.Add("-", 82) + literals.Add("*=", 55) + literals.Add("virtual", 46) + literals.Add("^", 73) + literals.Add("&=", 74) override def nextToken() as IToken: theRetToken as IToken @@ -494,7 +498,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): mMULTIPLY(true) theRetToken = returnToken_ elif ((cached_LA1==char('!')) and (true)): // line 2102 - mNOT(true) + mLOGICAL_NOT(true) theRetToken = returnToken_ elif ((cached_LA1==char('<')) and (true)): // line 2102 mLESS_THAN(true) @@ -594,8 +598,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mDIGIT(false) else: // line 1969 - goto _loop327_breakloop - :_loop327_breakloop + goto _loop332_breakloop + :_loop332_breakloop _ttype = testLiteralsTable(_ttype) if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -688,17 +692,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('0')) and (cached_LA2==char('x'))): match("0x") - _cnt331 as int = 0 + _cnt336 as int = 0 while true: if ((tokenSet_0_.member(cast(int, cached_LA1)))): mHEXDIGIT(false) else: - if (_cnt331 >= 1): - goto _loop331_breakloop + if (_cnt336 >= 1): + goto _loop336_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt331 - :_loop331_breakloop + ++_cnt336 + :_loop336_breakloop if ((cached_LA1==char('L') or cached_LA1==char('l'))): _givenValue = cached_LA1 if ((_givenValue == char('l'))): // 1831 @@ -712,17 +716,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): else: // line 2053 pass // 947 elif ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (true)): // line 2102 - _cnt335 as int = 0 + _cnt340 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt335 >= 1): - goto _loop335_breakloop + if (_cnt340 >= 1): + goto _loop340_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt335 - :_loop335_breakloop + ++_cnt340 + :_loop340_breakloop _givenValue = cached_LA1 if ((_givenValue == char('L')) or (_givenValue ==char('l')) @@ -818,17 +822,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DOUBLE_SUFFIX - _cnt344 as int = 0 + _cnt349 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt344 >= 1): - goto _loop344_breakloop + if (_cnt349 >= 1): + goto _loop349_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt344 - :_loop344_breakloop + ++_cnt349 + :_loop349_breakloop if ((cached_LA1==char('E') or cached_LA1==char('e'))): mEXPONENT(false) else: // line 2053 @@ -879,17 +883,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): pass // 947 else: // line 1969 raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - _cnt351 as int = 0 + _cnt356 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9'))))): mDIGIT(false) else: - if (_cnt351 >= 1): - goto _loop351_breakloop + if (_cnt356 >= 1): + goto _loop356_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt351 - :_loop351_breakloop + ++_cnt356 + :_loop356_breakloop if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) _token.setText(text.ToString(_begin, text.Length-_begin)) @@ -1129,31 +1133,31 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _saveIndex = text.Length match("#pragma") text.Length = _saveIndex - _cnt375 as int = 0 + _cnt380 as int = 0 while true: if ((cached_LA1==char('\t') or cached_LA1==char(' '))): mPRAGMA_WHITE_SPACE(false) else: - if (_cnt375 >= 1): - goto _loop375_breakloop + if (_cnt380 >= 1): + goto _loop380_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt375 - :_loop375_breakloop + ++_cnt380 + :_loop380_breakloop mID(true) id = returnToken_ if ((cached_LA1==char('\t') or cached_LA1==char(' ')) and (cached_LA2==char('\t') or cached_LA2==char(' ') or cached_LA2==char('o')) and (LA(3)==char('\t') or LA(3)==char(' ') or LA(3)==char('f') or LA(3)==char('n') or LA(3)==char('o'))): - _cnt378 as int = 0 + _cnt383 as int = 0 while true: if ((cached_LA1==char('\t') or cached_LA1==char(' '))): mPRAGMA_WHITE_SPACE(false) else: - if (_cnt378 >= 1): - goto _loop378_breakloop + if (_cnt383 >= 1): + goto _loop383_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt378 - :_loop378_breakloop + ++_cnt383 + :_loop383_breakloop if ((cached_LA1==char('o')) and (cached_LA2==char('f'))): _saveIndex = text.Length match("off") @@ -1174,8 +1178,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((cached_LA1==char('\t') or cached_LA1==char(' '))): mPRAGMA_WHITE_SPACE(false) else: - goto _loop381_breakloop - :_loop381_breakloop + goto _loop386_breakloop + :_loop386_breakloop _saveIndex = text.Length mNEWLINE(false) text.Length = _saveIndex @@ -1306,9 +1310,9 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _token.setText(text.ToString(_begin, text.Length-_begin)) returnToken_ = _token - public def mNOT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException + public def mLOGICAL_NOT(_createToken as bool) as void: //throws RecognitionException, CharStreamException, TokenStreamException _ttype as int; _token as IToken; _begin = text.Length; - _ttype = NOT + _ttype = LOGICAL_NOT match('!') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1450,18 +1454,18 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = DIVISION - synPredMatched408 as bool = false + synPredMatched413 as bool = false if ((cached_LA1==char('/')) and (cached_LA2==char('*'))): - _m408 as int = mark() - synPredMatched408 = true + _m413 as int = mark() + synPredMatched413 = true ++inputState.guessing try: match("/*") except x as RecognitionException: - synPredMatched408 = false - rewind(_m408) + synPredMatched413 = false + rewind(_m413) --inputState.guessing - if synPredMatched408: + if synPredMatched413: mML_COMMENT(false) if 0 == inputState.guessing: if not PreserveComments: @@ -1475,8 +1479,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): if ((tokenSet_1_.member(cast(int, cached_LA1)))): match(tokenSet_1_) else: - goto _loop413_breakloop - :_loop413_breakloop + goto _loop418_breakloop + :_loop418_breakloop if 0 == inputState.guessing: if PreserveComments: _ttype = SL_COMMENT @@ -1508,8 +1512,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_2_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_2_) else: - goto _loop442_breakloop - :_loop442_breakloop + goto _loop447_breakloop + :_loop447_breakloop match("*/") if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1520,7 +1524,7 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype as int; _token as IToken; _begin = text.Length; _ttype = WHITE_SPACE - _cnt417 as int = 0 + _cnt422 as int = 0 while true: _givenValue = cached_LA1 if ((_givenValue == char(' '))): // 1831 @@ -1534,12 +1538,12 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): ): // 1827 mNEWLINE(false) else: // line 1969 - if (_cnt417 >= 1): - goto _loop417_breakloop + if (_cnt422 >= 1): + goto _loop422_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt417 - :_loop417_breakloop + ++_cnt422 + :_loop422_breakloop if 0 == inputState.guessing: _ttype = Token.SKIP; if (_createToken and (_token is null) and (_ttype != Token.SKIP)): @@ -1560,8 +1564,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_3_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_3_) else: - goto _loop421_breakloop - :_loop421_breakloop + goto _loop426_breakloop + :_loop426_breakloop _saveIndex = text.Length match('"') text.Length = _saveIndex @@ -1610,8 +1614,8 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): elif ((tokenSet_4_.member(cast(int, cached_LA1)))): // line 2102 match(tokenSet_4_) else: - goto _loop425_breakloop - :_loop425_breakloop + goto _loop430_breakloop + :_loop430_breakloop _saveIndex = text.Length match('\'') text.Length = _saveIndex @@ -1712,17 +1716,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): _ttype = RE_LITERAL match('/') - _cnt445 as int = 0 + _cnt450 as int = 0 while true: if ((tokenSet_5_.member(cast(int, cached_LA1)))): mRE_CHAR(false) else: - if (_cnt445 >= 1): - goto _loop445_breakloop + if (_cnt450 >= 1): + goto _loop450_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt445 - :_loop445_breakloop + ++_cnt450 + :_loop450_breakloop match('/') if (_createToken and (_token is null) and (_ttype != Token.SKIP)): _token = makeToken(_ttype) @@ -1780,17 +1784,17 @@ class UnityScriptLexer(antlr.CharScanner, TokenStream): or (_givenValue ==char('8')) or (_givenValue ==char('9')) ): // 1827 - _cnt451 as int = 0 + _cnt456 as int = 0 while true: if ((((cached_LA1 >= char('0')) and (cached_LA1 <= char('9')))) and (tokenSet_7_.member(cast(int, cached_LA2))) and (true)): mDIGIT(false) else: - if (_cnt451 >= 1): - goto _loop451_breakloop + if (_cnt456 >= 1): + goto _loop456_breakloop else: raise NoViableAltForCharException(cached_LA1, getFilename(), getLine(), getColumn()) - ++_cnt451 - :_loop451_breakloop + ++_cnt456 + :_loop456_breakloop elif ((_givenValue == char('x'))): // 1831 match('x') mDIGIT(false) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 53a04c9..a9e6340 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -38,116 +38,118 @@ partial class UnityScriptParser(antlr.LLkParser): public static final CONTINUE = 9 public static final DO = 10 public static final ELSE = 11 - public static final ENUM = 12 - public static final EXTENDS = 13 - public static final FALSE = 14 - public static final FINAL = 15 - public static final FINALLY = 16 - public static final FOR = 17 - public static final FUNCTION = 18 - public static final GET = 19 - public static final IF = 20 - public static final IMPORT = 21 - public static final IMPLEMENTS = 22 - public static final IN = 23 - public static final INTERFACE = 24 - public static final INSTANCEOF = 25 - public static final NEW = 26 - public static final NULL = 27 - public static final RETURN = 28 - public static final PUBLIC = 29 - public static final PROTECTED = 30 - public static final INTERNAL = 31 - public static final OVERRIDE = 32 - public static final PARTIAL = 33 - public static final PRIVATE = 34 - public static final SET = 35 - public static final STATIC = 36 - public static final SUPER = 37 - public static final THIS = 38 - public static final THROW = 39 - public static final TRUE = 40 - public static final TRY = 41 - public static final TYPEOF = 42 - public static final VAR = 43 - public static final VIRTUAL = 44 - public static final WHILE = 45 - public static final YIELD = 46 - public static final SWITCH = 47 - public static final CASE = 48 - public static final DEFAULT = 49 - public static final INPLACE_DIVISION = 50 - public static final INPLACE_ADD = 51 - public static final INPLACE_SUBTRACT = 52 - public static final INPLACE_MULTIPLY = 53 - public static final SL_COMMENT = 54 - public static final PRAGMA_ON = 55 - public static final PRAGMA_OFF = 56 - public static final ID = 57 - public static final DOUBLE_QUOTED_STRING = 58 - public static final LBRACE = 59 - public static final RBRACE = 60 - public static final LPAREN = 61 - public static final RPAREN = 62 - public static final DOT = 63 - public static final COLON = 64 - public static final COMMA = 65 - public static final LBRACK = 66 - public static final RBRACK = 67 - public static final BITWISE_OR = 68 - public static final INPLACE_BITWISE_OR = 69 - public static final BITWISE_AND = 70 - public static final BITWISE_XOR = 71 - public static final INPLACE_BITWISE_AND = 72 - public static final LOGICAL_OR = 73 - public static final LOGICAL_AND = 74 - public static final EOS = 75 - public static final ASSIGN = 76 - public static final INCREMENT = 77 - public static final DECREMENT = 78 - public static final ADD = 79 - public static final SUBTRACT = 80 - public static final MODULUS = 81 - public static final MULTIPLY = 82 - public static final EQUALITY = 83 - public static final INEQUALITY = 84 - public static final QUESTION_MARK = 85 - public static final BITWISE_NOT = 86 - public static final REFERENCE_EQUALITY = 87 - public static final REFERENCE_INEQUALITY = 88 - public static final LESS_THAN = 89 - public static final LESS_THAN_OR_EQUAL = 90 - public static final SHIFT_LEFT = 91 - public static final INPLACE_SHIFT_LEFT = 92 - public static final GREATER_THAN = 93 - public static final GREATER_THAN_OR_EQUAL = 94 - public static final SHIFT_RIGHT = 95 - public static final INPLACE_SHIFT_RIGHT = 96 - public static final AT = 97 - public static final SCRIPT_ATTRIBUTE_MARKER = 98 - public static final ASSEMBLY_ATTRIBUTE_MARKER = 99 - public static final INPLACE_BITWISE_XOR = 100 - public static final NOT = 101 - public static final DIVISION = 102 - public static final RE_LITERAL = 103 - public static final DOUBLE = 104 - public static final INT = 105 - public static final LONG = 106 - public static final SINGLE_QUOTED_STRING = 107 - public static final DOUBLE_SUFFIX = 108 - public static final EXPONENT = 109 - public static final PRAGMA_WHITE_SPACE = 110 - public static final WHITE_SPACE = 111 - public static final DQS_ESC = 112 - public static final SQS_ESC = 113 - public static final SESC = 114 - public static final ML_COMMENT = 115 - public static final RE_CHAR = 116 - public static final RE_ESC = 117 - public static final NEWLINE = 118 - public static final ID_LETTER = 119 - public static final DIGIT = 120 - public static final HEXDIGIT = 121 + public static final EACH = 12 + public static final ENUM = 13 + public static final EXTENDS = 14 + public static final FALSE = 15 + public static final FINAL = 16 + public static final FINALLY = 17 + public static final FOR = 18 + public static final FUNCTION = 19 + public static final GET = 20 + public static final IF = 21 + public static final IMPORT = 22 + public static final IMPLEMENTS = 23 + public static final IN = 24 + public static final INTERFACE = 25 + public static final INSTANCEOF = 26 + public static final NEW = 27 + public static final NOT = 28 + public static final NULL = 29 + public static final RETURN = 30 + public static final PUBLIC = 31 + public static final PROTECTED = 32 + public static final INTERNAL = 33 + public static final OVERRIDE = 34 + public static final PARTIAL = 35 + public static final PRIVATE = 36 + public static final SET = 37 + public static final STATIC = 38 + public static final SUPER = 39 + public static final THIS = 40 + public static final THROW = 41 + public static final TRUE = 42 + public static final TRY = 43 + public static final TYPEOF = 44 + public static final VAR = 45 + public static final VIRTUAL = 46 + public static final WHILE = 47 + public static final YIELD = 48 + public static final SWITCH = 49 + public static final CASE = 50 + public static final DEFAULT = 51 + public static final INPLACE_DIVISION = 52 + public static final INPLACE_ADD = 53 + public static final INPLACE_SUBTRACT = 54 + public static final INPLACE_MULTIPLY = 55 + public static final SL_COMMENT = 56 + public static final PRAGMA_ON = 57 + public static final PRAGMA_OFF = 58 + public static final ID = 59 + public static final DOUBLE_QUOTED_STRING = 60 + public static final LBRACE = 61 + public static final RBRACE = 62 + public static final LPAREN = 63 + public static final RPAREN = 64 + public static final DOT = 65 + public static final COLON = 66 + public static final COMMA = 67 + public static final LBRACK = 68 + public static final RBRACK = 69 + public static final BITWISE_OR = 70 + public static final INPLACE_BITWISE_OR = 71 + public static final BITWISE_AND = 72 + public static final BITWISE_XOR = 73 + public static final INPLACE_BITWISE_AND = 74 + public static final LOGICAL_OR = 75 + public static final LOGICAL_AND = 76 + public static final EOS = 77 + public static final ASSIGN = 78 + public static final INCREMENT = 79 + public static final DECREMENT = 80 + public static final ADD = 81 + public static final SUBTRACT = 82 + public static final MODULUS = 83 + public static final MULTIPLY = 84 + public static final EQUALITY = 85 + public static final INEQUALITY = 86 + public static final QUESTION_MARK = 87 + public static final BITWISE_NOT = 88 + public static final REFERENCE_EQUALITY = 89 + public static final REFERENCE_INEQUALITY = 90 + public static final LESS_THAN = 91 + public static final LESS_THAN_OR_EQUAL = 92 + public static final SHIFT_LEFT = 93 + public static final INPLACE_SHIFT_LEFT = 94 + public static final GREATER_THAN = 95 + public static final GREATER_THAN_OR_EQUAL = 96 + public static final SHIFT_RIGHT = 97 + public static final INPLACE_SHIFT_RIGHT = 98 + public static final AT = 99 + public static final SCRIPT_ATTRIBUTE_MARKER = 100 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 101 + public static final INPLACE_BITWISE_XOR = 102 + public static final LOGICAL_NOT = 103 + public static final DIVISION = 104 + public static final RE_LITERAL = 105 + public static final DOUBLE = 106 + public static final INT = 107 + public static final LONG = 108 + public static final SINGLE_QUOTED_STRING = 109 + public static final DOUBLE_SUFFIX = 110 + public static final EXPONENT = 111 + public static final PRAGMA_WHITE_SPACE = 112 + public static final WHITE_SPACE = 113 + public static final DQS_ESC = 114 + public static final SQS_ESC = 115 + public static final SESC = 116 + public static final ML_COMMENT = 117 + public static final RE_CHAR = 118 + public static final RE_ESC = 119 + public static final NEWLINE = 120 + public static final ID_LETTER = 121 + public static final DIGIT = 122 + public static final HEXDIGIT = 123 [property(CompilerContext)] @@ -518,10 +520,10 @@ partial class UnityScriptParser(antlr.LLkParser): --inputState.guessing if synPredMatched27: module_field(module) - elif ((LA(1)==VAR) and (LA(2)==FINAL or LA(2)==INTERNAL or LA(2)==ID)): // line 2102 + elif ((LA(1)==VAR) and (tokenSet_9_.member(cast(int, LA(2))))): // line 2102 declaration_statement(globals) eos() - elif ((tokenSet_9_.member(cast(int, LA(1)))) and (tokenSet_10_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_10_.member(cast(int, LA(1)))) and (tokenSet_11_.member(cast(int, LA(2))))): // line 2102 mod=module_member_modifiers() _givenValue = LA(1) if ((_givenValue == CLASS) @@ -543,7 +545,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_11_) + recover(ex,tokenSet_12_) else: raise @@ -554,7 +556,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling synPredMatched107 as bool = false - if ((LA(1)==GET or LA(1)==SET or LA(1)==ID) and (tokenSet_12_.member(cast(int, LA(2))))): + if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): _m107 as int = mark() synPredMatched107 = true ++inputState.guessing @@ -566,12 +568,12 @@ partial class UnityScriptParser(antlr.LLkParser): --inputState.guessing if synPredMatched107: macro_application_block(b) - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 builtin_statement(b) elif ((LA(1)==EOS)): // line 2102 _cnt109 as int = 0 while true: - if ((LA(1)==EOS) and (tokenSet_15_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_17_.member(cast(int, LA(2))))): match(EOS) else: if (_cnt109 >= 1): @@ -585,7 +587,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -596,7 +598,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling synPredMatched13 as bool = false - if ((LA(1)==ID) and (LA(2)==DOT or LA(2)==ASSIGN)): + if ((LA(1)==EACH or LA(1)==ID) and (LA(2)==DOT or LA(2)==ASSIGN)): _m13 as int = mark() synPredMatched13 = true ++inputState.guessing @@ -613,7 +615,7 @@ partial class UnityScriptParser(antlr.LLkParser): value=expression() if 0 == inputState.guessing: attr.NamedArguments.Add(ExpressionPair(name, value)) - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 value=expression() if 0 == inputState.guessing: attr.Arguments.Add(value) @@ -622,7 +624,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise @@ -637,12 +639,12 @@ partial class UnityScriptParser(antlr.LLkParser): match(DOT) e=member_reference_expression(e) else: - goto _loop207_breakloop - :_loop207_breakloop + goto _loop211_breakloop + :_loop211_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_18_) + recover(ex,tokenSet_20_) else: raise return e @@ -656,7 +658,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -672,7 +674,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_20_) + recover(ex,tokenSet_22_) else: raise @@ -684,10 +686,11 @@ partial class UnityScriptParser(antlr.LLkParser): name=qname() if 0 == inputState.guessing: attr = Ast.Attribute(ToLexicalInfo(name), name.getText()) - if ((LA(1)==LPAREN) and (tokenSet_21_.member(cast(int, LA(2))))): + if ((LA(1)==LPAREN) and (tokenSet_23_.member(cast(int, LA(2))))): match(LPAREN) _givenValue = LA(1) - if ((_givenValue == FALSE) + if ((_givenValue == EACH) + or (_givenValue ==FALSE) or (_givenValue ==FUNCTION) or (_givenValue ==NEW) or (_givenValue ==NULL) @@ -704,7 +707,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DECREMENT) or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) + or (_givenValue ==LOGICAL_NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) or (_givenValue ==INT) @@ -724,14 +727,14 @@ partial class UnityScriptParser(antlr.LLkParser): else: // line 1969 raise NoViableAltException(LT(1), getFilename()) match(RPAREN) - elif ((tokenSet_22_.member(cast(int, LA(1)))) and (tokenSet_23_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_22_) + recover(ex,tokenSet_24_) else: raise return attr @@ -765,7 +768,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_26_) else: raise return id @@ -814,7 +817,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_25_) + recover(ex,tokenSet_27_) else: raise return m @@ -832,7 +835,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_11_) + recover(ex,tokenSet_12_) else: raise @@ -854,6 +857,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==CONTINUE) or (_givenValue ==DO) or (_givenValue ==ELSE) + or (_givenValue ==EACH) or (_givenValue ==ENUM) or (_givenValue ==FALSE) or (_givenValue ==FINAL) @@ -898,7 +902,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) or (_givenValue ==AT) - or (_givenValue ==NOT) + or (_givenValue ==LOGICAL_NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) or (_givenValue ==INT) @@ -914,7 +918,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -924,10 +928,10 @@ partial class UnityScriptParser(antlr.LLkParser): t as IToken = null try: // for error handling - if ((LA(1)==EOS) and (tokenSet_26_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_28_.member(cast(int, LA(2))))): _cnt42 as int = 0 while true: - if ((LA(1)==EOS) and (tokenSet_26_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_28_.member(cast(int, LA(2))))): t = LT(1) match(EOS) if 0 == inputState.guessing: @@ -939,7 +943,7 @@ partial class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) ++_cnt42 :_loop42_breakloop - elif ((tokenSet_26_.member(cast(int, LA(1)))) and (tokenSet_27_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_28_.member(cast(int, LA(1)))) and (tokenSet_29_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: SemicolonExpected() else: @@ -947,7 +951,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_26_) + recover(ex,tokenSet_28_) else: raise return firstEOS @@ -1007,7 +1011,7 @@ partial class UnityScriptParser(antlr.LLkParser): BaseTypeAnnotations.AnnotateImplements(typeRef) match(LBRACE) while true: - if ((tokenSet_28_.member(cast(int, LA(1))))): + if ((tokenSet_30_.member(cast(int, LA(1))))): if 0 == inputState.guessing: mod = TypeMemberModifiers.None _givenValue = LA(1) @@ -1032,9 +1036,9 @@ partial class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((tokenSet_29_.member(cast(int, LA(1)))) and (tokenSet_30_.member(cast(int, LA(2))))): + if ((tokenSet_31_.member(cast(int, LA(1)))) and (tokenSet_32_.member(cast(int, LA(2))))): mod=member_modifiers() - elif ((tokenSet_25_.member(cast(int, LA(1)))) and (tokenSet_31_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_27_.member(cast(int, LA(1)))) and (tokenSet_33_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1063,7 +1067,7 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: SetEndSourceLocation(cd, rbrace) while true: - if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_34_.member(cast(int, LA(2))))): match(EOS) else: goto _loop59_breakloop @@ -1071,7 +1075,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_34_) else: raise return member @@ -1120,7 +1124,7 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: SetEndSourceLocation(td, rbrace) while true: - if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_34_.member(cast(int, LA(2))))): match(EOS) else: goto _loop66_breakloop @@ -1128,7 +1132,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_34_) else: raise return member @@ -1178,7 +1182,7 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: SetEndSourceLocation(ed, rbrace) while true: - if ((LA(1)==EOS) and (tokenSet_32_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_34_.member(cast(int, LA(2))))): match(EOS) else: goto _loop79_breakloop @@ -1186,7 +1190,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_34_) else: raise return member @@ -1208,7 +1212,8 @@ partial class UnityScriptParser(antlr.LLkParser): elif ((_givenValue == SET)): // 1831 setter = LT(1) match(SET) - elif ((_givenValue == FINAL) + elif ((_givenValue == EACH) + or (_givenValue ==FINAL) or (_givenValue ==INTERNAL) or (_givenValue ==ID) ): // 1827 @@ -1224,7 +1229,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_34_) else: raise return member @@ -1247,6 +1252,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==CLASS) or (_givenValue ==CONTINUE) or (_givenValue ==DO) + or (_givenValue ==EACH) or (_givenValue ==ENUM) or (_givenValue ==FALSE) or (_givenValue ==FINAL) @@ -1290,7 +1296,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) or (_givenValue ==AT) - or (_givenValue ==NOT) + or (_givenValue ==LOGICAL_NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) or (_givenValue ==INT) @@ -1309,6 +1315,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==CLASS) or (_givenValue ==CONTINUE) or (_givenValue ==DO) + or (_givenValue ==EACH) or (_givenValue ==ENUM) or (_givenValue ==FALSE) or (_givenValue ==FINAL) @@ -1351,7 +1358,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) or (_givenValue ==AT) - or (_givenValue ==NOT) + or (_givenValue ==LOGICAL_NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) or (_givenValue ==INT) @@ -1373,7 +1380,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_34_) else: raise return member @@ -1430,7 +1437,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_25_) + recover(ex,tokenSet_27_) else: raise return m @@ -1458,19 +1465,19 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ++rank else: - goto _loop176_breakloop - :_loop176_breakloop + goto _loop179_breakloop + :_loop179_breakloop match(RBRACK) if 0 == inputState.guessing: tr = ArrayTypeReference(tr.LexicalInfo, tr, IntegerLiteralExpression(ToLexicalInfo(lbrack), rank)) - elif ((tokenSet_33_.member(cast(int, LA(1)))) and (tokenSet_24_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_35_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_33_) + recover(ex,tokenSet_35_) else: raise return tr @@ -1491,12 +1498,12 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: typeReferences.Add(tr) else: - goto _loop192_breakloop - :_loop192_breakloop + goto _loop195_breakloop + :_loop195_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_34_) + recover(ex,tokenSet_36_) else: raise @@ -1516,7 +1523,8 @@ partial class UnityScriptParser(antlr.LLkParser): elif ((_givenValue == SET)): // 1831 setter = LT(1) match(SET) - elif ((_givenValue == FINAL) + elif ((_givenValue == EACH) + or (_givenValue ==FINAL) or (_givenValue ==INTERNAL) or (_givenValue ==ID) ): // 1827 @@ -1528,7 +1536,8 @@ partial class UnityScriptParser(antlr.LLkParser): function = AddFunctionTo(parent, memberName, getter, setter) match(LPAREN) _givenValue = LA(1) - if ((_givenValue == FINAL) + if ((_givenValue == EACH) + or (_givenValue ==FINAL) or (_givenValue ==INTERNAL) or (_givenValue ==ID) or (_givenValue ==AT) @@ -1564,7 +1573,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_35_) + recover(ex,tokenSet_37_) else: raise @@ -1574,6 +1583,7 @@ partial class UnityScriptParser(antlr.LLkParser): name as IToken = null f as IToken = null i as IToken = null + e as IToken = null try: // for error handling _givenValue = LA(1) @@ -1592,12 +1602,17 @@ partial class UnityScriptParser(antlr.LLkParser): match(INTERNAL) if 0 == inputState.guessing: token = i; KeywordCannotBeUsedAsAnIdentifier(token); + elif ((_givenValue == EACH)): // 1831 + e = LT(1) + match(EACH) + if 0 == inputState.guessing: + token = e; else: // line 1969 raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_38_) else: raise return token @@ -1619,7 +1634,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_37_) + recover(ex,tokenSet_39_) else: raise @@ -1656,7 +1671,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_38_) + recover(ex,tokenSet_40_) else: raise @@ -1684,7 +1699,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -1697,7 +1712,8 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling match(LPAREN) _givenValue = LA(1) - if ((_givenValue == FINAL) + if ((_givenValue == EACH) + or (_givenValue ==FINAL) or (_givenValue ==INTERNAL) or (_givenValue ==ID) or (_givenValue ==AT) @@ -1724,7 +1740,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_32_) + recover(ex,tokenSet_34_) else: raise @@ -1736,7 +1752,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling block(b) while true: - if ((LA(1)==EOS) and (tokenSet_39_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_41_.member(cast(int, LA(2))))): match(EOS) else: goto _loop101_breakloop @@ -1744,7 +1760,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_39_) + recover(ex,tokenSet_41_) else: raise @@ -1757,7 +1773,8 @@ partial class UnityScriptParser(antlr.LLkParser): _givenValue = LA(1) if ((_givenValue == AT)): // 1831 attributes() - elif ((_givenValue == FINAL) + elif ((_givenValue == EACH) + or (_givenValue ==FINAL) or (_givenValue ==INTERNAL) or (_givenValue ==ID) ): // 1827 @@ -1782,7 +1799,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_19_) else: raise @@ -1792,16 +1809,16 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling - if ((LA(1)==LBRACE) and (tokenSet_40_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_42_.member(cast(int, LA(2))))): compound_statement(b) - elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 statement(b) else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -1826,7 +1843,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise @@ -1834,10 +1851,10 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling - if ((LA(1)==GET or LA(1)==SET or LA(1)==ID) and (LA(2)==LBRACE)): + if ((tokenSet_13_.member(cast(int, LA(1)))) and (LA(2)==LBRACE)): member() match(LBRACE) - elif ((LA(1)==GET or LA(1)==SET or LA(1)==ID) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 member() expression_list(null) match(LBRACE) @@ -1860,20 +1877,20 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling macroName=member() - synPredMatched145 as bool = false - if ((LA(1)==LBRACE) and (tokenSet_40_.member(cast(int, LA(2))))): - _m145 as int = mark() - synPredMatched145 = true + synPredMatched148 as bool = false + if ((LA(1)==LBRACE) and (tokenSet_42_.member(cast(int, LA(2))))): + _m148 as int = mark() + synPredMatched148 = true ++inputState.guessing try: match(LBRACE) except x as RecognitionException: - synPredMatched145 = false - rewind(_m145) + synPredMatched148 = false + rewind(_m148) --inputState.guessing - if synPredMatched145: + if synPredMatched148: compound_statement(b) - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_41_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_43_.member(cast(int, LA(2))))): // line 2102 expression_list(args) compound_statement(b) else: @@ -1885,7 +1902,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -1920,6 +1937,7 @@ partial class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) elif ((_givenValue == BREAK) or (_givenValue ==CONTINUE) + or (_givenValue ==EACH) or (_givenValue ==FALSE) or (_givenValue ==FUNCTION) or (_givenValue ==NEW) @@ -1941,7 +1959,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DECREMENT) or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) + or (_givenValue ==LOGICAL_NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) or (_givenValue ==INT) @@ -1949,7 +1967,8 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==SINGLE_QUOTED_STRING) ): // 1827 _givenValue = LA(1) - if ((_givenValue == FALSE) + if ((_givenValue == EACH) + or (_givenValue ==FALSE) or (_givenValue ==FUNCTION) or (_givenValue ==NEW) or (_givenValue ==NULL) @@ -1966,7 +1985,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DECREMENT) or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) + or (_givenValue ==LOGICAL_NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) or (_givenValue ==INT) @@ -1994,7 +2013,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -2024,7 +2043,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -2049,7 +2068,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -2062,40 +2081,49 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling f = LT(1) match(FOR) - match(LPAREN) - synPredMatched129 as bool = false - if ((tokenSet_42_.member(cast(int, LA(1)))) and (tokenSet_43_.member(cast(int, LA(2))))): - _m129 as int = mark() - synPredMatched129 = true - ++inputState.guessing - try: - _givenValue = LA(1) - if ((_givenValue == FINAL) - or (_givenValue ==INTERNAL) - or (_givenValue ==ID) - ): // 1827 - identifier() - elif ((_givenValue == VAR)): // 1831 - declaration() - else: // line 1969 - raise NoViableAltException(LT(1), getFilename()) - match(IN) - except x as RecognitionException: - synPredMatched129 = false - rewind(_m129) - --inputState.guessing - if synPredMatched129: + _givenValue = LA(1) + if ((_givenValue == EACH)): // 1831 + match(EACH) + match(LPAREN) stmt=for_in(container) - elif ((tokenSet_44_.member(cast(int, LA(1)))) and (tokenSet_45_.member(cast(int, LA(2))))): // line 2102 - stmt=for_c(container) - else: - raise NoViableAltException(LT(1), getFilename()) + elif ((_givenValue == LPAREN)): // 1831 + match(LPAREN) + synPredMatched132 as bool = false + if ((tokenSet_44_.member(cast(int, LA(1)))) and (tokenSet_45_.member(cast(int, LA(2))))): + _m132 as int = mark() + synPredMatched132 = true + ++inputState.guessing + try: + _givenValue = LA(1) + if ((_givenValue == EACH) + or (_givenValue ==FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) + ): // 1827 + identifier() + elif ((_givenValue == VAR)): // 1831 + declaration() + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) + match(IN) + except x as RecognitionException: + synPredMatched132 = false + rewind(_m132) + --inputState.guessing + if synPredMatched132: + stmt=for_in(container) + elif ((tokenSet_46_.member(cast(int, LA(1)))) and (tokenSet_47_.member(cast(int, LA(2))))): // line 2102 + stmt=for_c(container) + else: + raise NoViableAltException(LT(1), getFilename()) + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) if 0 == inputState.guessing: - stmt.LexicalInfo = ToLexicalInfo(f) if stmt is not null + stmt.LexicalInfo = ToLexicalInfo(f) if stmt is not null except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -2121,14 +2149,14 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: b = s.FalseBlock = Block(ToLexicalInfo(et)) compound_or_single_stmt(b) - elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -2174,18 +2202,18 @@ partial class UnityScriptParser(antlr.LLkParser): tr = null compound_or_single_stmt(b) else: - goto _loop164_breakloop - :_loop164_breakloop + goto _loop167_breakloop + :_loop167_breakloop if ((LA(1)==FINALLY) and (tokenSet_2_.member(cast(int, LA(2))))): finally_block(s) - elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -2228,22 +2256,22 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: item.Arguments.Add(e); else: - goto _loop152_breakloop - :_loop152_breakloop - _cnt154 as int = 0 + goto _loop155_breakloop + :_loop155_breakloop + _cnt157 as int = 0 while true: if ((tokenSet_2_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt154 >= 1): - goto _loop154_breakloop + if (_cnt157 >= 1): + goto _loop157_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt154 - :_loop154_breakloop + ++_cnt157 + :_loop157_breakloop else: - goto _loop155_breakloop - :_loop155_breakloop + goto _loop158_breakloop + :_loop158_breakloop _givenValue = LA(1) if ((_givenValue == DEFAULT)): // 1831 d = LT(1) @@ -2253,32 +2281,32 @@ partial class UnityScriptParser(antlr.LLkParser): item = MacroStatement(ToLexicalInfo(d), Name: d.getText()) itemBlock = item.Body switchBlock.Add(item) - _cnt158 as int = 0 + _cnt161 as int = 0 while true: if ((tokenSet_2_.member(cast(int, LA(1))))): statement(itemBlock) else: - if (_cnt158 >= 1): - goto _loop158_breakloop + if (_cnt161 >= 1): + goto _loop161_breakloop else: raise NoViableAltException(LT(1), getFilename()) - ++_cnt158 - :_loop158_breakloop + ++_cnt161 + :_loop161_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) match(RBRACE) while true: - if ((LA(1)==EOS) and (tokenSet_15_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_17_.member(cast(int, LA(2))))): match(EOS) else: - goto _loop160_breakloop - :_loop160_breakloop + goto _loop163_breakloop + :_loop163_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -2294,7 +2322,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -2307,9 +2335,9 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling yt = LT(1) match(YIELD) - if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_48_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -2318,7 +2346,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -2331,9 +2359,9 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling ret = LT(1) match(RETURN) - if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_48_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -2342,7 +2370,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -2360,7 +2388,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -2383,7 +2411,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -2396,9 +2424,9 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling t = LT(1) match(THROW) - if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_48_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -2407,7 +2435,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -2429,6 +2457,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==CONTINUE) or (_givenValue ==DO) or (_givenValue ==ELSE) + or (_givenValue ==EACH) or (_givenValue ==ENUM) or (_givenValue ==FALSE) or (_givenValue ==FINAL) @@ -2475,7 +2504,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) or (_givenValue ==AT) - or (_givenValue ==NOT) + or (_givenValue ==LOGICAL_NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) or (_givenValue ==INT) @@ -2490,7 +2519,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_47_) + recover(ex,tokenSet_49_) else: raise return d @@ -2590,6 +2619,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==CONTINUE) or (_givenValue ==DO) or (_givenValue ==ELSE) + or (_givenValue ==EACH) or (_givenValue ==ENUM) or (_givenValue ==FALSE) or (_givenValue ==FINAL) @@ -2635,7 +2665,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) or (_givenValue ==AT) - or (_givenValue ==NOT) + or (_givenValue ==LOGICAL_NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) or (_givenValue ==INT) @@ -2648,7 +2678,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_48_) + recover(ex,tokenSet_50_) else: raise return e @@ -2661,7 +2691,8 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling _givenValue = LA(1) - if ((_givenValue == FINAL) + if ((_givenValue == EACH) + or (_givenValue ==FINAL) or (_givenValue ==INTERNAL) or (_givenValue ==ID) ): // 1827 @@ -2690,7 +2721,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise return stmt @@ -2708,7 +2739,8 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: stmt = container.Statements[-1] as DeclarationStatement stmt.Annotate("PrivateScope") if stmt is not null - elif ((_givenValue == FALSE) + elif ((_givenValue == EACH) + or (_givenValue ==FALSE) or (_givenValue ==FUNCTION) or (_givenValue ==NEW) or (_givenValue ==NULL) @@ -2725,7 +2757,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DECREMENT) or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) + or (_givenValue ==LOGICAL_NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) or (_givenValue ==INT) @@ -2739,7 +2771,8 @@ partial class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) match(EOS) _givenValue = LA(1) - if ((_givenValue == FALSE) + if ((_givenValue == EACH) + or (_givenValue ==FALSE) or (_givenValue ==FUNCTION) or (_givenValue ==NEW) or (_givenValue ==NULL) @@ -2756,7 +2789,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DECREMENT) or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) + or (_givenValue ==LOGICAL_NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) or (_givenValue ==INT) @@ -2770,7 +2803,8 @@ partial class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) match(EOS) _givenValue = LA(1) - if ((_givenValue == FALSE) + if ((_givenValue == EACH) + or (_givenValue ==FALSE) or (_givenValue ==FUNCTION) or (_givenValue ==NEW) or (_givenValue ==NULL) @@ -2787,7 +2821,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DECREMENT) or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) + or (_givenValue ==LOGICAL_NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) or (_givenValue ==INT) @@ -2819,7 +2853,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise return stmt @@ -2830,6 +2864,7 @@ partial class UnityScriptParser(antlr.LLkParser): id as IToken = null st as IToken = null gt as IToken = null + eh as IToken = null try: // for error handling _givenValue = LA(1) @@ -2848,12 +2883,17 @@ partial class UnityScriptParser(antlr.LLkParser): match(GET) if 0 == inputState.guessing: name=gt; + elif ((_givenValue == EACH)): // 1831 + eh = LT(1) + match(EACH) + if 0 == inputState.guessing: + name=eh; else: // line 1969 raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return name @@ -2864,7 +2904,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling - if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): e=expression() if 0 == inputState.guessing: ec.Add(e); @@ -2875,16 +2915,16 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: ec.Add(e); else: - goto _loop225_breakloop - :_loop225_breakloop - elif ((LA(1)==LBRACE or LA(1)==RPAREN or LA(1)==RBRACK) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + goto _loop229_breakloop + :_loop229_breakloop + elif ((LA(1)==LBRACE or LA(1)==RPAREN or LA(1)==RBRACK) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_49_) + recover(ex,tokenSet_51_) else: raise @@ -2899,7 +2939,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -2919,7 +2959,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_15_) + recover(ex,tokenSet_17_) else: raise @@ -2930,7 +2970,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=logical_or() - if ((LA(1)==QUESTION_MARK) and (tokenSet_12_.member(cast(int, LA(2))))): + if ((LA(1)==QUESTION_MARK) and (tokenSet_14_.member(cast(int, LA(2))))): qm = LT(1) match(QUESTION_MARK) trueValue=logical_or() @@ -2941,14 +2981,14 @@ partial class UnityScriptParser(antlr.LLkParser): Condition: e, TrueValue: trueValue, FalseValue: falseValue) - elif ((tokenSet_19_.member(cast(int, LA(1)))) and (tokenSet_27_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_21_.member(cast(int, LA(1)))) and (tokenSet_29_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -2967,7 +3007,7 @@ partial class UnityScriptParser(antlr.LLkParser): arguments = gtr.GenericArguments type_reference_list(arguments) match(GREATER_THAN) - elif ((tokenSet_33_.member(cast(int, LA(1)))) and (tokenSet_24_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_35_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: tr = SimpleTypeReference(ToLexicalInfo(typeName), Name: typeName.getText()) else: @@ -2975,7 +3015,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_33_) + recover(ex,tokenSet_35_) else: raise return tr @@ -2997,14 +3037,14 @@ partial class UnityScriptParser(antlr.LLkParser): returnType=type_reference() if 0 == inputState.guessing: callableTypeRef.ReturnType = returnType - elif ((tokenSet_33_.member(cast(int, LA(1)))) and (tokenSet_24_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_35_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_33_) + recover(ex,tokenSet_35_) else: raise return tr @@ -3030,8 +3070,8 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: parameters.Add(ParameterDeclaration(Type: parameterType, Name: "arg" + len(parameters))) else: - goto _loop182_breakloop - :_loop182_breakloop + goto _loop185_breakloop + :_loop185_breakloop elif ((_givenValue == RPAREN)): // 1831 pass // 947 else: // line 1969 @@ -3040,7 +3080,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_33_) + recover(ex,tokenSet_35_) else: raise @@ -3062,15 +3102,15 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dimensions.Add(size) else: - goto _loop185_breakloop - :_loop185_breakloop + goto _loop188_breakloop + :_loop188_breakloop match(RBRACK) if 0 == inputState.guessing: e = CodeFactory.NewArrayInitializer(tr.LexicalInfo, tr, dimensions) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3085,7 +3125,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=term() while true: - if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_12_.member(cast(int, LA(2))))): + if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_14_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == ADD)): // 1831 add = LT(1) @@ -3107,12 +3147,12 @@ partial class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop259_breakloop - :_loop259_breakloop + goto _loop263_breakloop + :_loop263_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3127,7 +3167,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3137,20 +3177,20 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched196 as bool = false + synPredMatched199 as bool = false if ((LA(1)==NEW) and (LA(2)==ID)): - _m196 as int = mark() - synPredMatched196 = true + _m199 as int = mark() + synPredMatched199 = true ++inputState.guessing try: new_array_expression() except x as RecognitionException: - synPredMatched196 = false - rewind(_m196) + synPredMatched199 = false + rewind(_m199) --inputState.guessing - if synPredMatched196: + if synPredMatched199: e=new_array_expression() - elif ((LA(1)==NEW) and (LA(2)==ID)): // line 2102 + elif ((LA(1)==NEW) and (LA(2)==EACH or LA(2)==ID)): // line 2102 match(NEW) r=reference_expression() if 0 == inputState.guessing: @@ -3164,7 +3204,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3192,7 +3232,9 @@ partial class UnityScriptParser(antlr.LLkParser): e=literal() elif ((_givenValue == FUNCTION)): // 1831 e=function_expression() - elif ((_givenValue == ID)): // 1831 + elif ((_givenValue == EACH) + or (_givenValue ==ID) + ): // 1827 e=simple_reference_expression() elif ((_givenValue == LPAREN)): // 1831 e=paren_expression() @@ -3205,7 +3247,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3247,7 +3289,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3266,7 +3308,8 @@ partial class UnityScriptParser(antlr.LLkParser): body = e.Body match(LPAREN) _givenValue = LA(1) - if ((_givenValue == FINAL) + if ((_givenValue == EACH) + or (_givenValue ==FINAL) or (_givenValue ==INTERNAL) or (_givenValue ==ID) or (_givenValue ==AT) @@ -3283,7 +3326,8 @@ partial class UnityScriptParser(antlr.LLkParser): tr=type_reference() if 0 == inputState.guessing: e.ReturnType = tr; - elif ((_givenValue == FALSE) + elif ((_givenValue == EACH) + or (_givenValue ==FALSE) or (_givenValue ==FUNCTION) or (_givenValue ==NEW) or (_givenValue ==NULL) @@ -3300,7 +3344,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DECREMENT) or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) + or (_givenValue ==LOGICAL_NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) or (_givenValue ==INT) @@ -3310,9 +3354,9 @@ partial class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((LA(1)==LBRACE) and (tokenSet_40_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_42_.member(cast(int, LA(2))))): block(body) - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 returnValue=expression() if 0 == inputState.guessing: body.Add(returnValue) @@ -3321,7 +3365,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3330,16 +3374,26 @@ partial class UnityScriptParser(antlr.LLkParser): e as Expression id as IToken = null + each as IToken = null try: // for error handling - id = LT(1) - match(ID) + _givenValue = LA(1) + if ((_givenValue == ID)): // 1831 + id = LT(1) + match(ID) + elif ((_givenValue == EACH)): // 1831 + each = LT(1) + match(EACH) + if 0 == inputState.guessing: + id = each + else: // line 1969 + raise NoViableAltException(LT(1), getFilename()) if 0 == inputState.guessing: e = ReferenceExpression(ToLexicalInfo(id), Name: id.getText()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3349,10 +3403,10 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched214 as bool = false - if ((LA(1)==TYPEOF) and (tokenSet_12_.member(cast(int, LA(2))))): - _m214 as int = mark() - synPredMatched214 = true + synPredMatched218 as bool = false + if ((LA(1)==TYPEOF) and (tokenSet_14_.member(cast(int, LA(2))))): + _m218 as int = mark() + synPredMatched218 = true ++inputState.guessing try: match(TYPEOF) @@ -3360,19 +3414,19 @@ partial class UnityScriptParser(antlr.LLkParser): expression() match(RPAREN) except x as RecognitionException: - synPredMatched214 = false - rewind(_m214) + synPredMatched218 = false + rewind(_m218) --inputState.guessing - if synPredMatched214: + if synPredMatched218: e=typeof_with_expression() - elif ((LA(1)==TYPEOF) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==TYPEOF) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 e=typeof_expression_alt() else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3395,7 +3449,8 @@ partial class UnityScriptParser(antlr.LLkParser): genericArguments = gre.GenericArguments type_reference_list(genericArguments) match(GREATER_THAN) - elif ((_givenValue == GET) + elif ((_givenValue == EACH) + or (_givenValue ==GET) or (_givenValue ==SET) or (_givenValue ==ID) ): // 1827 @@ -3407,7 +3462,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3420,11 +3475,11 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling t = LT(1) match(TYPEOF) - if ((LA(1)==LPAREN) and (tokenSet_12_.member(cast(int, LA(2))))): + if ((LA(1)==LPAREN) and (tokenSet_14_.member(cast(int, LA(2))))): match(LPAREN) arg=expression() match(RPAREN) - elif ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 arg=expression() else: raise NoViableAltException(LT(1), getFilename()) @@ -3436,7 +3491,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3446,10 +3501,10 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling - synPredMatched217 as bool = false + synPredMatched221 as bool = false if ((LA(1)==TYPEOF) and (LA(2)==LPAREN)): - _m217 as int = mark() - synPredMatched217 = true + _m221 as int = mark() + synPredMatched221 = true ++inputState.guessing try: match(TYPEOF) @@ -3457,19 +3512,19 @@ partial class UnityScriptParser(antlr.LLkParser): type_reference() match(RPAREN) except x as RecognitionException: - synPredMatched217 = false - rewind(_m217) + synPredMatched221 = false + rewind(_m221) --inputState.guessing - if synPredMatched217: + if synPredMatched221: e=typeof_with_typeref() - elif ((LA(1)==TYPEOF) and (tokenSet_12_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==TYPEOF) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 e=typeof_with_expression() else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3490,7 +3545,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3510,7 +3565,8 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: begin = OmittedExpression.Default; _givenValue = LA(1) - if ((_givenValue == FALSE) + if ((_givenValue == EACH) + or (_givenValue ==FALSE) or (_givenValue ==FUNCTION) or (_givenValue ==NEW) or (_givenValue ==NULL) @@ -3527,7 +3583,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DECREMENT) or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) + or (_givenValue ==LOGICAL_NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) or (_givenValue ==INT) @@ -3546,7 +3602,8 @@ partial class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - elif ((_givenValue == FALSE) + elif ((_givenValue == EACH) + or (_givenValue ==FALSE) or (_givenValue ==FUNCTION) or (_givenValue ==NEW) or (_givenValue ==NULL) @@ -3563,7 +3620,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DECREMENT) or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) + or (_givenValue ==LOGICAL_NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) or (_givenValue ==INT) @@ -3575,7 +3632,8 @@ partial class UnityScriptParser(antlr.LLkParser): if ((_givenValue == COLON)): // 1831 match(COLON) _givenValue = LA(1) - if ((_givenValue == FALSE) + if ((_givenValue == EACH) + or (_givenValue ==FALSE) or (_givenValue ==FUNCTION) or (_givenValue ==NEW) or (_givenValue ==NULL) @@ -3592,7 +3650,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DECREMENT) or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) + or (_givenValue ==LOGICAL_NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) or (_givenValue ==INT) @@ -3631,7 +3689,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_50_) + recover(ex,tokenSet_52_) else: raise @@ -3647,7 +3705,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=atom() while true: - if ((LA(1)==LBRACK) and (tokenSet_51_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACK) and (tokenSet_53_.member(cast(int, LA(2))))): lbrack = LT(1) match(LBRACK) if 0 == inputState.guessing: @@ -3660,13 +3718,13 @@ partial class UnityScriptParser(antlr.LLkParser): match(COMMA) slice(se) else: - goto _loop241_breakloop - :_loop241_breakloop + goto _loop245_breakloop + :_loop245_breakloop match(RBRACK) - elif ((LA(1)==DOT) and (tokenSet_52_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DOT) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 match(DOT) e=member_reference_expression(e) - elif ((LA(1)==LPAREN) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==LPAREN) and (tokenSet_23_.member(cast(int, LA(2))))): // line 2102 lparen = LT(1) match(LPAREN) if 0 == inputState.guessing: @@ -3677,12 +3735,12 @@ partial class UnityScriptParser(antlr.LLkParser): expression_list(args) match(RPAREN) else: - goto _loop244_breakloop - :_loop244_breakloop + goto _loop248_breakloop + :_loop248_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3695,17 +3753,17 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=slicing_expression() - if ((LA(1)==INCREMENT) and (tokenSet_19_.member(cast(int, LA(2))))): + if ((LA(1)==INCREMENT) and (tokenSet_21_.member(cast(int, LA(2))))): postinc = LT(1) match(INCREMENT) if 0 == inputState.guessing: token = postinc; operator = UnaryOperatorType.PostIncrement; - elif ((LA(1)==DECREMENT) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DECREMENT) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 preinc = LT(1) match(DECREMENT) if 0 == inputState.guessing: token = preinc; operator= UnaryOperatorType.PostDecrement; - elif ((tokenSet_19_.member(cast(int, LA(1)))) and (tokenSet_27_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_21_.member(cast(int, LA(1)))) and (tokenSet_29_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3714,7 +3772,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3731,10 +3789,11 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DECREMENT) or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) + or (_givenValue ==LOGICAL_NOT) ): // 1827 e=prefix_unary_expression() - elif ((_givenValue == FALSE) + elif ((_givenValue == EACH) + or (_givenValue ==FALSE) or (_givenValue ==FUNCTION) or (_givenValue ==NEW) or (_givenValue ==NULL) @@ -3768,14 +3827,14 @@ partial class UnityScriptParser(antlr.LLkParser): tr=type_reference() if 0 == inputState.guessing: e = CastExpression(ToLexicalInfo(c), Target: e, Type: tr) - elif ((tokenSet_19_.member(cast(int, LA(1)))) and (tokenSet_27_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_21_.member(cast(int, LA(1)))) and (tokenSet_29_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3807,9 +3866,9 @@ partial class UnityScriptParser(antlr.LLkParser): match(DECREMENT) if 0 == inputState.guessing: op = dec; uOperator = UnaryOperatorType.Decrement; - elif ((_givenValue == NOT)): // 1831 + elif ((_givenValue == LOGICAL_NOT)): // 1831 nt = LT(1) - match(NOT) + match(LOGICAL_NOT) if 0 == inputState.guessing: op = nt; uOperator = UnaryOperatorType.LogicalNot; elif ((_givenValue == BITWISE_NOT)): // 1831 @@ -3825,7 +3884,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3841,7 +3900,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=unary_expression() while true: - if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_12_.member(cast(int, LA(2))))): + if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_14_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == MULTIPLY)): // 1831 m = LT(1) @@ -3868,12 +3927,12 @@ partial class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop255_breakloop - :_loop255_breakloop + goto _loop259_breakloop + :_loop259_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3887,7 +3946,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=sum() while true: - if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_12_.member(cast(int, LA(2))))): + if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_14_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == SHIFT_LEFT)): // 1831 sl = LT(1) @@ -3905,12 +3964,12 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop263_breakloop - :_loop263_breakloop + goto _loop267_breakloop + :_loop267_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -3918,6 +3977,7 @@ partial class UnityScriptParser(antlr.LLkParser): public def comparison() as Expression : //throws RecognitionException, TokenStreamException e as Expression + tni as IToken = null tin as IToken = null tgt as IToken = null tgte as IToken = null @@ -3931,16 +3991,23 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=shift() while true: - if ((tokenSet_53_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): + if ((tokenSet_55_.member(cast(int, LA(1)))) and (tokenSet_56_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == IN) + or (_givenValue ==NOT) or (_givenValue ==LESS_THAN) or (_givenValue ==LESS_THAN_OR_EQUAL) or (_givenValue ==GREATER_THAN) or (_givenValue ==GREATER_THAN_OR_EQUAL) ): // 1827 _givenValue = LA(1) - if ((_givenValue == IN)): // 1831 + if ((_givenValue == NOT)): // 1831 + tni = LT(1) + match(NOT) + match(IN) + if 0 == inputState.guessing: + op = BinaryOperatorType.NotMember; token = tni; + elif ((_givenValue == IN)): // 1831 tin = LT(1) match(IN) if 0 == inputState.guessing: @@ -3985,12 +4052,12 @@ partial class UnityScriptParser(antlr.LLkParser): be.Right = r e = be else: - goto _loop275_breakloop - :_loop275_breakloop + goto _loop280_breakloop + :_loop280_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -4006,7 +4073,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=comparison() while true: - if ((tokenSet_54_.member(cast(int, LA(1)))) and (tokenSet_12_.member(cast(int, LA(2))))): + if ((tokenSet_57_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == EQUALITY)): // 1831 te = LT(1) @@ -4034,12 +4101,12 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), op, e, r) else: - goto _loop283_breakloop - :_loop283_breakloop + goto _loop288_breakloop + :_loop288_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -4052,7 +4119,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=equality() while true: - if ((LA(1)==BITWISE_AND) and (tokenSet_12_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_AND) and (tokenSet_14_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_AND) if 0 == inputState.guessing: @@ -4061,12 +4128,12 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop286_breakloop - :_loop286_breakloop + goto _loop291_breakloop + :_loop291_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -4079,7 +4146,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_and() while true: - if ((LA(1)==BITWISE_XOR) and (tokenSet_12_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_XOR) and (tokenSet_14_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_XOR) if 0 == inputState.guessing: @@ -4088,12 +4155,12 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop289_breakloop - :_loop289_breakloop + goto _loop294_breakloop + :_loop294_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -4106,7 +4173,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_xor() while true: - if ((LA(1)==BITWISE_OR) and (tokenSet_12_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_OR) and (tokenSet_14_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_OR) if 0 == inputState.guessing: @@ -4115,12 +4182,12 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: e = BinaryExpression(ToLexicalInfo(token), Operator: op, Left: e, Right: r) else: - goto _loop292_breakloop - :_loop292_breakloop + goto _loop297_breakloop + :_loop297_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -4133,7 +4200,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_or() while true: - if ((LA(1)==LOGICAL_AND) and (tokenSet_12_.member(cast(int, LA(2))))): + if ((LA(1)==LOGICAL_AND) and (tokenSet_14_.member(cast(int, LA(2))))): op = LT(1) match(LOGICAL_AND) rhs=bitwise_or() @@ -4143,12 +4210,12 @@ partial class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop295_breakloop - :_loop295_breakloop + goto _loop300_breakloop + :_loop300_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -4161,7 +4228,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=logical_and() while true: - if ((LA(1)==LOGICAL_OR) and (tokenSet_12_.member(cast(int, LA(2))))): + if ((LA(1)==LOGICAL_OR) and (tokenSet_14_.member(cast(int, LA(2))))): op = LT(1) match(LOGICAL_OR) rhs=logical_and() @@ -4171,12 +4238,12 @@ partial class UnityScriptParser(antlr.LLkParser): Left: e, Right: rhs) else: - goto _loop298_breakloop - :_loop298_breakloop + goto _loop303_breakloop + :_loop303_breakloop except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -4206,7 +4273,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -4219,24 +4286,25 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling lbrack = LT(1) match(LBRACK) - synPredMatched306 as bool = false - if ((tokenSet_12_.member(cast(int, LA(1)))) and (tokenSet_55_.member(cast(int, LA(2))))): - _m306 as int = mark() - synPredMatched306 = true + synPredMatched311 as bool = false + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_58_.member(cast(int, LA(2))))): + _m311 as int = mark() + synPredMatched311 = true ++inputState.guessing try: expression() match(FOR) except x as RecognitionException: - synPredMatched306 = false - rewind(_m306) + synPredMatched311 = false + rewind(_m311) --inputState.guessing - if synPredMatched306: + if synPredMatched311: projection=expression() match(FOR) match(LPAREN) _givenValue = LA(1) - if ((_givenValue == FINAL) + if ((_givenValue == EACH) + or (_givenValue ==FINAL) or (_givenValue ==INTERNAL) or (_givenValue ==ID) ): // 1827 @@ -4259,7 +4327,7 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) - elif ((tokenSet_56_.member(cast(int, LA(1)))) and (tokenSet_19_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_59_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)); items = ale.Items; expression_list(items) @@ -4269,7 +4337,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -4286,7 +4354,8 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dle = HashLiteralExpression(ToLexicalInfo(lbrace)); _givenValue = LA(1) - if ((_givenValue == FALSE) + if ((_givenValue == EACH) + or (_givenValue ==FALSE) or (_givenValue ==FUNCTION) or (_givenValue ==NEW) or (_givenValue ==NULL) @@ -4303,7 +4372,7 @@ partial class UnityScriptParser(antlr.LLkParser): or (_givenValue ==DECREMENT) or (_givenValue ==SUBTRACT) or (_givenValue ==BITWISE_NOT) - or (_givenValue ==NOT) + or (_givenValue ==LOGICAL_NOT) or (_givenValue ==RE_LITERAL) or (_givenValue ==DOUBLE) or (_givenValue ==INT) @@ -4320,8 +4389,8 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: dle.Items.Add(pair); else: - goto _loop314_breakloop - :_loop314_breakloop + goto _loop319_breakloop + :_loop319_breakloop elif ((_givenValue == RBRACE)): // 1831 pass // 947 else: // line 1969 @@ -4330,7 +4399,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return dle @@ -4348,7 +4417,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return re @@ -4376,7 +4445,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -4394,7 +4463,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -4412,7 +4481,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -4430,7 +4499,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return e @@ -4448,7 +4517,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_21_) else: raise return rle @@ -4468,7 +4537,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_38_) + recover(ex,tokenSet_40_) else: raise return ep @@ -4487,6 +4556,7 @@ partial class UnityScriptParser(antlr.LLkParser): 'continue', 'do', 'else', + 'each', 'enum', 'extends', 'false', @@ -4502,6 +4572,7 @@ partial class UnityScriptParser(antlr.LLkParser): 'interface', 'instanceof', 'new', + 'not', 'null', 'return', 'public', @@ -4576,7 +4647,7 @@ partial class UnityScriptParser(antlr.LLkParser): '@script', '@assembly', 'INPLACE_BITWISE_XOR', - 'NOT', + 'LOGICAL_NOT', 'DIVISION', 'RE_LITERAL', 'DOUBLE', @@ -4600,19 +4671,19 @@ partial class UnityScriptParser(antlr.LLkParser): ) private static def mk_tokenSet_0_() as (long): - data = (26486543520000L, 0L, ) + data = (105946139926784L, 0L, ) return data public static final tokenSet_0_ = BitSet(mk_tokenSet_0_()) private static def mk_tokenSet_1_() as (long): - data = (144141708979638528L, 0L, ) + data = (576566835883356416L, 0L, ) return data public static final tokenSet_1_ = BitSet(mk_tokenSet_1_()) private static def mk_tokenSet_2_() as (long): - data = (3314913105927882272L, 17179873470468L, 0L, 0L, ) + data = (-5187091650136205792L, 68719493881872L, 0L, 0L, ) return data public static final tokenSet_2_ = BitSet(mk_tokenSet_2_()) private static def mk_tokenSet_3_() as (long): - data = (-4738631237225228430L, 17540646436860L, 0L, 0L, ) + data = (-507780875178625166L, 70162585747442L, 0L, 0L, ) return data public static final tokenSet_3_ = BitSet(mk_tokenSet_3_()) private static def mk_tokenSet_4_() as (long): @@ -4620,211 +4691,223 @@ partial class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_4_ = BitSet(mk_tokenSet_4_()) private static def mk_tokenSet_5_() as (long): - data = (3423017187437106978L, 17188463405060L, 0L, 0L, ) + data = (-4754675324137130206L, 68753853620240L, 0L, 0L, ) return data public static final tokenSet_5_ = BitSet(mk_tokenSet_5_()) private static def mk_tokenSet_6_() as (long): - data = (144141678981452032L, 0L, ) + data = (576566715757441280L, 0L, ) return data public static final tokenSet_6_ = BitSet(mk_tokenSet_6_()) private static def mk_tokenSet_7_() as (long): - data = (26477936541696L, 0L, ) + data = (105911746101248L, 0L, ) return data public static final tokenSet_7_ = BitSet(mk_tokenSet_7_()) private static def mk_tokenSet_8_() as (long): - data = (144141666012397568L, 0L, ) + data = (576566664049528832L, 0L, ) return data public static final tokenSet_8_ = BitSet(mk_tokenSet_8_()) private static def mk_tokenSet_9_() as (long): - data = (17690450497792L, 0L, ) + data = (576460760893427712L, 0L, ) return data public static final tokenSet_9_ = BitSet(mk_tokenSet_9_()) private static def mk_tokenSet_10_() as (long): - data = (144132912886616320L, 0L, ) + data = (70761767837952L, 0L, ) return data public static final tokenSet_10_ = BitSet(mk_tokenSet_10_()) private static def mk_tokenSet_11_() as (long): - data = (3314930796378117922L, 17188463405060L, 0L, 0L, ) + data = (576531651511267584L, 0L, ) return data public static final tokenSet_11_ = BitSet(mk_tokenSet_11_()) private static def mk_tokenSet_12_() as (long): - data = (3314655235821289472L, 17179873468420L, 0L, 0L, ) + data = (-5187020888368892126L, 68753853620240L, 0L, 0L, ) return data public static final tokenSet_12_ = BitSet(mk_tokenSet_12_()) private static def mk_tokenSet_13_() as (long): - data = (3314913071567619616L, 17179873468420L, 0L, 0L, ) + data = (576460889743429632L, 0L, ) return data public static final tokenSet_13_ = BitSet(mk_tokenSet_13_()) private static def mk_tokenSet_14_() as (long): - data = (-4737786812295028750L, 17540646436860L, 0L, 0L, ) + data = (-5188123130559164416L, 68719493873680L, 0L, 0L, ) return data public static final tokenSet_14_ = BitSet(mk_tokenSet_14_()) private static def mk_tokenSet_15_() as (long): - data = (4468696725915164578L, 17188463405060L, 0L, 0L, ) + data = (-5187091787576207840L, 68719493873680L, 0L, 0L, ) return data public static final tokenSet_15_ = BitSet(mk_tokenSet_15_()) private static def mk_tokenSet_16_() as (long): - data = (-144109277957308336L, 17458773616350L, 0L, 0L, ) + data = (-504403175457964046L, 70162585747442L, 0L, 0L, ) return data public static final tokenSet_16_ = BitSet(mk_tokenSet_16_()) private static def mk_tokenSet_17_() as (long): - data = (4611686018427387904L, 2L, 0L, 0L, ) + data = (-571957170220843102L, 68753853620240L, 0L, 0L, ) return data public static final tokenSet_17_ = BitSet(mk_tokenSet_17_()) private static def mk_tokenSet_18_() as (long): - data = (2305843009213693952L, 4096L, 0L, 0L, ) + data = (-576437111779454896L, 69835094465403L, 0L, 0L, ) return data public static final tokenSet_18_ = BitSet(mk_tokenSet_18_()) private static def mk_tokenSet_19_() as (long): - data = (-126100789572673550L, 17540646436863L, 0L, 0L, ) + data = (0L, 9L, 0L, 0L, ) return data public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) private static def mk_tokenSet_20_() as (long): - data = (144141678981452032L, 8589934592L, 0L, 0L, ) + data = (-9223372036854775808L, 16384L, 0L, 0L, ) return data public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) private static def mk_tokenSet_21_() as (long): - data = (7926341254248677376L, 17179873468420L, 0L, 0L, ) + data = (-504403158278094862L, 70162585747455L, 0L, 0L, ) return data public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) private static def mk_tokenSet_22_() as (long): - data = (3423017191732074274L, 17188463405060L, 0L, 0L, ) + data = (576566715757441280L, 34359738368L, 0L, 0L, ) return data public static final tokenSet_22_ = BitSet(mk_tokenSet_22_()) private static def mk_tokenSet_23_() as (long): - data = (-18858823443884174L, 17540646436863L, 0L, 0L, ) + data = (-5188123130559164416L, 68719493873681L, 0L, 0L, ) return data public static final tokenSet_23_ = BitSet(mk_tokenSet_23_()) private static def mk_tokenSet_24_() as (long): - data = (-18014398509490190L, 17540646436863L, 0L, 0L, ) + data = (-4754675306957261022L, 68753853620240L, 0L, 0L, ) return data public static final tokenSet_24_ = BitSet(mk_tokenSet_24_()) private static def mk_tokenSet_25_() as (long): - data = (8804700000512L, 0L, ) + data = (-75435293766994062L, 70162585747455L, 0L, 0L, ) return data public static final tokenSet_25_ = BitSet(mk_tokenSet_25_()) private static def mk_tokenSet_26_() as (long): - data = (4576783121269120930L, 17188463405060L, 0L, 0L, ) + data = (-72057594037944334L, 70162585747455L, 0L, 0L, ) return data public static final tokenSet_26_ = BitSet(mk_tokenSet_26_()) private static def mk_tokenSet_27_() as (long): - data = (-18014398513684494L, 17540646436863L, 0L, 0L, ) + data = (35218765914368L, 0L, ) return data public static final tokenSet_27_ = BitSet(mk_tokenSet_27_()) private static def mk_tokenSet_28_() as (long): - data = (26490905596160L, 8589934592L, 0L, 0L, ) + data = (-139611588809211998L, 68753853620240L, 0L, 0L, ) return data public static final tokenSet_28_ = BitSet(mk_tokenSet_28_()) private static def mk_tokenSet_29_() as (long): - data = (26490905596160L, 0L, ) + data = (-72057594046332942L, 70162585747455L, 0L, 0L, ) return data public static final tokenSet_29_ = BitSet(mk_tokenSet_29_()) private static def mk_tokenSet_30_() as (long): - data = (144141713341714688L, 0L, ) + data = (105963454013696L, 34359738368L, 0L, 0L, ) return data public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) private static def mk_tokenSet_31_() as (long): - data = (144115224583635200L, 0L, ) + data = (105963454013696L, 0L, ) return data public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) private static def mk_tokenSet_32_() as (long): - data = (4467852305279932194L, 17188463405060L, 0L, 0L, ) + data = (576566853197443328L, 0L, ) return data public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) private static def mk_tokenSet_33_() as (long): - data = (-126100789568479246L, 17540646436863L, 0L, 0L, ) + data = (576460898333430016L, 0L, ) return data public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) private static def mk_tokenSet_34_() as (long): - data = (576460752303423488L, 536870912L, 0L, 0L, ) + data = (-575334852761635038L, 68753853620240L, 0L, 0L, ) return data public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) private static def mk_tokenSet_35_() as (long): - data = (1152921504607109120L, 8589934592L, 0L, 0L, ) + data = (-504403158269706254L, 70162585747455L, 0L, 0L, ) return data public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) private static def mk_tokenSet_36_() as (long): - data = (9080382748645908386L, 17188463409159L, 0L, 0L, ) + data = (2305843009213693952L, 2147483648L, 0L, 0L, ) return data public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) private static def mk_tokenSet_37_() as (long): - data = (4611686018427387904L, 0L, ) + data = (4611686018427912192L, 34359738368L, 0L, 0L, ) return data public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) private static def mk_tokenSet_38_() as (long): - data = (1152921504606846976L, 2L, 0L, 0L, ) + data = (-571957153024196702L, 68753853636637L, 0L, 0L, ) return data public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) private static def mk_tokenSet_39_() as (long): - data = (4468696730210131874L, 17188463405060L, 0L, 0L, ) + data = (0L, 1L, 0L, 0L, ) return data public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) private static def mk_tokenSet_40_() as (long): - data = (4467834610534729248L, 17179873470468L, 0L, 0L, ) + data = (4611686018427387904L, 8L, 0L, 0L, ) return data public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) private static def mk_tokenSet_41_() as (long): - data = (-4755537426278103440L, 17458773618398L, 0L, 0L, ) + data = (-571957153040973918L, 68753853620240L, 0L, 0L, ) return data public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) private static def mk_tokenSet_42_() as (long): - data = (144123986316394496L, 0L, ) + data = (-575405631708817888L, 68719493881872L, 0L, 0L, ) return data public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) private static def mk_tokenSet_43_() as (long): - data = (144115190231760896L, 0L, ) + data = (-575405631356496272L, 69835094473594L, 0L, 0L, ) return data public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) private static def mk_tokenSet_44_() as (long): - data = (3314664031914311680L, 17179873470468L, 0L, 0L, ) + data = (576495945265516544L, 0L, ) return data public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) private static def mk_tokenSet_45_() as (long): - data = (-4738906795634540464L, 17532056502268L, 0L, 0L, ) + data = (576460760910204928L, 0L, ) return data public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) private static def mk_tokenSet_46_() as (long): - data = (-4754675310897668110L, 17467363552988L, 0L, 0L, ) + data = (-5188087946187075584L, 68719493881872L, 0L, 0L, ) return data public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) private static def mk_tokenSet_47_() as (long): - data = (4468696725923553186L, 17188463409156L, 0L, 0L, ) + data = (-508883108778897328L, 70128226009074L, 0L, 0L, ) return data public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) private static def mk_tokenSet_48_() as (long): - data = (9080382744342552482L, 17188463405060L, 0L, 0L, ) + data = (-571957169868521486L, 69869454211954L, 0L, 0L, ) return data public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) private static def mk_tokenSet_49_() as (long): - data = (5188146770730811392L, 8L, 0L, 0L, ) + data = (-571957170204065886L, 68753853636624L, 0L, 0L, ) return data public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) private static def mk_tokenSet_50_() as (long): - data = (0L, 10L, 0L, 0L, ) + data = (-571957170220843102L, 68753853620241L, 0L, 0L, ) return data public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) private static def mk_tokenSet_51_() as (long): - data = (3314655235821289472L, 17179873468421L, 0L, 0L, ) + data = (2305843009213693952L, 33L, 0L, 0L, ) return data public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) private static def mk_tokenSet_52_() as (long): - data = (144115222436118528L, 33554432L, 0L, 0L, ) + data = (0L, 40L, 0L, 0L, ) return data public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) private static def mk_tokenSet_53_() as (long): - data = (41943040L, 1711276032L, 0L, 0L, ) + data = (-5188123130559164416L, 68719493873684L, 0L, 0L, ) return data public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) private static def mk_tokenSet_54_() as (long): - data = (0L, 26738688L, 0L, 0L, ) + data = (576460889743429632L, 134217728L, 0L, 0L, ) return data public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) private static def mk_tokenSet_55_() as (long): - data = (-4755795296384565168L, 17458773616348L, 0L, 0L, ) + data = (352321536L, 6845104128L, 0L, 0L, ) return data public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) private static def mk_tokenSet_56_() as (long): - data = (3314655235821289472L, 17179873468428L, 0L, 0L, ) + data = (-5188123130542387200L, 68719493873680L, 0L, 0L, ) return data public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) + private static def mk_tokenSet_57_() as (long): + data = (0L, 106954752L, 0L, 0L, ) + return data + public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) + private static def mk_tokenSet_58_() as (long): + data = (-576437111779192752L, 69835094465394L, 0L, 0L, ) + return data + public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) + private static def mk_tokenSet_59_() as (long): + data = (-5188123130559164416L, 68719493873712L, 0L, 0L, ) + return data + public static final tokenSet_59_ = BitSet(mk_tokenSet_59_()) diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.boo b/src/UnityScript/Parser/UnityScriptTokenTypes.boo index c1d304f..9b0bcc3 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.boo +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.boo @@ -12,114 +12,116 @@ class UnityScriptTokenTypes: public static final CONTINUE = 9 public static final DO = 10 public static final ELSE = 11 - public static final ENUM = 12 - public static final EXTENDS = 13 - public static final FALSE = 14 - public static final FINAL = 15 - public static final FINALLY = 16 - public static final FOR = 17 - public static final FUNCTION = 18 - public static final GET = 19 - public static final IF = 20 - public static final IMPORT = 21 - public static final IMPLEMENTS = 22 - public static final IN = 23 - public static final INTERFACE = 24 - public static final INSTANCEOF = 25 - public static final NEW = 26 - public static final NULL = 27 - public static final RETURN = 28 - public static final PUBLIC = 29 - public static final PROTECTED = 30 - public static final INTERNAL = 31 - public static final OVERRIDE = 32 - public static final PARTIAL = 33 - public static final PRIVATE = 34 - public static final SET = 35 - public static final STATIC = 36 - public static final SUPER = 37 - public static final THIS = 38 - public static final THROW = 39 - public static final TRUE = 40 - public static final TRY = 41 - public static final TYPEOF = 42 - public static final VAR = 43 - public static final VIRTUAL = 44 - public static final WHILE = 45 - public static final YIELD = 46 - public static final SWITCH = 47 - public static final CASE = 48 - public static final DEFAULT = 49 - public static final INPLACE_DIVISION = 50 - public static final INPLACE_ADD = 51 - public static final INPLACE_SUBTRACT = 52 - public static final INPLACE_MULTIPLY = 53 - public static final SL_COMMENT = 54 - public static final PRAGMA_ON = 55 - public static final PRAGMA_OFF = 56 - public static final ID = 57 - public static final DOUBLE_QUOTED_STRING = 58 - public static final LBRACE = 59 - public static final RBRACE = 60 - public static final LPAREN = 61 - public static final RPAREN = 62 - public static final DOT = 63 - public static final COLON = 64 - public static final COMMA = 65 - public static final LBRACK = 66 - public static final RBRACK = 67 - public static final BITWISE_OR = 68 - public static final INPLACE_BITWISE_OR = 69 - public static final BITWISE_AND = 70 - public static final BITWISE_XOR = 71 - public static final INPLACE_BITWISE_AND = 72 - public static final LOGICAL_OR = 73 - public static final LOGICAL_AND = 74 - public static final EOS = 75 - public static final ASSIGN = 76 - public static final INCREMENT = 77 - public static final DECREMENT = 78 - public static final ADD = 79 - public static final SUBTRACT = 80 - public static final MODULUS = 81 - public static final MULTIPLY = 82 - public static final EQUALITY = 83 - public static final INEQUALITY = 84 - public static final QUESTION_MARK = 85 - public static final BITWISE_NOT = 86 - public static final REFERENCE_EQUALITY = 87 - public static final REFERENCE_INEQUALITY = 88 - public static final LESS_THAN = 89 - public static final LESS_THAN_OR_EQUAL = 90 - public static final SHIFT_LEFT = 91 - public static final INPLACE_SHIFT_LEFT = 92 - public static final GREATER_THAN = 93 - public static final GREATER_THAN_OR_EQUAL = 94 - public static final SHIFT_RIGHT = 95 - public static final INPLACE_SHIFT_RIGHT = 96 - public static final AT = 97 - public static final SCRIPT_ATTRIBUTE_MARKER = 98 - public static final ASSEMBLY_ATTRIBUTE_MARKER = 99 - public static final INPLACE_BITWISE_XOR = 100 - public static final NOT = 101 - public static final DIVISION = 102 - public static final RE_LITERAL = 103 - public static final DOUBLE = 104 - public static final INT = 105 - public static final LONG = 106 - public static final SINGLE_QUOTED_STRING = 107 - public static final DOUBLE_SUFFIX = 108 - public static final EXPONENT = 109 - public static final PRAGMA_WHITE_SPACE = 110 - public static final WHITE_SPACE = 111 - public static final DQS_ESC = 112 - public static final SQS_ESC = 113 - public static final SESC = 114 - public static final ML_COMMENT = 115 - public static final RE_CHAR = 116 - public static final RE_ESC = 117 - public static final NEWLINE = 118 - public static final ID_LETTER = 119 - public static final DIGIT = 120 - public static final HEXDIGIT = 121 + public static final EACH = 12 + public static final ENUM = 13 + public static final EXTENDS = 14 + public static final FALSE = 15 + public static final FINAL = 16 + public static final FINALLY = 17 + public static final FOR = 18 + public static final FUNCTION = 19 + public static final GET = 20 + public static final IF = 21 + public static final IMPORT = 22 + public static final IMPLEMENTS = 23 + public static final IN = 24 + public static final INTERFACE = 25 + public static final INSTANCEOF = 26 + public static final NEW = 27 + public static final NOT = 28 + public static final NULL = 29 + public static final RETURN = 30 + public static final PUBLIC = 31 + public static final PROTECTED = 32 + public static final INTERNAL = 33 + public static final OVERRIDE = 34 + public static final PARTIAL = 35 + public static final PRIVATE = 36 + public static final SET = 37 + public static final STATIC = 38 + public static final SUPER = 39 + public static final THIS = 40 + public static final THROW = 41 + public static final TRUE = 42 + public static final TRY = 43 + public static final TYPEOF = 44 + public static final VAR = 45 + public static final VIRTUAL = 46 + public static final WHILE = 47 + public static final YIELD = 48 + public static final SWITCH = 49 + public static final CASE = 50 + public static final DEFAULT = 51 + public static final INPLACE_DIVISION = 52 + public static final INPLACE_ADD = 53 + public static final INPLACE_SUBTRACT = 54 + public static final INPLACE_MULTIPLY = 55 + public static final SL_COMMENT = 56 + public static final PRAGMA_ON = 57 + public static final PRAGMA_OFF = 58 + public static final ID = 59 + public static final DOUBLE_QUOTED_STRING = 60 + public static final LBRACE = 61 + public static final RBRACE = 62 + public static final LPAREN = 63 + public static final RPAREN = 64 + public static final DOT = 65 + public static final COLON = 66 + public static final COMMA = 67 + public static final LBRACK = 68 + public static final RBRACK = 69 + public static final BITWISE_OR = 70 + public static final INPLACE_BITWISE_OR = 71 + public static final BITWISE_AND = 72 + public static final BITWISE_XOR = 73 + public static final INPLACE_BITWISE_AND = 74 + public static final LOGICAL_OR = 75 + public static final LOGICAL_AND = 76 + public static final EOS = 77 + public static final ASSIGN = 78 + public static final INCREMENT = 79 + public static final DECREMENT = 80 + public static final ADD = 81 + public static final SUBTRACT = 82 + public static final MODULUS = 83 + public static final MULTIPLY = 84 + public static final EQUALITY = 85 + public static final INEQUALITY = 86 + public static final QUESTION_MARK = 87 + public static final BITWISE_NOT = 88 + public static final REFERENCE_EQUALITY = 89 + public static final REFERENCE_INEQUALITY = 90 + public static final LESS_THAN = 91 + public static final LESS_THAN_OR_EQUAL = 92 + public static final SHIFT_LEFT = 93 + public static final INPLACE_SHIFT_LEFT = 94 + public static final GREATER_THAN = 95 + public static final GREATER_THAN_OR_EQUAL = 96 + public static final SHIFT_RIGHT = 97 + public static final INPLACE_SHIFT_RIGHT = 98 + public static final AT = 99 + public static final SCRIPT_ATTRIBUTE_MARKER = 100 + public static final ASSEMBLY_ATTRIBUTE_MARKER = 101 + public static final INPLACE_BITWISE_XOR = 102 + public static final LOGICAL_NOT = 103 + public static final DIVISION = 104 + public static final RE_LITERAL = 105 + public static final DOUBLE = 106 + public static final INT = 107 + public static final LONG = 108 + public static final SINGLE_QUOTED_STRING = 109 + public static final DOUBLE_SUFFIX = 110 + public static final EXPONENT = 111 + public static final PRAGMA_WHITE_SPACE = 112 + public static final WHITE_SPACE = 113 + public static final DQS_ESC = 114 + public static final SQS_ESC = 115 + public static final SESC = 116 + public static final ML_COMMENT = 117 + public static final RE_CHAR = 118 + public static final RE_ESC = 119 + public static final NEWLINE = 120 + public static final ID_LETTER = 121 + public static final DIGIT = 122 + public static final HEXDIGIT = 123 diff --git a/src/UnityScript/Parser/UnityScriptTokenTypes.txt b/src/UnityScript/Parser/UnityScriptTokenTypes.txt index b3aa8d2..0fb8c44 100644 --- a/src/UnityScript/Parser/UnityScriptTokenTypes.txt +++ b/src/UnityScript/Parser/UnityScriptTokenTypes.txt @@ -8,113 +8,115 @@ CLASS="class"=8 CONTINUE="continue"=9 DO="do"=10 ELSE="else"=11 -ENUM="enum"=12 -EXTENDS="extends"=13 -FALSE="false"=14 -FINAL="final"=15 -FINALLY="finally"=16 -FOR="for"=17 -FUNCTION="function"=18 -GET="get"=19 -IF="if"=20 -IMPORT="import"=21 -IMPLEMENTS="implements"=22 -IN="in"=23 -INTERFACE="interface"=24 -INSTANCEOF="instanceof"=25 -NEW="new"=26 -NULL="null"=27 -RETURN="return"=28 -PUBLIC="public"=29 -PROTECTED="protected"=30 -INTERNAL="internal"=31 -OVERRIDE="override"=32 -PARTIAL="partial"=33 -PRIVATE="private"=34 -SET="set"=35 -STATIC="static"=36 -SUPER="super"=37 -THIS="this"=38 -THROW="throw"=39 -TRUE="true"=40 -TRY="try"=41 -TYPEOF="typeof"=42 -VAR="var"=43 -VIRTUAL="virtual"=44 -WHILE="while"=45 -YIELD="yield"=46 -SWITCH="switch"=47 -CASE="case"=48 -DEFAULT="default"=49 -INPLACE_DIVISION="/="=50 -INPLACE_ADD="+="=51 -INPLACE_SUBTRACT="-="=52 -INPLACE_MULTIPLY="*="=53 -SL_COMMENT="//"=54 -PRAGMA_ON="pragma on"=55 -PRAGMA_OFF="pragma off"=56 -ID="an identifier"=57 -DOUBLE_QUOTED_STRING="a string"=58 -LBRACE="{"=59 -RBRACE="}"=60 -LPAREN="("=61 -RPAREN=")"=62 -DOT="."=63 -COLON=":"=64 -COMMA=","=65 -LBRACK="["=66 -RBRACK="]"=67 -BITWISE_OR="|"=68 -INPLACE_BITWISE_OR="|="=69 -BITWISE_AND="&"=70 -BITWISE_XOR="^"=71 -INPLACE_BITWISE_AND="&="=72 -LOGICAL_OR="||"=73 -LOGICAL_AND="&&"=74 -EOS=";"=75 -ASSIGN="="=76 -INCREMENT="++"=77 -DECREMENT="--"=78 -ADD="+"=79 -SUBTRACT="-"=80 -MODULUS="%"=81 -MULTIPLY="*"=82 -EQUALITY="=="=83 -INEQUALITY="!="=84 -QUESTION_MARK="?"=85 -BITWISE_NOT="~"=86 -REFERENCE_EQUALITY="==="=87 -REFERENCE_INEQUALITY="!=="=88 -LESS_THAN="<"=89 -LESS_THAN_OR_EQUAL="<="=90 -SHIFT_LEFT="<<"=91 -INPLACE_SHIFT_LEFT="<<="=92 -GREATER_THAN=">"=93 -GREATER_THAN_OR_EQUAL=">="=94 -SHIFT_RIGHT=">>"=95 -INPLACE_SHIFT_RIGHT=">>="=96 -AT="@"=97 -SCRIPT_ATTRIBUTE_MARKER="@script"=98 -ASSEMBLY_ATTRIBUTE_MARKER="@assembly"=99 -INPLACE_BITWISE_XOR=100 -NOT=101 -DIVISION=102 -RE_LITERAL=103 -DOUBLE=104 -INT=105 -LONG=106 -SINGLE_QUOTED_STRING=107 -DOUBLE_SUFFIX=108 -EXPONENT=109 -PRAGMA_WHITE_SPACE=110 -WHITE_SPACE=111 -DQS_ESC=112 -SQS_ESC=113 -SESC=114 -ML_COMMENT=115 -RE_CHAR=116 -RE_ESC=117 -NEWLINE=118 -ID_LETTER=119 -DIGIT=120 -HEXDIGIT=121 +EACH="each"=12 +ENUM="enum"=13 +EXTENDS="extends"=14 +FALSE="false"=15 +FINAL="final"=16 +FINALLY="finally"=17 +FOR="for"=18 +FUNCTION="function"=19 +GET="get"=20 +IF="if"=21 +IMPORT="import"=22 +IMPLEMENTS="implements"=23 +IN="in"=24 +INTERFACE="interface"=25 +INSTANCEOF="instanceof"=26 +NEW="new"=27 +NOT="not"=28 +NULL="null"=29 +RETURN="return"=30 +PUBLIC="public"=31 +PROTECTED="protected"=32 +INTERNAL="internal"=33 +OVERRIDE="override"=34 +PARTIAL="partial"=35 +PRIVATE="private"=36 +SET="set"=37 +STATIC="static"=38 +SUPER="super"=39 +THIS="this"=40 +THROW="throw"=41 +TRUE="true"=42 +TRY="try"=43 +TYPEOF="typeof"=44 +VAR="var"=45 +VIRTUAL="virtual"=46 +WHILE="while"=47 +YIELD="yield"=48 +SWITCH="switch"=49 +CASE="case"=50 +DEFAULT="default"=51 +INPLACE_DIVISION="/="=52 +INPLACE_ADD="+="=53 +INPLACE_SUBTRACT="-="=54 +INPLACE_MULTIPLY="*="=55 +SL_COMMENT="//"=56 +PRAGMA_ON="pragma on"=57 +PRAGMA_OFF="pragma off"=58 +ID="an identifier"=59 +DOUBLE_QUOTED_STRING="a string"=60 +LBRACE="{"=61 +RBRACE="}"=62 +LPAREN="("=63 +RPAREN=")"=64 +DOT="."=65 +COLON=":"=66 +COMMA=","=67 +LBRACK="["=68 +RBRACK="]"=69 +BITWISE_OR="|"=70 +INPLACE_BITWISE_OR="|="=71 +BITWISE_AND="&"=72 +BITWISE_XOR="^"=73 +INPLACE_BITWISE_AND="&="=74 +LOGICAL_OR="||"=75 +LOGICAL_AND="&&"=76 +EOS=";"=77 +ASSIGN="="=78 +INCREMENT="++"=79 +DECREMENT="--"=80 +ADD="+"=81 +SUBTRACT="-"=82 +MODULUS="%"=83 +MULTIPLY="*"=84 +EQUALITY="=="=85 +INEQUALITY="!="=86 +QUESTION_MARK="?"=87 +BITWISE_NOT="~"=88 +REFERENCE_EQUALITY="==="=89 +REFERENCE_INEQUALITY="!=="=90 +LESS_THAN="<"=91 +LESS_THAN_OR_EQUAL="<="=92 +SHIFT_LEFT="<<"=93 +INPLACE_SHIFT_LEFT="<<="=94 +GREATER_THAN=">"=95 +GREATER_THAN_OR_EQUAL=">="=96 +SHIFT_RIGHT=">>"=97 +INPLACE_SHIFT_RIGHT=">>="=98 +AT="@"=99 +SCRIPT_ATTRIBUTE_MARKER="@script"=100 +ASSEMBLY_ATTRIBUTE_MARKER="@assembly"=101 +INPLACE_BITWISE_XOR=102 +LOGICAL_NOT=103 +DIVISION=104 +RE_LITERAL=105 +DOUBLE=106 +INT=107 +LONG=108 +SINGLE_QUOTED_STRING=109 +DOUBLE_SUFFIX=110 +EXPONENT=111 +PRAGMA_WHITE_SPACE=112 +WHITE_SPACE=113 +DQS_ESC=114 +SQS_ESC=115 +SESC=116 +ML_COMMENT=117 +RE_CHAR=118 +RE_ESC=119 +NEWLINE=120 +ID_LETTER=121 +DIGIT=122 +HEXDIGIT=123 From 9a75da907fe27955ee889ddf330fd225e101c4dc Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 25 Jul 2012 11:25:26 -0300 Subject: [PATCH 235/276] preserve ability to use 'each' as a enum member name --- src/UnityScript/UnityScript.g | 2 +- tests/parser/for-each-in-2.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index cc9201b..be1228e 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -591,7 +591,7 @@ enum_member [EnumDefinition container] { }: (attributes)? - name:ID (ASSIGN initializer=integer_literal)? + name=identifier (ASSIGN initializer=integer_literal)? { em = EnumMember(ToLexicalInfo(name), Name: name.getText(), Initializer: initializer) FlushAttributes(em) diff --git a/tests/parser/for-each-in-2.js b/tests/parser/for-each-in-2.js index a40d828..9554dd2 100644 --- a/tests/parser/for-each-in-2.js +++ b/tests/parser/for-each-in-2.js @@ -1,4 +1,8 @@ /* +enum Options: + + each = 42 + def each(each as Object): pass @@ -8,6 +12,10 @@ for each in (1, 2, 3): print(i) */ +enum Options { + each = 42 +} + function each(each: Object) { } From 475d670317b6db025131672851f2695a2f3b60af Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 25 Jul 2012 11:27:40 -0300 Subject: [PATCH 236/276] update antlr generated file --- src/UnityScript/Parser/UnityScriptParser.boo | 139 ++++++++++--------- 1 file changed, 74 insertions(+), 65 deletions(-) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index a9e6340..b958151 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -1155,12 +1155,15 @@ partial class UnityScriptParser(antlr.LLkParser): container.Members.Add(ed) match(LBRACE) _givenValue = LA(1) - if ((_givenValue == ID) + if ((_givenValue == EACH) + or (_givenValue ==FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) or (_givenValue ==AT) ): // 1827 enum_member(ed) while true: - if ((LA(1)==COMMA) and (LA(2)==ID or LA(2)==AT)): + if ((LA(1)==COMMA) and (tokenSet_35_.member(cast(int, LA(2))))): match(COMMA) enum_member(ed) else: @@ -1470,14 +1473,14 @@ partial class UnityScriptParser(antlr.LLkParser): match(RBRACK) if 0 == inputState.guessing: tr = ArrayTypeReference(tr.LexicalInfo, tr, IntegerLiteralExpression(ToLexicalInfo(lbrack), rank)) - elif ((tokenSet_35_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_36_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_35_) + recover(ex,tokenSet_36_) else: raise return tr @@ -1503,7 +1506,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_37_) else: raise @@ -1573,7 +1576,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_37_) + recover(ex,tokenSet_38_) else: raise @@ -1612,7 +1615,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_38_) + recover(ex,tokenSet_39_) else: raise return token @@ -1634,7 +1637,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_39_) + recover(ex,tokenSet_40_) else: raise @@ -1642,18 +1645,20 @@ partial class UnityScriptParser(antlr.LLkParser): container as EnumDefinition ) as void: //throws RecognitionException, TokenStreamException - name as IToken = null try: // for error handling _givenValue = LA(1) if ((_givenValue == AT)): // 1831 attributes() - elif ((_givenValue == ID)): // 1831 + elif ((_givenValue == EACH) + or (_givenValue ==FINAL) + or (_givenValue ==INTERNAL) + or (_givenValue ==ID) + ): // 1827 pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - name = LT(1) - match(ID) + name=identifier() _givenValue = LA(1) if ((_givenValue == ASSIGN)): // 1831 match(ASSIGN) @@ -1671,7 +1676,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_40_) + recover(ex,tokenSet_41_) else: raise @@ -1752,7 +1757,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling block(b) while true: - if ((LA(1)==EOS) and (tokenSet_41_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_42_.member(cast(int, LA(2))))): match(EOS) else: goto _loop101_breakloop @@ -1760,7 +1765,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_41_) + recover(ex,tokenSet_42_) else: raise @@ -1809,7 +1814,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling - if ((LA(1)==LBRACE) and (tokenSet_42_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_43_.member(cast(int, LA(2))))): compound_statement(b) elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 statement(b) @@ -1878,7 +1883,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling macroName=member() synPredMatched148 as bool = false - if ((LA(1)==LBRACE) and (tokenSet_42_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_43_.member(cast(int, LA(2))))): _m148 as int = mark() synPredMatched148 = true ++inputState.guessing @@ -1890,7 +1895,7 @@ partial class UnityScriptParser(antlr.LLkParser): --inputState.guessing if synPredMatched148: compound_statement(b) - elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_43_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_44_.member(cast(int, LA(2))))): // line 2102 expression_list(args) compound_statement(b) else: @@ -2089,7 +2094,7 @@ partial class UnityScriptParser(antlr.LLkParser): elif ((_givenValue == LPAREN)): // 1831 match(LPAREN) synPredMatched132 as bool = false - if ((tokenSet_44_.member(cast(int, LA(1)))) and (tokenSet_45_.member(cast(int, LA(2))))): + if ((tokenSet_45_.member(cast(int, LA(1)))) and (tokenSet_46_.member(cast(int, LA(2))))): _m132 as int = mark() synPredMatched132 = true ++inputState.guessing @@ -2112,7 +2117,7 @@ partial class UnityScriptParser(antlr.LLkParser): --inputState.guessing if synPredMatched132: stmt=for_in(container) - elif ((tokenSet_46_.member(cast(int, LA(1)))) and (tokenSet_47_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_47_.member(cast(int, LA(1)))) and (tokenSet_48_.member(cast(int, LA(2))))): // line 2102 stmt=for_c(container) else: raise NoViableAltException(LT(1), getFilename()) @@ -2335,7 +2340,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling yt = LT(1) match(YIELD) - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_48_.member(cast(int, LA(2))))): + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): e=expression() elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 pass // 947 @@ -2359,7 +2364,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling ret = LT(1) match(RETURN) - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_48_.member(cast(int, LA(2))))): + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): e=expression() elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 pass // 947 @@ -2424,7 +2429,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling t = LT(1) match(THROW) - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_48_.member(cast(int, LA(2))))): + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): e=expression() elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 pass // 947 @@ -2519,7 +2524,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_49_) + recover(ex,tokenSet_50_) else: raise return d @@ -2678,7 +2683,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_50_) + recover(ex,tokenSet_51_) else: raise return e @@ -2924,7 +2929,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_51_) + recover(ex,tokenSet_52_) else: raise @@ -3007,7 +3012,7 @@ partial class UnityScriptParser(antlr.LLkParser): arguments = gtr.GenericArguments type_reference_list(arguments) match(GREATER_THAN) - elif ((tokenSet_35_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_36_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: tr = SimpleTypeReference(ToLexicalInfo(typeName), Name: typeName.getText()) else: @@ -3015,7 +3020,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_35_) + recover(ex,tokenSet_36_) else: raise return tr @@ -3037,14 +3042,14 @@ partial class UnityScriptParser(antlr.LLkParser): returnType=type_reference() if 0 == inputState.guessing: callableTypeRef.ReturnType = returnType - elif ((tokenSet_35_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_36_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_35_) + recover(ex,tokenSet_36_) else: raise return tr @@ -3080,7 +3085,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_35_) + recover(ex,tokenSet_36_) else: raise @@ -3354,7 +3359,7 @@ partial class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((LA(1)==LBRACE) and (tokenSet_42_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_43_.member(cast(int, LA(2))))): block(body) elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 returnValue=expression() @@ -3689,7 +3694,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_52_) + recover(ex,tokenSet_53_) else: raise @@ -3705,7 +3710,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=atom() while true: - if ((LA(1)==LBRACK) and (tokenSet_53_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACK) and (tokenSet_54_.member(cast(int, LA(2))))): lbrack = LT(1) match(LBRACK) if 0 == inputState.guessing: @@ -3721,7 +3726,7 @@ partial class UnityScriptParser(antlr.LLkParser): goto _loop245_breakloop :_loop245_breakloop match(RBRACK) - elif ((LA(1)==DOT) and (tokenSet_54_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DOT) and (tokenSet_55_.member(cast(int, LA(2))))): // line 2102 match(DOT) e=member_reference_expression(e) elif ((LA(1)==LPAREN) and (tokenSet_23_.member(cast(int, LA(2))))): // line 2102 @@ -3991,7 +3996,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=shift() while true: - if ((tokenSet_55_.member(cast(int, LA(1)))) and (tokenSet_56_.member(cast(int, LA(2))))): + if ((tokenSet_56_.member(cast(int, LA(1)))) and (tokenSet_57_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == IN) or (_givenValue ==NOT) @@ -4073,7 +4078,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=comparison() while true: - if ((tokenSet_57_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((tokenSet_58_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == EQUALITY)): // 1831 te = LT(1) @@ -4287,7 +4292,7 @@ partial class UnityScriptParser(antlr.LLkParser): lbrack = LT(1) match(LBRACK) synPredMatched311 as bool = false - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_58_.member(cast(int, LA(2))))): + if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_59_.member(cast(int, LA(2))))): _m311 as int = mark() synPredMatched311 = true ++inputState.guessing @@ -4327,7 +4332,7 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) - elif ((tokenSet_59_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_60_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)); items = ale.Items; expression_list(items) @@ -4537,7 +4542,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_40_) + recover(ex,tokenSet_41_) else: raise return ep @@ -4811,103 +4816,107 @@ partial class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) private static def mk_tokenSet_35_() as (long): - data = (-504403158269706254L, 70162585747455L, 0L, 0L, ) + data = (576460760893427712L, 34359738368L, 0L, 0L, ) return data public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) private static def mk_tokenSet_36_() as (long): - data = (2305843009213693952L, 2147483648L, 0L, 0L, ) + data = (-504403158269706254L, 70162585747455L, 0L, 0L, ) return data public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) private static def mk_tokenSet_37_() as (long): - data = (4611686018427912192L, 34359738368L, 0L, 0L, ) + data = (2305843009213693952L, 2147483648L, 0L, 0L, ) return data public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) private static def mk_tokenSet_38_() as (long): - data = (-571957153024196702L, 68753853636637L, 0L, 0L, ) + data = (4611686018427912192L, 34359738368L, 0L, 0L, ) return data public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) private static def mk_tokenSet_39_() as (long): - data = (0L, 1L, 0L, 0L, ) + data = (-571957153024196702L, 68753853636637L, 0L, 0L, ) return data public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) private static def mk_tokenSet_40_() as (long): - data = (4611686018427387904L, 8L, 0L, 0L, ) + data = (0L, 1L, 0L, 0L, ) return data public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) private static def mk_tokenSet_41_() as (long): - data = (-571957153040973918L, 68753853620240L, 0L, 0L, ) + data = (4611686018427387904L, 8L, 0L, 0L, ) return data public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) private static def mk_tokenSet_42_() as (long): - data = (-575405631708817888L, 68719493881872L, 0L, 0L, ) + data = (-571957153040973918L, 68753853620240L, 0L, 0L, ) return data public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) private static def mk_tokenSet_43_() as (long): - data = (-575405631356496272L, 69835094473594L, 0L, 0L, ) + data = (-575405631708817888L, 68719493881872L, 0L, 0L, ) return data public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) private static def mk_tokenSet_44_() as (long): - data = (576495945265516544L, 0L, ) + data = (-575405631356496272L, 69835094473594L, 0L, 0L, ) return data public static final tokenSet_44_ = BitSet(mk_tokenSet_44_()) private static def mk_tokenSet_45_() as (long): - data = (576460760910204928L, 0L, ) + data = (576495945265516544L, 0L, ) return data public static final tokenSet_45_ = BitSet(mk_tokenSet_45_()) private static def mk_tokenSet_46_() as (long): - data = (-5188087946187075584L, 68719493881872L, 0L, 0L, ) + data = (576460760910204928L, 0L, ) return data public static final tokenSet_46_ = BitSet(mk_tokenSet_46_()) private static def mk_tokenSet_47_() as (long): - data = (-508883108778897328L, 70128226009074L, 0L, 0L, ) + data = (-5188087946187075584L, 68719493881872L, 0L, 0L, ) return data public static final tokenSet_47_ = BitSet(mk_tokenSet_47_()) private static def mk_tokenSet_48_() as (long): - data = (-571957169868521486L, 69869454211954L, 0L, 0L, ) + data = (-508883108778897328L, 70128226009074L, 0L, 0L, ) return data public static final tokenSet_48_ = BitSet(mk_tokenSet_48_()) private static def mk_tokenSet_49_() as (long): - data = (-571957170204065886L, 68753853636624L, 0L, 0L, ) + data = (-571957169868521486L, 69869454211954L, 0L, 0L, ) return data public static final tokenSet_49_ = BitSet(mk_tokenSet_49_()) private static def mk_tokenSet_50_() as (long): - data = (-571957170220843102L, 68753853620241L, 0L, 0L, ) + data = (-571957170204065886L, 68753853636624L, 0L, 0L, ) return data public static final tokenSet_50_ = BitSet(mk_tokenSet_50_()) private static def mk_tokenSet_51_() as (long): - data = (2305843009213693952L, 33L, 0L, 0L, ) + data = (-571957170220843102L, 68753853620241L, 0L, 0L, ) return data public static final tokenSet_51_ = BitSet(mk_tokenSet_51_()) private static def mk_tokenSet_52_() as (long): - data = (0L, 40L, 0L, 0L, ) + data = (2305843009213693952L, 33L, 0L, 0L, ) return data public static final tokenSet_52_ = BitSet(mk_tokenSet_52_()) private static def mk_tokenSet_53_() as (long): - data = (-5188123130559164416L, 68719493873684L, 0L, 0L, ) + data = (0L, 40L, 0L, 0L, ) return data public static final tokenSet_53_ = BitSet(mk_tokenSet_53_()) private static def mk_tokenSet_54_() as (long): - data = (576460889743429632L, 134217728L, 0L, 0L, ) + data = (-5188123130559164416L, 68719493873684L, 0L, 0L, ) return data public static final tokenSet_54_ = BitSet(mk_tokenSet_54_()) private static def mk_tokenSet_55_() as (long): - data = (352321536L, 6845104128L, 0L, 0L, ) + data = (576460889743429632L, 134217728L, 0L, 0L, ) return data public static final tokenSet_55_ = BitSet(mk_tokenSet_55_()) private static def mk_tokenSet_56_() as (long): - data = (-5188123130542387200L, 68719493873680L, 0L, 0L, ) + data = (352321536L, 6845104128L, 0L, 0L, ) return data public static final tokenSet_56_ = BitSet(mk_tokenSet_56_()) private static def mk_tokenSet_57_() as (long): - data = (0L, 106954752L, 0L, 0L, ) + data = (-5188123130542387200L, 68719493873680L, 0L, 0L, ) return data public static final tokenSet_57_ = BitSet(mk_tokenSet_57_()) private static def mk_tokenSet_58_() as (long): - data = (-576437111779192752L, 69835094465394L, 0L, 0L, ) + data = (0L, 106954752L, 0L, 0L, ) return data public static final tokenSet_58_ = BitSet(mk_tokenSet_58_()) private static def mk_tokenSet_59_() as (long): - data = (-5188123130559164416L, 68719493873712L, 0L, 0L, ) + data = (-576437111779192752L, 69835094465394L, 0L, 0L, ) return data public static final tokenSet_59_ = BitSet(mk_tokenSet_59_()) + private static def mk_tokenSet_60_() as (long): + data = (-5188123130559164416L, 68719493873712L, 0L, 0L, ) + return data + public static final tokenSet_60_ = BitSet(mk_tokenSet_60_()) From 59351c998644df46fcf65a4c52d3191ea0b8b28c Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 25 Jul 2012 11:34:20 -0300 Subject: [PATCH 237/276] update test case to prove 'each' can still be used as a regular identifier --- tests/parser/for-each-in-2.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/parser/for-each-in-2.js b/tests/parser/for-each-in-2.js index 9554dd2..024a39d 100644 --- a/tests/parser/for-each-in-2.js +++ b/tests/parser/for-each-in-2.js @@ -9,7 +9,7 @@ def each(each as Object): each = 'Test' for each in (1, 2, 3): - print(i) + print(each) */ enum Options { @@ -21,4 +21,4 @@ function each(each: Object) { var each = "Test"; for each (var each in [1, 2, 3]) - print (i); \ No newline at end of file + print(each); \ No newline at end of file From 4f833e6a9358dcfe8c70ed62d8a4da51fff66f7f Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 26 Oct 2012 12:44:20 -0200 Subject: [PATCH 238/276] build using gradle --- build.gradle | 92 +++++++++++++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 45502 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 164 +++++++++++++++++++++++ gradlew.bat | 90 +++++++++++++ settings.gradle | 11 ++ 6 files changed, 363 insertions(+) create mode 100755 build.gradle create mode 100755 gradle/wrapper/gradle-wrapper.jar create mode 100755 gradle/wrapper/gradle-wrapper.properties create mode 100755 gradlew create mode 100755 gradlew.bat create mode 100755 settings.gradle diff --git a/build.gradle b/build.gradle new file mode 100755 index 0000000..0db8352 --- /dev/null +++ b/build.gradle @@ -0,0 +1,92 @@ + +buildscript { + repositories { + ivy { url '../repository' } + ivy { url 'http://unity-technologies.github.com/kaizen/repositories/unstable' } + mavenCentral() + } + dependencies { + classpath 'kaizen:kaizen:0.2.0' + } +} + +allprojects { + version = '0.1.1' + + repositories { + ivy { url 'http://unity-technologies.github.com/kaizen/repositories/unstable' } + } +} + +apply plugin: 'kaizen-bundle' +apply plugin: 'nunit' +apply plugin: 'idea' + +configurations { + boo +} + +ext { + booVersion = '0.9.5.6+' +} + +dependencies { + boo "boo:boo:$booVersion" + 'default' project(':us'), project(':UnityScript'), project(':UnityScript.Lang') +} + +unity.mono.booc.executable = file('lib/Boo/booc.exe') + +project(':us') { + dependencies { + 'default' project(':UnityScript'), project(':UnityScript.Lang') + 'default' "boo:Boo.Lang.Useful:$booVersion" + } + assembly { + target = 'exe' + } +} + +project(':UnityScript') { + dependencies { + 'default' project(':UnityScript.Lang') + ['Boo.Lang.Extensions', 'Boo.Lang.Parser', 'Boo.Lang.Compiler', 'Boo.Lang.PatternMatching'].each { + 'default' "boo:$it:$booVersion" + } + } +} + +project(':UnityScript.Lang') { +} + +project(':UnityScript.Tests.CSharp') { + dependencies { + 'default' "boo:Boo.Lang:$booVersion" + } +} + +project(':UnityScript.Tests') { + apply plugin: 'nunit-assembly' + + afterEvaluate { + testDefault { + exclude 'FailsOnMono' + } + } + + dependencies { + [':UnityScript', ':UnityScript.Lang', ':us', ':UnityScript.Tests.CSharp'].each { + 'default' project(it) + } + } +} + +task bundle(type: Zip) { + from projectDir + include 'README.md' + include 'license.txt' +} + +artifacts { + 'default' bundle +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100755 index 0000000000000000000000000000000000000000..7f1e239c8466c730b569575c494a89e6bb4c416a GIT binary patch literal 45502 zcmagFV~{A_vMAWQZQHhO+qP}nw(Z_++qP}nHh1IgJLk^3?>lp5rXsSUe&kv!R#qDF zQb53v007|N0Hj_&`~ZI+!2f#veIWjVjEJ%TjfAWy9T0&0KM))I0B^AVB4GRl< zMnG0VR76RcRz~zuW@=JeiiUO`Mv8`VW@@%kk$#D3@A%*t@c-D1iR1rciFu&0Y2jbg<-b7mpO*;Rx!GFV85k2Y z&>C4AI63)5%Rmm$!-wpevuIMe(gi}ThUWI;*%Q!m3s?(TLr6$ebZ0@q?d1<4J6v*~ z@Ze5)*S;P?;0q1(p&JT%x3Hy6`jnFxbTn7bt0G@YZh;uIFtxYzFkg^oRnnl728Xyr zQjtN@cw7qWNR9gWRYn5{I?{`F#Gvj-$%%7et`3mzYLJCVT8q2$vE=>S6U5Eh4f8sp(`d124f4Emmsh<=}H!H{}?M{ zq%i_M;#+xTqj$UT-d3d3^v0wXhu9@FZO))~i>j^81jly)4nU?h2I|*rYwNNQnUzE= zV(4abI|#NvO~=09G}wagTQ8;Jn83B;6qt32kwmM+9lUtlB3#)qrVGJl*0J!<-yv6 zQMD&+q+G7oo~&>C{DA&PDgKv^S{hVY3ll9)=4JD0OfLvwB?$av<4m>;8OPy9_t7mJ z(6aIt8D@O&M9Z~mvtXs-xm+m@9)z`J%E*YX~K{&2X4s&2G%6^ zz&ynC0Nl~k_)Ul8VCvC&q9dhxZluW?b>G;14``IoCS8s>KO5ZU3KyS0?+Wc5v+?C! z2X^lDgVnC}=Nu)=zGL*wHd-~KG!hkhq-1OsOv$Nsrx8eF*+5=m@Re=tMSS%H{HhJ-AtVU3Ri&J zLqv;=-7=w*?cDvsE!Rp7v&zzwWiPsTSTl5=ZARfx8)RLLvp7oGLMB6A79G&xknxkY(q-(!F9#K)V4Y zHtxj- zuy}w{XD6_DnXa=O46f1)*&xfnE5K=?Cf?)mJ{xmVDG&1kLba=tF@*_cID@&Nl$H!j zEM5FUgWNUr)Rjgbbee-I`zes!nlg?as+&|+ZK2R#_#bgXT{3Eegp8OCh8l>IXzKcH z?|i$6D(z}}GH}@)ChB(RswzSX)672kn+?~o{pG1E$FWw>u@k@W z3`4$26`$0S`T!Tk{7t1wrJgkUw&pwndzNJV{8*BmJ@ga{z1z_ztjW{7IfOXO-J5(x zN|_dz60t(!^h2hK<=Q?W5}bsgG9tctRmX;A6UdDdPt%`XGkfzs_DXf~T`(9lPvHr| zkqwN?-&{1El$~R$R>vzqLhe|42*&M!DhY%Wit0q5{0Lu0@y~;6wJ{)LVFT?HFYw(L zZ(%*qP$8ZHDbB6zjHJxIg_U=ULTY?Y=q(Bt3Xk5GG5 z{H1%-_*YW!TPeDs9WSvL8OK0}x3GW+b>qpkhuk3JgP|YzAsS+DRq!D&ju?imV}G@u z@VSI?NybZH2&)BdsRT(+;G0CQV*oXv2U?R0Fk=|2K{(366pZ70AuHhkCBg{YPzjV6 z$D>Kc<1OJUF^WeSzKr@)hv36~rsMs9{8Oa;2ui9>{u)e-zdjQEe-`O~x0T`swtu~n z|2B{@s+UekD#$-JS;mXk50uG?k@AuJAJP6O){-icR4F~g^3;JHGImKJ#%$KCO(-aN zZ=zoV(6NK7zK$iZMv$(eJ%7Z?dpjX)bn&O3w!CI9b04`*bJu%+-XG}z!tNVGU8Bp~ zg@kZKnX^aABH38pNFJj>QH&nwY2A=0NmZoF-K7Reqk$b%YZxSEBph{vV$bnu&E2t> z7Oo75cKVA&wMRM=yU6Ic=!$Qx=;^5>vTc0VPmMBB>w&fl5p|f*>yjaTX!H zgrAGahJ%fUxMwaiXmS@M{CemW5O-OM5mI&U6ErsR;5KoVxX@B zOHiC}42n>KC!EEqrDtfu%S!0$PF&v4j_wS#jkOnB$SZp(Q;lhJnN8Fqz^A3D1QIe? zx7-!kFK4>5a1!97x^|Jq(V@u_q@X5gUKu&OM22)GE~n6tugD$fFCa(lZ7e!D8gpx+ zGov4(QJ7I#Qq$|G1xWxkOMvTgNDg4|O-L~YkE>OyrAr_S%9!b>&J<4^6#h)q;*^0_ zW-^I~!7wlxVA#&&$L*J*J!be=GH{&^iTtYBmNPHcwWu)S1OIA?@sh<_C%#p5P!WT) z&ctcHQ=EGUR!zjE!C__OtdZE=w0cSoT#4zMJ)vHejzTn$GEpUSGPRUtUH>*1tfONG9m(*)qx*Jt;Rpm_DS6{k@P-Bx4L#YgRZW8Q$ zQ_L&DbG`0CG ztPn*F$(lfSv_&<8$MebX9JjWtIAQE5O2~naa^7$3D#ng|&Ub5K{>U%d9~x@Tt~)3Y zg~cjtf=s&~1zKaXo8bI|6q|F1Z4Dc@QZ=w5iR&N%LA6iX9g0OFGxiDhE%&whNd9XE ztMA!b7-ZBcoi9n~>aZ5)p%ykWTdoMqJ)cQaSB9r@?Yqok6o^^Q`LzC#Koj}tk6=&OTJavO?6^)i zwV&Kro|qNx>@%2P0JrPzaDaSY+UVn#rTDbbEDy6=$dYY&b6OjL;9wmO2locVAjaZR3F2hgO{1O}M= z4=inyVz>p+=NKNy78g^hv5WMkT;2}r>$cZU`{{Ou-_Pj|7r@M(9%5`k8<<%=rNE#| zgy^ij(m@He;HgOvnH6Df3V!|=6=_@*x%CYW1flKSgN*Hph_yI-xSZ4*G#^*gX~A1n z_^gCGZeH902n5{$Np9Cvp%!6J-xnGQ_9)esx5QAIh&M@Ot>oG8YQY;PmS0eoUBj%J z$CD=V?!ot_f;U;@t>hbS&n&yG*nJSW?--X|R2$J=UvPavGGnGm)<%PoRVXe0%z1}p zYzp$EBF!%`+UaOx(gvx=#`TQi`*Lqr3s+lGHV+AY>w^wQA&E5P?(|#|Fwgrg|8ApD z+x19WI&u;*lsY?4(~JA7HEo;Ko`P~@$&0Sy%tO%(8g91Cgr2e#Wk&=L=|z@5f&MGP zyMg|5=?eIbUr3oXvYf{z%h^h)Qk0`+cTkb#_gi|<>y?=KHyQL(h8s{RJr9CuS9^lV%AJA?3M@(qm49Q}vbrhzf^fVjKObQtFgW4ld4|KL`n-hc7-u>r9| zSg(;8j#Z^yLCqc~f$6ilQyWZMpr8mA?286wDKF}?o%+v$@ zDU55wlG?oNg6TRKMpke=|Z?MH0W{&=%+N@BZTau9xFN*~LI0{$(qgV!ZS2UMR-_f>u7!4-!$dkkb0TutGV$7-akH*j2FgJdIWkvZ=YJ>G9V6;(_zix^0nX1v06 zq9v%Mup||5yS5U%Qq=<7a3bMfqUOY2qUgiu&sX?|Ty5g1)>QRD#uqeAOWjvQ>c8U} z;bjfsWZQFLy;ge2a2cpU6G-%OXMYrl6F#)Yl|iaif*;1eDF>3q1C&t`^5;;8M0}B} z4QEk{hAB79N!9AuTH-Qi;8{?vY72bGyKKDl!)&a>s<|#|?INxB_Y51DwlK;Ij2d0D zX@$#V<`q8b^U!$$1vrH?2c~eis}jJh4e0xOJISjCPMM53tSxBc7vC-Dbeht z5?}I&XfGX?k8L=5Cv@Ps8Hw}qvO?grACAFK99HpONMZ8{eXEylFy+%364UF+OL6)b zV1QifUH7AYat0aq92#_Hl(!vBR>^o+m!%#Bcj2MZX)e=IA6P^tiWZXBt{!vtVdpgq z>2dgctDWODB~FS&2>jj*C*2jEG^J$So7vE~sqgO;SG%7hEgfFQ#lhpZLmPP?4w~*4kU~j<0QiOs030-#cZS_`H$>~|ININU=hWF2i8(oc2^UEhQN*)QnnncN6`LnEtFQ|}jMUt2v>Y(1l9X+r!t%t9csm~bZU5e7m zr)_|*YU!UGNk6$Cd4V7C-K1te#MqxI!JSvCGq5MRg-#)>-cYq6JzMa5E)P0%idZPNiWccv#TMmz zszr!t09rW)tU9#FeA52`nbx}{H?C_5v_ zSLfTCJWFn8?sD#TbNzQW`9k|ZU!!0haMwl^H(cd;3tR;qEb9zs#L`xXSg6R-98uyGCNrCBr@?CQqe?MxqDtu_6p>xT}R> z&%qRjPer>N2BaCP$SKq{;iCBkoVoPQqh}0Bu!}1NmatxWZ*~LO(j?BKP1QCsxp6X` zMzt6$!3juFcnpV(h85Yp7g6cD)+{xjlD0R@KMrZoy#3`OnO}sf* zYZxumX9&v(`0O5wFhFgtzmUj_+W{MOm6+U_f9DahK8LS<-r*Q4AHP?_S*_`*p}(HH zlfLA8G;Km1)(aghbFtVCi6j&a_?zQjj0Y9T8xeRc3XXq6s2TO*KyUuBl?tWds>H&{F7quG8lA z9~zkrGwJm2CmvO(p}&{vvWJ{mA#1|wn}OJGQ&1?tXsP^$;wuWlyD2P`^I8j6C5NM} zL#fOdB@}z(tuURUMz7zT*CI=?$!*RUN?x*SJRUhx;EJ-hs={z9@tr-gem6yBbsTi= zzcHX$=`(g<4JkMjbDEbT9)^~-r`B{_5AYL(xmhBYf-y_NE83@xYI)X9xhyi0S zojr1cw`5d=ZxgILitiJ|z&+Lt*agIL7u+Lw3LGk!3-XEKsl1hqyhav`zO@a!T2xKy zM~?>N;s)f{3$8PcC~TGXGZ7}{m7?t>67(x*gZul(8-+1@Mx4Z3a|pqfP>)7qtQYBb z+{&`S2)>8#HuVs+^CH*B7>_mNz|X*mu~o<0%9x1&sa)spl(U113LDGdYY2`c^WF%T z3Sl`?wiNc99O0pJMOeUia1(rEuDB=4nLkB6Nntu36EAkJs*qKSAP!u~UzsfzlZM^j z2n*(=Zj{}BVK1|j=C-V@oF(!L;xJV|^#?_F>b6tX%>+TnGx!pk78bp=SnpKjXST1o z^B)2O#loi{N(lvp0+BF1vmwu-?9Bz|oC(5TMxtqL%|{+3w3ggc@X{QV6lKuTvuj1O z@DBR)i3>IKC#rL&6HrlCVDb?gSL*iGFtXg%E6s;Pr5wT7Y;eM}JP`w0haF*(BuEpu zlnR{)n{UX5$Q}|>Fh~cCa2NzHxT8Z7xku($x5@{y_)_Jmycxvc?YCNdy80qpm3CWJ z-y40x#_W#A749I@nA=0|iPk03t|(*21yE48f&enxA;z}n~-*$?L<~JEn!p}n2WL2=lnLMo#tC)Q3zpK zmoi+5-!iG3N`K()0S^Y^gmoA#RH1*N1(IUwgoJx$R1l~^v5A37L%SK%@db>{p&)8S z?uJLE7rdJ2+7ve+$du(2rT*!|0r0sIrjehh9IvfZmO)^(7t|J2;8=^ofY?^;+S#Ob zI~>P1+m9gwNE@6Ev*sQ?A(-v!7a}L!g1qE?MSU}RifPlP71F1|g+W8PkjpfK zX0ti|g--`{pWpE{v1IcD( zepFaCoRVc{J{H7;xIpA$bOsIdlz5rthj9L0%^id{(7F?O$ZLvdQU1e0H-|@R2d7CW z<%O*ez<1jAEV<6jPjj_G9id}qD3t}x%mL}KP0>Z?(6Q?XbXPCJGT<+;a{_OIk|RQj zB7}P+8m6P&xDscu%m!J%$HyZfxpPXG)EW8Tl~b$bRorqY{S6qDd~%~F;y4Mu!`K!? zjZNYoDNIdm9gx$|G#SMgHT?ASLM(%678aRh9jH;&Ov+$^7!_gBi7WbhkTgMVfCB{V zSGUT-dk;1IPW1FrY%VFQl&9q#D}K0)6SZ@YB~H!~o>UnfOTRrsRL7M|pKMJ%QLnmqvBIMjF+uU;K{d?NRePLavCzJvkF~^mM_2P zln%pdUG79IGmB4VS->WJ)XIv5n=*=3^KF3wc@s$O^2Bn*zA(@z5qFiE5U)KcLA;eM z3n(q~kC#HjTZtBMoTIHVQ}u$o!saV~ zYutGT?|}OFr$Z0Sd2#VTDyKXYuD!$JOC2{p$$Da^D&HeFd1906%%FBh?ErbH3axnc z*G8{62JeKafMEUv@7zjq$?^S$)7O^819XD%?#?J>cr=)LV|YXu>vLKer1wG51KGXd zxZtO^LqSi=E8M(WpWA(rEZtqz(A3hr^a~ZVX)ea-&wgD3E{bHoMoe$DkmQUw6CEf9xJB)W8uH3E*Bf2&#(i-h zRTf^0@7EJC@CQdczHcPpNolOX>@02nA*}pYCm%>e91)Qp2njcU1)Tq8E#Z*P-VZfT z7(5@;hTNja6wmF8?{xL7TBAX4q;+!L>YUo|evQ=ux_Ps{*|2XC^COgRBJ`BK&MwbA zk&aVFob3Gmp41B=CT8Ua3Cd@^C!K6J(ClCCxJ8^xPbPa*s7oH$3k@vUFumuvJR}cF zvYIoczl#B!q@uE*uivnDZa3>2o>R=sT^ggRS5mNk(IQXE_Ac!z?hcQ7Cz9h=k5klx z!V)9{fQax5{Zfxaob!LO3mw#C*aO59rgj_*=t%97ydzjl*8zG!G?)znp)7}){c2<)yXGPi~*a+NMYJ53w!pORp?eMPfMdoN`%M~vmE{}pz2Kh_|o?(^n zR4x9-r9VYmbO~&41jvCZPh@%<&k3gOo2u*jWn(7O6wuXpGj6?jsx7SiYr1y9uAhPu z<7xAW%U-$UWIM!<`);wu9nxu_+8`p27wgQvs#y>p*A>CBP`uFPDs}2g*+2a$~o}wt*BH9^Tz9EU? zecTpjno>P*SjgB1VmFo^ij&;JYCiQ3-#>$5u`SG@fxl(Cl>hh2yP%z&vy=1R^1F&AHSX`mx?G!aAp>ayZORb`pL*Pg~OfcKYHN z0o%w9F-wTM=nOPPu}qDp3}r{SQQzvw2ZP$8NvI$9d+^}ej`H!S5D^hUjhPKp1~Q{v zti|8@;)vZI!{M^L-LFQ&7<@_aMYpK*E(wGa<|) ztw6PA%v#f%D{Rk+A%>=tD{3oKM_xtp&2P;)ekHV7m>6P6$y`#uEGfReq@#42WxCFk zOea=gKxj2vo5n!hoxCaX+qpCKRNhoF=&&%>2isVPnr@|-n_7!5uD1n=H8UdTH^Rbm}B77uUtX=ixE-Y))+E!SI4*d2S(08@AA<->42x|=9K!7l( zh`J7UH?Pq%e2JCdxT0pNTWgt7be&pGFcC93fPIx5x2kmIVxS-Ak;5xm%dO53l?9|5 zZZR!7wA>NDrk^BO#HpE3VsUcNa;hlQRHfrstD3)@!VjUR`z=ryl1=}p8ad5g8u$!} zc8rT0Y_HSL)kd?oz)_C$JJ|}^nuy3iEFe?|LJs+CjFSEhK9IsduD`Sn`H0`GAge}U zsajK+jxlzI(<@d)0QXODZfUN$iiupm5;nLwFVgPrMzN$gyYd|dFC76@NdRqEjg14c z9{C%h9)){oZA2QDZyT~NJLg^cm=!W~UdpH0*N%7eVmfJe%d?{Cei z-=1QUJin38vz59Kl9ydvMhz)>I-$zDhH+9}Y)}kzD8TZJUX*iAcQJfL+C+0!hF^El zYHWB}fTNZqY4&Avn6g;R2x~2|(`FYH7FVKu9wD~(H;)ar{^%l0zWA?CvXzy z2+utqdG3G@CS>XoBAlC~ud#AKOm=HAl=#5 zb36Ix!>t}!TOzbJ4Fa#|DniE(do@2;2uK11LXN@2yNqTWB7v++;y@_)4SK@;0pYR{ zHj;Bqi1iLhb=Wt+cAr-hB1hL^GBsz!9!T%uQ2U>M%MhAsZQcv~?N?|<1ppxb&l$r1 zZbK4rH!*Vg-_3j}Y8Lv~CK$e?>&|SO7Lsfdbc*VdQVTMy`z1}qbJ%lB+QvyE$j#EO zrQ^xdGmKoDKqAP^l;q(kD0hHyo?6MI{J_Y~19KCRHN;NzP@?qS}$6kNB7>-q3IG`p{3cRTPq zWV^4EcLDIc8CT+KsR$f8RP4kBRe(4j~#(2B!HZ)#Gc-Wsn=&X8yV;r z*f$h>6ed_3j1A3S{$DTjGmjoM{X6T*frI zSIbqs>nV$88-XS<6fmHUk9O@ytw}(Gnn+AJSG0Mhgpy7Trd*#R+2<=uW*l zurfOf)`L^=<-Tba^S`$}7j9UoV@sO#`dd;JsVFPC6LNEXJQ?K-lo8Gtm7J{|@)G93 z9u|>0SO~8WnVHIqTdh(Ftn8HZAFCAVvR6C+!zS!C>&C~>Ura&Ll$)Bd&kx<}bOHno zVtNj9eI$4;^O5RGp+)Vc$2mHftBe|I^7Xz(c_^Gw4!^9ttiBbI4p}ZVo5G-b0m{8t4l|iL2FX|Wvp7NwLnU-iD~n8 zO9D5P71VV$mK240gl%{!m_b_O6AX&aH=G5KJUp4E6x_Uw;CD@z$Xqt#!20)OB~U5N zZ9GURu$FMfBDPg%)Nr(3Q;44>@x)81a$Pb@Wd1Z+_mbjTr2Zy`1!cBM3|~^46Ci?C zD+(+@qEMcrR}lDiuxu)zm;z6;uH=x(Lqp`HLyUgapc%z%tx4>zST%crGbc3h0qIFf zNnUWXcz^O%s$M_z#me|oV)BaBj(r}98j2)a&?&MhugZK)sMmk-qo=!cIV%N1WAb#v zctf)pWuqd3xSM|=89{Bfn?g{0;Pu8ERe5%2&ufIW=$Vg+(&WJ^5;aiRX)fL5VN=7A z$=E)X?y9^y>TPFMfMxju$b2*SI9hc&u{Or$Q-8Ut!2KqRfqTNNIhf zg1%OLK=wwFQtU0VQhw}=!Z(OSsT-Ti&{1$`#sS0~RQK2-#BFfR`1%s??x%@aPUg_2KQDN$v1vA zyEeU(Kxt8Aaevb1P3R7zB%&&wmO^G}wj*9zG#BVW#WU5Rc#rm(vfWb%4bh65%+B** zXSZ6NeK@c9W2>fV5Q= z%-Kn+seNnhfoFE%q%2h;B^SBc#x^ci`kaHOV^zGg5Xp0Cp>&!@Ih|=*+RK@|n(1oZ zdxlBI6N@h6r5R&9NrR{2l+3(;WCqjU%gxWM1Upik>USlmnAetMal6UbToe?cn71`lcJ(^d_$8s!8;jceI-bvD8NzL$V%o z(GqGWyL}2(DTaunWLlJV@f!}_62_LzTPVA-gUPmf{#<(|G6_)7q7l{zc%mW>Iv$Yw zqz;nqRDphi&Fr{`5;Np2qa96{l-wN1nHQ<+%!R68UmM+7;%CH0N!?eeiNsZpeDSzr zs`lc8Ka=C}kYK>%8LTAMRB=C!2Ixt|EjgoANrz;A__;`>Q*PQN>2Nku8gl?@%HL|J zobb%||XU58L4pD`&IiBx72mImR@mQdvbN2IF=UFtsTzqs}6g+8<)Us#m%*CD~2W&gQc(x{@F$9>D?g-yG+Ar&1 znnNhWY3^aX9WWzYu5WX`pv8Lcri?+Vgv z7ZPbBJ<6-Mwc@V2L?2Ttkf|!|gtEsr=+yZ8kE9tKyfab48}vq;;W##DdiK3WHcylj z>|%w}q|&iu1-2<^EGMOkT5#z?ExDHb6S0#fI~=)>6MLM8qc64NFP5pjfiV$m!-VIZ z3q!N!eB=SASrS~CK2t8UDWof5gA9p6m&S@g9r?3jKhk28_*oM-<6O?VRd!8 z4y9hw+*T;1=6Wd9M^NYXsFx7XGALB7VO(EN)WeyL=xf|mHgIaIOham1E*N|7nkB&^ zA3W565IudqeS^Ot=|pDEQAC&r9#CKB+5*(Y-&Cjb&9VXXc6KGbYWM6e34+0nu*_yu z=gT;m6YCNjY^Z?^Ncw^Et4)kA$vFqYSsylq`-c0p2q%d_REG-{FF)$iA z```jZ@cq!b!&*B_B7u)+qOhhoqQSmVQmf0O4^8ICt8sh{qY$G@`4{JlsP|n1-4~Wc z;MpFoxw4O7U(rIk4SFCAIx*cwtJULd2YPNz#P6t%u|-mnb1y5AH>x?3S|Aeq_#1sq zgV=?3Y2}YwMEbDkDq+L1FCT0}n$YgtIMtW`t{-14o8!#)dtUr!Odda&I9mn|0Pu_m z06_Vl-B7XrYk=p!ozee_%m2G%t>)p5w2JUU!>a3{(Km)ZRSn;l2%}1ITtYg+8kP{Z zu{M-GqEj@Cn&6tU99gKgKy~huXOXodbBnkzVYwCjB)M7in)BBYZ9RV$>;2xjAsk;w ze7k&=xJ_rfWqUL|neOtr>wVn<)2I3_)aSAWK{yh2Qe{3x&K?C}@T>?d-9I;ciuPQ{ zE#EWUB0SV!%&q1Rp*iF*yl;m@-S>b*-BZPAr2vN<%DVT)pp%~?UehhpZ^vid7cqP? zobM8r)}uT$VbsO#qe8A4rb6k0tVJzc4L@lv@X!IMh1-LHv>nA7{*+66x2v zX9ckv|ER42NIf2@h%ycYapf{N{#ZjRTR3)xo^1k!yvCfpLq8*}?sHt(YLa zt0-5ch*Bm422M+L5ktG$K&E6*M1Ouje{Q~!5t5kK2r=~)V@y>w#!Ff1#Q9L|!Rw1GUB3SNjviHfKqW*)<7F-I3Arf@o8d=Y7a=FdC-q^K6HpT9}EYi$%uZ z>bR^Cjhp52@fSy#gL300#O_JyQWhct?^PEQEQZt}sV9Mal=>AlLl>0?@cqGY386+O z)ai9DFrQZyCuJp0@U1cu#FPo8**ojf$Z&NniOQ!xh_fWe{4o2JtPx`BhlnuSv9ZuN z7(M!H8}9|HV@To*L&I(8y113#bgRll%u@zTGIf2tn$z7J6LlGl2OU_hlNAR&I{f8l z!wM)wZ3@E}#46fxMbTa=TVa!wq<6>|ua$4Wyyb?7N|d}Ia+7b-kzjWk5L7;dcj0Y& z<;lS+yiwaH97HCT5D)};%L3E67gMIs%(r#Lghb94D1u)191t|TT(EbPCN{D|9-%fe zz^Re5hXN3r-*M^L)v0z*0Z!PQ>Zg+K&w+99%JxNb7%>n~~4K$2Br3ZiB0@gl+b{5-4iwp@>Aj!WA6ZiPl;h>h%pP6I zIs^pnM^;fi$i`$ek}#tzj^WQ5JTiBrk{*4G(n2Ul@UrV>WN-0bSC3hmXfz~!iV7yH zopf-hqL4}Eqml~O*>C3t^d4@SvY~=$ZWF#nq?m06z1CmcijK8i^f9mL zbmL`q_vv8Y-L5W$vf z(?P5~DA#cPDPP?WsnEi%86b2;f_>tS`(p1~WZeVzjQxl*$|@?E+&$#$d&ykXiJi*Z z;sWb{^RZq*3j|6()`KfI0N*}z5(bY?MlavjrLOgh#mCz64^(<@sjG;M)h`#1F)c`N z>z?2bz+|3BwJE!t{=j;SGNVOx_8<`>5b9jfLFUvcd~r=9Tq!9_>jHLtBFh{FD82$B zb73k~BPK!fQ))?+Rt`(owhDdp(Y4iwU?TM5i)ZdHhu9MbH!{4c!X_1>Yx+>6qeyrU zY%-57GOkYIEdY@&<8GppF`dC46HpmtI}K~l$#u5ZW}6u!kRPhJRvX)CBNg1r+tJJ@ zk>xZ5#5Dn^YhfVQdnsQw)dd{E<#?#`a?Ia3EZGHTpuSI|3HX6Gd)XzF-eO)gm}CWa z!oe>&{h9{tdmR?RkZqx+FX7cDMTt0Q9DrP9L%zWdIvH9-u_F8e-VI^ z-;$?}M1_^mh5<(AzZ^=y=g;qH+?*#4HNV+_*+AKj=NV({Nw)GC+m1!peNEl%-S|oQ z<~GB{afd7?gIabSpJb_v#0rdT7Tvc@7Ft2^@vMLP zMs{R2HTUgcZYlNc6jsCWyBtC0_xpfwJ6xG_NI=u(4=S8TDyVYid-H5E21l6%y9qDhF<^xs(&W{+5fY@^N+T7Vre@g18ZT6zeNcPLzn*<1WZxXlEM-|{+==2 zUUsf@uxhqkcJ~P1+^9at5`hY2oT*`3bo1z@e`3`Lkq**Dk`wwtcsGa465*<({FWmmHqaQ~9@Myj7U6iS)M z@xA1?2vpOqnAs2;kmOmdZYvgHO1XEV*{~@;q$_CKx^zBrNtB#szfGD@u9sS?gu%l@ z#+h1~1;6p#Ne+(am^gBH?Qc2pbPvQUUf@fzKG>Z#r_}Ah zUD+*-qqI4ifBL-ylBTCVApaT}BlypJ@XvAA5Y@K2z^OF9KiG9fdfZfMLZ?lsbp@jmu3ygq^l0=W+?TcU>iche|LDWk} z9tXmEON=1XO12U2H$=nhrq)B$j5J2o7-RJPCWa2u^69YL+%h$nrQLwd!)lzOZpDt-Y|>Ka&T%qr-#4dN zW}pe3TYEdpxDPOXklbC5NN|Ft?yoDKWwsV$$(B%=y~o^#7qYn>+S}`UOEEq;07%dr zfc{3x%;(^NW~pD10JY1@IDyUzV+o2oIw@&)(al+jP-L?%QT9=6W_F;3@1Cg=)xE)H zt(N9CD!0fPJ*8ohni=^s?IFar?94V8n`|*Gg+F6?cDuk~CZ?cAi)l;FXb_nWr zfOHsfvz%l)0>+Z#1_egKlGD;AqbihAfUJ|b8Ec9xFO<>&{m>^EX$G>GdWR|GK5ac< z-)2(Ad5mv%e(4`3vB;N`m9d{}F!0i96r zKA)X5%^@**aDg4*L4k3!(*jAPOdV7jY)8C5AKu$smPbFad|Z^#sHi<8ETSvr7zVFu z4`2fcn;&DC?viaSrds4RaFPlv6#(;4X%?h-{q&jgZp7#mE7>>W{yyfusiq8CNXYy(fVyxUw;DN4%A>66kR_pPcRp3LlO zo7@=${Y)}sSgW$8F-_-U8OjwxO~-ge#r#zfZe$@^()lcbxD8q#18Q?C;Koll+@t9x zGsf!n@gAMINU>1TAW#|a#E|?jApi3SGVN;p8rvqWL)N86qo`pLW>kG?HqGZoQ?2oW zsc0aI;T7rEDF83no)*cFYW@{FK=xEG&-k_ zs(nnnqDHXju647#7o~GyBa<9=kB(9w>4@>a7<;Gi%GPdMxT<0sGfpbDZEME1Z95g) zwow(^NyWBp+o~idYp=ck^I`wz`7XvYZ^q4-Z)ba3Z#}KPc1Kuap3~pJrZgE&A)|>o z1e!2zTDYf!M4KS%+f9+v?15W&cGdb_=b0bG>NV`cbZ1aD1%iQ-4Gq_2NXmm#!qkdP zqRmTj2~_vnsNUVB`%$>_6xKH$BG7XYrf+Uo_M8-DJ#NX_YJ{$(kj&yU{)=*|w~!lX zfq1=a{mI+DpyoUWygilzJRB-LR^)n&I0H!W=&6~7L0*QMcz%~#-r}3x+V&hdTra|+Es zc7X;S3Fo7{yUhHtoMKrzWT&@mF+N(uFXowq?S#}@I5v8iY{#yX){)3Jh@B)WkHT$Y z^*NyrRByH6ZH-1fhk-uGJ{TiLRKU&A6Ha?_zvz!aa(P+0tIfcEU=cZ*ML3_T&uLO0({_E&kO5hW<{AbLT{e1q? z0r^{Dgyz3xLumd>_`~jVc8%8V|C7d0oEVp-7?)5MmjI5AjZzPfP3|hdQvj8(D97dL zS(WIS8yFcI7@6hlT;Sm4=^5#ncPPn6CMAKi6pcVSN$FvUdEmtG9wp^C)$kaw;h(fo zaQ;Ob1>v8wiJ_JGKM9%q^?K;Vjo#s>$Vcqw{2jx;zb;_#7X`x5NyygP`g2TK+T6zY zQ;NXlQ{>}+$Ph`&*0Ly{iXO>2y6mG7YI*sBU*jHD6!=978=wfWBq)*1#s9cnhr&sh?@5bJKjmsqNPSmQmWT zdgccE!WGg@PtoCLqej3@QnEEFtY!t-65%hU27$Ht=4i(vXL7|4o9=w*T@_y-@YwdHjMI7jOrB#B1 zu-q>eBViUz&Kdglv2yrvAlpJ40;NT~t9gbQ$%M@#Rh?!pVTO(6E~uKY1tG=yKV=4s zcW#9ahvoKRGmZru{N+1h4D8N3^Z(exQuP{Pa5sXqT|mI^A=@7jIE75A{$7mzqK4hd zuy^6mYJ8mYSl(Emf#u8^2j2%@qJ8*Sbkg|Yxoq2Nfa#@3f#1m4Slq?>tVO5AGFXN~ z7R^3@sjwKOi9=V7D~43WenEsLh6SkXFdEv}x}cYaR~f8k7IybZ<*mY9Jz{nqJ%;0e zW7nRDDJBH>T4qytU+vq>t#0;))%<9g5R$&kAS`w*g-Sv{>PQqo5xKNXCB{Xm*sWhB z9Bx)_`SL0%35ilK8fXulP(Ppzu~y7ucNkA15I;Q(RK$^W6=f85IDio4)gri48FnV5 zXtBcBrX@P$`C-4E%pd7LNS+B&v?hlTYRM$7@Pa9_)=T{cW_M*CU#XgZ=$zAz7fT!G z70NO5sizWJ#BBgU?4DU}lti1a-8TUdo`r_9cIFThAia!n^x9QxjNp!FE5AkK?xrgt zNt~eb{UM3lRydoD$Q5e+ybnj2LpDns3OyWq)iCakv%5h|jkF%~`8qogl&Q&aSVuNq zM^@`&aF1`uMI`>I;(J7!>d~Qv`d;AJ$JhT`vi;>XjJn1##h>1C^!fbDjrm_r_7C17 zr|;ls?C?JtKtYiLe`x@Te3&(8z_{$UhFS_u%AtaabffgSl+u`gleo8|<^BU~i9gg;qi#IODH@mXI8IPPJ8ZXTJO6v(hq%NE2Z)#H z5!mLpNH1_q&zzU2KXCUnXmgPl%3T>9sHPNZLK&p$|cZA12x7lf<;1{5N%A5Li|)hl`NEfY&260)Km(u#t~h3YN*XNI`@X-wz~x2)(V$S3h~=f@ znd#;;C>7LVO-U$d25L|TX~6q8ZlyK*YR2dvdQx;92IsTV2YIptJShV&l&CLSTSu$4 z8gL7Y*xU7wi?m0nmCsBPB1Gp=J+|0ZL6&pLGm7auJYmaP^uIh?2dnkl$nh4;*ppaAFAKvL9pXUx)W4+;mmA}Ab?8;7oHP^%uIJ*^+oBjgObV}n!hWo{nvKhV03WB)-%W~JvYwXKFl!LxsF-Gr+i~-(Y(v+$FRzrbd zTsvqY@F3Jn&Un+9FVGKwD@&cJ4(7t5-L4IGmL3!+PuhM6)qiKEF;V061_79WHwEZl zfc8RRWznzq;wrrPU8=Xj)}?aY_muijX#lm|V3!3ZhGrnBp;{z&9k7TgLWiKHhcV4% z#UrMel=UD&QN#I=*2!1|4+w6_-A^#}ZSxpGOpmP?=?6LDx1^9qk2qs~BDUfQCJEL= zEj7W*`e~gYXyX+1%G-U#@P@aR7;+cArT{5~;X|}GEM(sdzIns6nH)3*>4m4o-6<@L zM4h}(`>5^&=o(gr`&BfUJp8KyWD5#4)J-vlJCU%eI3K3pUXE?5$pakn5iL+drJvy zEHxAm3(K>ecPQ73B23O$HrYaRRb_-#rV-<{#5ohc3|gw8VAOK9?AbuiE_#rUh44(C zjNRadrCwZy<{tg2x)va`9rpVk6B#@Ddq+5pmoBnR(TRt1-9?zTW;)9%Ba|mWruO_< z%azx$ahob7(@}$+7_h`~-rJs7T9e(mE{NJy)P(gY5?h6e@&WgUi-(`^)uR?20gmUr zWu4v6>4S;RaaHj?5?HnBR^p&I);8!YfVnlCC`%>eSi(oR~ygcA~7eDm-!Z~ zKvJ*%so1k9L9|pFS#rSE0rJ+&RTOirjQN`AvIEm6)wQS=R@-FndQ$N;Q zEI7+B{Ec76klX@G5(@!}rZHVKFwqs4O)&nnSt46>PZG12CO<_0y=i#&r!!G@SSVkS zbflF7>j%KY&!^oV(lpzL!+Xfc$Czq#s4p*;6DWV z&!FyX{i*CG;$~?4Us3+==$;feE(yYb8YKI|RM60$%e6Hw(G7?+Ix@5SIwsOCinqd!E2el-st8W3h( z1#b1FP~HiO3?kk7hkB+kM*qab9twi4OAWg_;m|{%NXeJl8laXiGyB=4g;<~B_F4=} zD#@GnykN(WtDY}$UxWr))H$Z~yRzka^<{MF=hsB}KtsWx+}jvcB<8MzO=F^c22HK} zp!RpLItKz1|LDpI56;Qsb#vEZ0=fquk->OnS7&3CvX{A3WpnRw1)Rj1Ntky4ibnrc$mGR+w9k;!BGu34P zU3y8q@Ak)BC!TE%+b%mFb4D+}EJb$>*GE?5^~X+!86roILK60q?Y5`3tF;%pKXdP{ zB4^TTK>+|w+kvoPD6mj{;cbGtCaYdZHvu_SHd39gs^_Ceak(qpj3y2aAy5{!P-P-S`FMfKBk4&)- zw(p|a-E|Y`DMRig%T+U9tR53sWF0FE#Ge}G?}oDW1S&RpDx~ioMe~xR*)!o zP-in5@GLwvn~=W1D)JRBN87NW&RimuK9E4JdEhGK1Xo+`z=V*9b0dX)6D0cSpfx^E z@+Y>`8x8!KKewa366~q`1d1kUTXo?9cUH!%CepIdz&m(%W<6ctySatU0OBv z@-Ixg1+Cs{*uZIt!pU&UpM>MAZumICOB&y>FBvMJW*05u*j!UobD1fYRT{@^xY7WN zKvg|m#hSKsRcuOqnn^l^F&RDFRh_zZpSMD(d@#;*6&gcr1y=;K3IBs6;P|6Q4B?2A zq-mLwJ0X>vJ~N~hdFZH)Y7@)i&XB@PHWP$DH#Kw>kuC%S;dc2K(D(Zf#Mu3sCQkuP z``Un%^LD43&!4RJvz;;Buh_Wr zbt}#D=1M5Z7p2Afzbaj{R9O_q``x&d`+_j>F?osyCF&fXkjfqn!T7qdzj?L+mGNcU zN^Xo!0uM^fS2^{G?*d()a6t^B~Rrt)< z;lYyex$jPL&E}H0O&fd#v|cL^^2_|2=xGSc^uSY4$9CYLQqab>t-(~6@UC=; z#~oegpw<^u$3AeilI(!pbj#pfJ#7(Vm!`4)x^?@$0q$U3{gIkjMgKp_aYO*UAKjg}M2Drt93G0MIdTuT} zpc0Qfk#7TiPi>2i4OU$30-qte)Xb)>M(u&ir<+MqzL*>Cn9bgAiW-W-y$mME$&*K5 z`y@DV_^fo>!mi7YKQW82pNKj*9BZ}rxE!l!Mm;svq~R@5RKc$6Lvy$tgD{)UW11 zYe%y}JF9SJQzT;>^?G3q?^GnH5r4DQH*YIEB>z3V6p=x&4cgQ{F6AVOT74eZr2R+C z?wk>?!z?HU=q3He(qSB#NVdDq_F%pks@Dkia3AQG9>r1d&oYWm@ChGO*Yu5Bb(q)r zyKleOv{MH<*rDZNMrvQb4KD8yglVH#n_HJ5%&U%9gGXdNrjl*{h)IcI0ee(jfJX2j z7{UhAh-HHo4QQ7~e7p(H19hSs#lIsaKJLfioKFl(SOR;WHAU7Yd_Ofu_71$}c*$pt z1m3+-K5bS=c<~W`ApCQB|A_TMoc*k~RzI6-w*S1t_}AXzFA#244%O#kVOpLO(^l~c zOn8iSW8{kfIT3q5HLV__(9R%Zy828*;dv-uFMbb3*N?cqt7Tn-xlKLpChG&egq@Iw zY|jbDY{yG?^RBn|8#Ml}tH=teNmHY`JgF!QbOOIWuM4Qd+^7xI1>-Lh+=vX4dKZOD zi55h-jgK_gsC!rSLJw~|VFjmorvNV_!9|zMC$FuyDywV~OmdB7=`AH3;F}?m-JZ71 zu*d7)C#x&+wfSan#_MpwTa46O6`5HU=b>uU8ne7|CcnDt;BRXPWF!X+X!7y=ns%8He^2dgbC z^uCL;E*h+@^UalIuT*ZAgnFlTNu#Ya7ZLc6e9fU{v;<31wZ0+c555SOuVb$2X3}_H zl*i82r}Q1I#>*;#%TK0s>HT@K3T_)At@*?uL-Re#2QXPpVGyCeA54Q})Y8zxm<5-~ zN43)uNu(pEszZa?YhpB%e{e!FI#08B6=~SP^PmPQH~^``7%65PwJQpM{@}q#p+#4U z)-P2&F6}Q^^_Ntg?I3`Jv+$+eoB>D6YT9FQg;K)|*4)h?&7#PSnAMY8aom@An1Cxe z;EL)mnub2C)J~w&&+fGCVCMF|b4Eqnr4eiUxY-*7LZC?YC>xUlKS3881UgB0ePh=s-5 zFB{+?Lzv^#zT@`A3S3Ixe<+O(7>_Cy5F;<%E@??U1~|>Elm23cOd3ir_P~C_>jORe z&KaOtFC&Mis1y!s{D4#;P9{+>6=Rj?BL}TQ{{r#PezN@|+kNxXPi#I*VZQ&wPn2ye z{~v{Lhq9C`iahH3Mg45@@s}e0ehi}gdZE0;kZ^)<;Q}ZDlti#LDK3Cm36l}0^1J^> ze-JS@GKLNCQ>h4>&F0P(b23XtGAO>0b}iHKvgPpgqGgjK%jfCsv(@Fcp$gU45`ZA( zG)qD;QAllPPgS6gN+YinwT}{@^<0}RNHq-Q+p$r1T@?Ny;H|gX+Gcg_piajmUCv$^ z$E2lGf2Y;W=r}6#v+sN--27B|O&r%No3KwifUxBzvTKVYVpY^;+!45%Ti~{hI7;u8 zxO_;laE(G-tG80zG?ZHs!^BEvR`oQ-Dde_HpA@p~W)X z8xhu17Km)V7528~qO*d~#64T{5nmUCEc0#lwheZ@ZE{qqQl8?tQS79c2^-bLYQ(NX z*?UzJ*+I6L>HI;${!D0v3vSLjgJHnZOIT)EGnrQO3>*Yg=Pd-Bb#mernA}JfGz`N; zGRE91PNnCuoUUjO^TMN8&*w~SD%dVBLiZAwraB!J7>-A*On#)m5ZO(RuC&%?fZBw4 z@b1ouS)6Ww{lf#Rul77tns4nukRh^I(|SOzj!^GtuYYIVdUF4C?blRi*K{*$E~g7g z@R87x0RAXqd_G~lWH|bBcB?S&H;MWf(#9MYl9iz0N6WJ>@vMy@vB~Q~YS^0r?LrX9 z3Py^t<^z0!CONs)lSd}HQ-hs5s9EO9-(a_3x2pPr#&pA|NPJ1cq2%wVC%{xqha;#d z{<)~I{)i;*asU1g%K%hjZ=~6Q z+Fb}eF0o%8m%FCFI2wK#G$SA3^qS>5!kX)v){H!5#nB(s8Ba_2q!QVW3BpDAj;VjL zbLis41S7|(D?^h0Vb=980JkfXap>i9)-~l*2A}l*={tY7jej@uQ7W3MD5{w2APgw+ zUk!wROQ9*z6B}4nq(ILT`R8ku=gHNpgzPa#;xZl^?G&Zp??l*E(0P|?gJC#VRPsJg zHN23$2(4T&0eXlN>bZ#zAF|%g-@IST_hPzy-{5|?J<)~>r7AMui(nsc+9AT=Hb=$m zpUJ?gQx9B0CGRcPhRYhNb!($N?p>QwUWiRAcigvR^2FAKI24ao%|kjM?d=zbZo#xD z%heS3$mME~3|5C5gRR%a+zomZ?_ipcQe`rL;i?zN&1HqtpyE{V;a1TCJJg1Za97FE z2WW4Di&uk2TFE&hCMDbJ7cp4OPxcvwJg^=I6mLwZ=|(tK?S{$4LATL_N0a6=8#*g7 zZX<^x;%OXOBXt+fiG)&hxM`qPV?mu1{Tx&U+}6mkCXB(nCGZa-zgv0FqZ)pff)-3r z(GhMCJmKrV>VmU0pCf_ZU8)Gnn zX-;MkB``&e86|a&)o=AMqZSTG3D|l&EX;nNk`{|_DRjl9Iz^;`G}T{)^Gx{ul@FHX zqCp&6b9NLZ8woXYt3o?b;8xqAtt8D}2+POnXr~XgeVM6zBZ3a0@L~UuG z@yo$#nh~@F19;HtDiv5JI-}XP(%cIbe|nT+bDnD$OWEkDWC%+!$37Ox;;SIxrVg4R zNS-aT_1GTnQBkvYn3ta-vH@WNa3GjUHI;dg zQX&$)s?C+%;6MAY_kV5eL*pr4z@L=MA6y_l5xi*3iS^oNPF;b@vcQfmGkMXZY$6_Q zL~r;_f9+g-#gZYSko|*@-nQva=f3sfp)TgBe;+r*VY8mnDA5KXmE3(3jIL@UTch0V znonThMwbp&S=V`4MCRY-gq%fBm(6HddIW!eQK7K2Khe4<9POdw!VQQ_%7!{EijRH3 zu|Bz47=X>lSF>AK!x|%J&&>Q&brfo-+(bWwA1U<58Tvcn+cz+=W{X~VAG5TT7fimh zN-q4H0exE|d=3{z7f_1IS*;F1E3{ zqPr(<*!xP`(EiQUugMBUSO zjsbmk>3u5{CWwH_RbsgJKb;WGb-nCTzb+js?aMDR%b<8Bm%+5|jEtJ&89a$Aa@Kw* z+BEDP#Aeh(*A7a_fj$55Oc4j#3((q$4LB7(5K3PE#LX=owFz8N;H`#7knVOw_zL|)+AocR&xoKfBf{D)FXK|?CnMxoMcTRe=*|R zGx~jC$%oAd1;V9NXXk^c`WF&6=BQJ=C6cOhdkfgxb1wvzJLJ3veC+h5 zGfSQJh4#;i@hBHxV{6SaoM~1|i-_RjYd?<_q0JJCYwf|YBOV0{+6uq!7iwAh?cIWf zr!}jSBjJLAsN(3(ebMoEn18N3UKXZ!i$77(;(ur9{qI+O|3BDUl7jYMEIpn&^*R?I zus(gqHIhP&{M z2iY12i)G(6sXX}rm{;Bin*$seisZ4f8JJCcvM|QzAB$xxTG`ZJDoXLGX0Yyp7-2Ey z559j)1ca8+n*nH))p9iKc~K9-$*O)C9SE(2Qsxlp2ZrE+)1Rr3S>i98lV<8i<=yaE zS8s+w)?lgs9Y7BWX3rkO@@ z(eI+h;X-LSnWiBij$o+!fSHhm#u+OnK7B>-%4KIG`aLN2yQo2*uwTSW(jID*0^Pb( zFOACZ8b#2Qdg7f%2M0-X$Gkqgq27vT-&W33j#kJN#<4PnTi@@Bi4eMu?w`*-AThY% z?z1yPNBmzi=YQd=M*o0||2GV-YUzryh_+s^IJDb6&;z*#T7Vc}OlXH!Pts^;06F)= zT0z<#7C6(5wU<{b3W$P~$uQj zPhyFax!-V*?Rn91nB8&7aX6Cm{;~N1X2Q|2k!qqNEo zbTVzx%9L_U_7m*3uqxVR?Cj==A!zkL&7k;g64SMBTMcH(Ac4v5tH5(qaG2;g zy7T}?5z8yW-k+(@AP+tM@*}cpB)6&D_HK#UTqDuy3{sUPznJlPty`H}>eNx}a-EEH z>~IaoD3macqN5kstTL)8dlWaJ=P4@nL{9CC_{0oZ;K(5 z&5D1)m`Wc8swu{%Rv$+0Nc7h9t*JJ;quxU5PdOC($Ih4Jwh?l=r&@Ap&5p+N#t?v| zHPlMsGRO7~`KJIf_xWUc{l=k6B74;C#9Xa2cTNG@VDG^nd-OS=kD$K!g3DT4At( zs#>OzB$TX}m*gP1W`)@P8x~i+&RVbC`c||kSr(hA0v#k$v}9b(yv8JXgxTouYnvML zA#qDjeVrKw>DaAFjZWXNo*~%s?;vHl3us;@%)_5(<#V~^9a^o>#h!K|C=zoDMKw`p zX7ZKa^s?e6rDDjU4Cb|hEDucX+M6~+U$M4hz?U{S7rVfI9S;bl5{+y7ZJOA% z2l3hkO_Hahv6I|gym8gftkm^f7izErpjoNuA~~XK$i-)#`8Nu7lySQTEGcysufcr^ zcAK8E{O>AaXRkfAl&(qfeoN?w-th)c+%XOs`-4RNBYcL1GOaQ8YMPSa6= zjt961aoWzd#q;iEr1btv>Z|JXN4uRrpt;`WWs=Ndy#xQwD1F0bi3ue?A{V<$9jKjI z=YM+J#%{X2aQK)XwTtH!aKrYsCWn3@ia?M-lEDRxvY)-bk!s3C zN36|%c+L3;ns$dg$QhbfbZ`#NX~yJD&S+8DNn1>?TaFp+{(MF-J{UXLU>N~PqF*8I z^a$S2$AiKrN^dbw{7r8A1uG&fl(?K$NTzd65+u(CX-1fz%g(Qs6a)8XRHLU>IJ3A zA1l!x))N-iFuh{001L3c$n0Stnm#%tti`p_Q&z*Rs^bKP!OffA)3fZTwAOM}8JtGu zCLYZaYE{mbN(8(DCQ4zckF84~ru(Jv^0~ms7 zg_`Z%%#2U=rkrY#gsB**A{efUYIz&w=0NsMt8<>~^Y8G>3mki>z|Hjne)pzYk5J}u zC=dFkBkN+|`v&Rs^oXKD26Qm>ZE=!0e)Jw-A7ucoVurL2UJ>jvx-8>!ZF@*I%%KL!Eyhy`I9{ea3-%e_IRTH`p^$x)cAAEY_g~jg= zc&9n(`D|)K=x^V{VKNQj53p(Fsvt^tBVpy1_Pk?AKE8QoxTPUK$0c--_I`Jv8C)e4 zz+j&k^^tF*@hHuirSc3SBALbztkFe_e4wuc`zXc7!m*o#lDH~;K6C>DzI?sxe}s(fP1Mft*lrIce*h-)uEJnY@Wx3-fSp_Q&Zl!!cytLjVxF*r^jRP9kPV$>Gp+>vSSa( za)r>S*<@FuH@)D)0?6Iz7f)oQStmwLobv=^j|oA8Db}Gl;=&Z8mwYXVK=FbaWzdS* zzSB6d2dD8Cn$<@c<2;oC1>urn$cJ*aWQaUuv(2%AEIpwNO$!@T(lbp z-hH6!kSD81EpF4~`S%Nnh8X|rt*AS|MSU~fN;DmgF8Ga-6NoIQ$|!D@T?|C!pk6($ zm>W&TYiDlYA?{+G^yn^#W~#SldLXX7Y3{GigKWC?9^?_ufDHs!r>HE0!_*vy*@I|f znYjCB@t;7B3kd@4lH!*%kg@2;pLKpX@Bp>fZ?9z=HAfKl&!Gm38y8t*(GznLz>wh| zu{P$n4Xx=S+qyqs%e2ioxG||nuzcH2*kc=?#X1MP9)bCi&g(Uc7<7eLHa3-Om6D9H zJtQEWrGO;}inJDSV?A7KPCN$gw@ro|!yMMW>YCE;!RPxH4CP`m2UFIX(Wg+#Ir@&> zAPOMbS$Tk)(IW}uEMB&ed<1%U;IS}QfD5TQ7BBKX!qi4W0U^**;gbWSMY@^#tvZ-` zj)@SeV2?0w*QhS(1Yj^;;VNzgOvKL_ORa_O{@nD``Muxgw;rF+!VNQ%f$|2agMJZp zWqiprF059sb06bm=|NQK!B>MjkeU4vQ{rEDd_oSjS3A!Xb}B?s8O>?Q;68=CY3>1SbC5N&Q zhTYmFbwmLtWwO5j4ZUCfrCdMHTL`xL65LqUHZN%qIa#UPWVyILU$K5+gMa!^Q`TtN z)VAK(R@>$HDRYE}f$|uW>3G4h`K)vJ>T}2iviY`keE5a>^G_DOmYV-lX7LVWxioWQ z3w*qy!u9#1aX8j>x)l7#@<%kJ^5tVnzjSzWhj0GI*Ze6f_=C3h@)`nn_F4>g{|O)N zqpScKKXE%SS6Wz7N%2>h>|oRmf+YVS&NMUBNh(=h?$Jq`G)r)PYQABPG~5U?i(+N^ zu|+WvIa6uT7_4LwX`R#DuD4{eB6C_r0n#M|$(YVT>48$iF7y1DGVB3G=dH40(eN>+ z$}k|Eda6)EEP{HjMuS&{G@?*6K?C=6I0b*IP$r?Dla(@@_2*)tz+j7oeHb&iF$E97 z=-kK+fq`TKld@wnEmfgJ)Wm|3F@QE%S-^b3r~#{yeA?2#R^_;vmi%5_Zwv7_;quVRYY2& z^|HUZCWOMYa63~{{(1(1V*~Vs-#QtSYpwzNTOS}!~!k4^keD;s#2qvbw>XB{DM(Vov@~cr=rSC zRs&0mF#T*A2U&W(VphQVT-j!%*pObpe1^CN*loJiC}*y7S6cnep3cbcv5X}dzm^ST zX{qLXHdtfR#xsV;w5WieX5}^OIBGPIpMzODCKmJ(-fa6-jmOdE?wjA|Vuac7oi zQt5H2^GhfZti>$r$WfY=NAs4$j;(+Ql7}WS1hu&O>u<}1soP_R?m1LwNR|ZV_o>mQ z6hZL$Vp_}7!UaqXJb-;>^~q8dzc{Bxo5&Rt*RlMMZ#2_x%nd4X8j4a~PbZianC>*!)IfkFlj96UJYivk9GZ7v%HoyFyluZ{>Z9M)#6sg?mXDGSGiOEF!kf z(zE(?%4tyduVVHfi9>3$uVtYh^m>I?opJ|90vC<_lUO*EGJb~D+Wkdq*uHaznn<6* zo)>B1r~OKWr~l`+nT@F)In7Kd`%z9eUzj|_4Dd)gQ!54R&m-0t_ZkipAH+MjIyrOd zOp9#u6YS-Vo*#8vUrwD^AwkK=w!JI=Q;LN(B%Hix?nay>nMRXPoHb`Yfj`N=Bf%Me zw(#V}tFnm7a0Bh;&0n<1x_VZ?v#mv<2?6f5Wb=aoB2pOdZcLi^y9y(U>_vH23}2Q? z__tz)M^9WHCgyz(X3hLYBFc43IEIpkv>Jh`?=+%>$ePzm3f3!o4@u8UD(BKv3t`=f zoPx5wn7w`bK1@jw67Ug@jI)Jl>84aPSA(TcuQNWkKlB7T$H}06oO~;j6>MA?g{8}V zSo1c?qfGF>MMKer$)54@M3yghlmbq?Hwsgm+_RT=*iC~F{|PijlW&2nZSX`$BX74y zKR^45KC<<7MWqo3(h1?=;a5VYHnCYiU4GyFFR9d;i{a`b89?L2Dp3QwL;Wb-5;>B6ujJ3JzSs~6^3*B2xejbLAppt1LdY>R5AG$Bk@oqn>Ji*nM6-jM3N{@6{h0q{cc?(w#Dk|Gka!P_Jf?Ld$3^3m#k z)PJy{%VJv4Q(k$llF?B5c1TV+uwP^?oLXLkJ6C2;KnPF4esj%aU^h%D2@s}4;_#5Z zhCMlU*UaoPB3=CJK}@l&44s8q<0g;n0560T0sAKOEbjp&8%JvM9t9crG^fo%7?IH7 zL58BeVQbKR6Z0;a3fr2s$J1fp0I7V}o^ADj%3BL|kH1er4}cu^&86ez=n#uM6nu)! zs(p#b9=_Ob^k`S0YkpW;wD^iy?FO0J=ntyQenw4OXAuE&L*cH+4=!UaBU5K-A*&J= zB&z^HnI&`W)9he;NqiC#rYnrXcbv>ILmA$%1w;dOaYL!NAMCe_Q-zy`Ikf@XdO2eq zd{XpU_9M9PnJg_jES7J497{EM1QUM3o~bUlDTQ&(F}Ht8%5m zicy1Te7JEln=x@7$mjsh;!-=*DpYr$n(_WRtIZbXHWuA|06X!Q;UlJmbWCu6Q?cmEO?nopcBhe>< zbYj@)40X@zpw(f)fxeHT?pu4freO`jS7`80N>c6R*|Gcb(R(&M3x3&Ll|)?V>5r)7 z^@K!h*c;k<7wMfXM0; zjuJQg8Gq6-p*3M{W7i*Z6CZz~8`s-vw@S}F#AnmIpB zI=B};mrdic3q!G8Cq0u?wn(P1E9JHJ%j%!d7ke{}vTl_&k%TCdk5UHqviID3a;T{I zrullc<|{GK@CfTB$3@w~?rR&SZYVzzONz-8Vs=L&jalIf8LMh{MCz#w?#O5MP_AG+ zL>V-0Rks(5>UYDW&YsyqzJ}PJ=(|&&Rk2%RIwBN!!QQscEj;56?onk{VhtRJFoY!P z^My@f4)`DNv(rafAZtna2f=s8S9f`h)AKH%+EGwR)QC@8=+lhRZ7NS}VA*h{WLRVY zOStNJebW=Idf)kzZQfBzx%?#+=t%F85~K36A?B~Rn_^2ja>w8yL~9BIFVc(Lz-Ewf z&#z3>9A(##n&~TJysW|@t z^G0GF)Mo?KB+8zO&NSxA59{V;sqd*r(Qw&9_Ljm@qV;i|DTbBVI(%SZ$Y!LFjwj-> z*6q&%ir{+H)T?%W&V`kb$xS{mj)`KR>p=uKkxiJE>iUoB??9jRCt>y|H~Z;+3hWL~ z1&ASbCsbb%d0a0Z_3|08`HXqJ;XZ7EK8&FD?V;X{YV{RCL;dWZcVLa5fzos#BJr%2 z1+Uhv?ET6SO2`pzxhL;~KX`uwYm=B_pU@tyxre((dAXbW2itZ1Nkp7zYM_8F!Q+&U200#_z=|=cE&oPH8*`C(KQ~i}7UFYcjV) z^;UkL@WHE+yXPEZf`Pmj6P?CZ$Vc`;*)2`;DfMnZ(zQm`CA*jNF8|if0*}&;9K4OW z`Wolacz$7MKT>V;VnTlc`$aAJx@1`x?o9_nxq{rHbhR1~(frt8q6*Nx5*?94nyJwjKU!|w}fxDVx?rw7#bM%9C+jakRHYlyGI(1?;}Hp z%xKXn7cdhXQyQmxJ?=)@O;Hty)})O^>%TwUnD>v8MF$6<9r6XikOxs($y@1)ruDu; z)`z>uJoV&N^M*$&h;-H04_E2gm({A9W5`wSn6b%5&8(Ow`6NXFWw(1sKWb3;6f|im zHyC5r9cpfR$T_plqpuWCsc5fxBCNIHajq54aRywl>VNSXP8u^8#Zzo3*YvWCG0VoFR9MH29?%i}&uKe$|MV4c1N44D~Is;Pn zmD`D`7{(cgy&$odnON+<=ZTRhht_tvvE6soBt;xezPRJ6c-To3zbWiw{1r5@T~f`VS0U zY>qyOk3gI6u;s0F_6=A2!-lc^3*PjTYWcR$xtl%4cPCQAmr_Uh#H-hkz!l`^wkw3l zY=xH#1&@cX9uKV2_6GAIs0EttZF64_r1f0`Rm&;Q9Djh3fa6v`JB|W)K`z)ZTy+cj+Y`Od$w+^cB_*XWPH1?vr^YREUzBP z_B*0~K+N$T+@g9zKf!aYtkjYr>4WWm!#HxSw!w->FD)1oeXt)B@PGUAivFNlCtKSD zn5K9LSZj%S^T~+@ISXOui+N)?BK1a6yzMFRZ8|SD<@|B(C|6Cxy80G8~0EgPQ z3FFTXlbDwu${_y-Y3xhFaXxW6j%L>Ug+*)r6S5cGJ7Jh)ei+?v3}dg#vVz(;e+Hn( z(xQ$n?{&9k*+zv=!sL-vAP{+svGB*>f6P< zW(i02hASLOdU!NX@)(Z0>N8-MHR-%YHGOwiD`QW>5tEzFu1sc$=GX8!keS4Lup=r< z%5UM`eP$_N*KRdMgY$-GsNRz^;4z%*&O94S>44Vs#LcQH!_Lx-cP&Kza`s{Rxg<^b zGljA&R!)SjVQ9L-5SkZV*atcG{pnQiN(s+Y0juj45iuB1g*%KOm@4r0W7m5IQ_v$1 znO&-I zLoH={ng|gs(^L)x1V(9m<5$2z%m%Jgz^-eOe*Ug70%w(ACVp>-O~*Sv7U@d(N4kxe zR%>^=N?Y5xXM0Z;&FPOAelV~XgJQx}U%3ZV2_8A4oVcQx`qx4VW)r7I7!kHkf*PS; z{yrX$-vy{tr+XK2Yn=CnSl1lH@CJYI$E%4>+QSA-fngP;#6K;W6cNzrbM(lqzy?v1 zeH(z335itJ5SWg8jowof`iKl1t3I6N-AeePX4cZ^*Mdl1#6(O%oYVh|=*?BGo}jc# zrSO8MoWOJjm^pJNR;~apXzaC9dok~=6XFB-J{O(nalJBnAr8~e9~9aVF0oQX>2nVq z8B{y?%Ro;ZXDVT05>zEHXG@OY=lVG^qnioy0zddcn5KOGVN>v5R5tkmgUFOmtIzxd zq5mVR|J&gI#-9KCc3$yZ=5q{_XBMH6no4^#g*@F~d43i}fi}<@0jMrPWiHQEfu&9HDI}n#U0jeXiakCX18tDwcxy0 zD<+xl+{ULKv>ec_7U3}fq_J1!NUDz>afQos}0Fb*x1P*{OF$Tq4gnEq5Tv_HQjji15CjoL z|HBnOaNv4f|5@v-8CbKQXUEy^+41h@wGWEk%GlU(@2wa0LD~zl7gNog*u{GThG{KV z-4IGv)E=NdaFa?ZV=G6m9i1mU@~E^%6n!qlE50N5Jz}#CRbBIyU8A*dY5UMa!J7(b zA;Eh?+@@@lefk(y>uvRFDh`URLimJI)AF~c0YB~)o0@1zjK}O9O>)F6V1;J*;F08~ zoa;Z{mDt*9zm5SfE+-G`4um_t+j=kKj_q_C-C%lwzE$aQFLQmC=0FOlw-{&E9$7#o z)*NDeKx^MM68$d!Epc|}2w!(^2*W5Oz83bL^8?&sRor}TyZ1EqxbCrRd2Y>av@S9& zS4|rq9s3)6%gJhFQ%JT&3&zny$hkhvwh=1DzPrJb#ZzL2&P13V(?$DvXph{)Fyq-a z4PA>t52wyShHuk)V`PH~2?ZAaewR)o9agbA?_zVCYRElEMcAvHQsiQczDXR1GQ{zq zNm~R1Do?Q*W8C}$oEfWkK9mbm@46PyaU-NTmDs2(DC>*5sGjFLU`z-m#n!lKBX=f6 z_KvVC$fa~Xt&by|{Q%OtAI4ZArg)6_`v%%^tt3q;;Ic`D4g({2(YpUq<@lQ&v|^1} zO%h4mAD}XDYuO474<&PMJRFjYtS+K;rX{MHaqGjpfC{`iT6ryEx1|rkNR6AFb=zr6 zbtOk}VdTO-2irT_O53)HT-_Z!D@m!G?yCb&1RKBBak?K20*;*UO?cjn3+Pv==Msj( zXX<6;v^v59)t`M_@T&jZ5E37#K}-9l8TsmX>2NSs=~QrCO=rqiQE%GjhsBh)?8ULj zcl=vY>^{&kQ@7^cG?tb~%rw&&<@SndrXbR{z+R1v=oyL~b8*dm(O3*|kKZD-5|gDV zULMC&T{6*Rn5=`evpwPJvt_cmnVd>2zgD5;JyQmvvnxrKGT^oYRjx)J`$!HtRPP1* zipafA1+VuMc1k@g^3>&Y2_B6dUQTn$Xmbini_EoE9W6JVe#fq_WGC5MKos178^Lo`d-+YqT5*bv>Oeuh0KwKFl ziMLJ6Xx&i~*3)!CbS+KdRqu5Y!{Y9ND3WAFXw=FnE#l40=Y*P#JVScsIm|BerN?R! zxq@8ZeG68&kAh;P`&!v`X8ciWqRbHe;B5m)D}A+q)jb>5p3Q?aNR{lXF|L74R}B3x zVUInXb9rhLHv0T#ze-j697re&gvt;hau&~xc<^+l6fs|W^Eje>-DLgQXGRlj0yFf5 zEEG@&;emuud~9n&1o&2VYlhbs^zAs~t*hoZp7zI~D5}ATx)P!tu;igPdidJ%Ic|xk z+IL|Pr7xi&bsb)fHuDZD@!X4yxWU4nT1X|y*!Fve7rg<1G*JQLkpq zPXo_OCPWkDd(Blu@~9%DFMT_ti*d($M~FZBB~wNT>`@*Q$VPoat#{6IDrK568#qEPT7QNAoPg zyDvGhxrMXwHQfnYB8~6te9jbco1mUk88)r8szm+vDeiU@f2`#p8Fm!c2pYk9_A2^e z30}loFYCeK8&Yxh)Nm$>O}=?iSjS^kd_DH5$c?#Cut*ND*a!xsr2NZ0V3uxkgp%4j zd!}30`8miB$r?aEw61&~%M%fkNx;^MN*pR9&CS#jb6A>sPK7ddFl;f!Z~e7<&l9;> zWJ;IFe>B`E{$NuS`E`n;4)e~4Xxz4M0 z4og4M42*P9V8%PV)I>oJM5YUzE%5UVb#n1V*1s)ry$ZbO7(ng)#5h9LB?WiNXT)L5 zInXk|MbnB$B=PQ$UtHF9i=6^^dcmrwWfcGU0_gexvtB2kJF8JIH%B5^lbr>#KV~$7EEB zlrtFQiMGw>v|;$WC2Xf?H$RbJ=m4xC(?v^o!3FO(7j{+Me-sz0s+qUoD)r)1m;#3I z!R>YUDcEg+IXI7q(d#j`Oo_^7>Aa{GZ-1Pn$OsLl3_W@u&5<^xpMfjmot*5vD)^TF zEk7rqHgb5y=t?E&5qps_%R>Znuc3!3fLDoHpM@jqLv;L{S4lxspTFKrT>dW7E{+$C zYl@kK=b$K>+0coZgmc)!vDva$gnEy-r6QT4Mz2|6V&BPBw~r?>cpG)*+4v3Gawgk_ z30zwF6%b;9dcI`yu`76wSJdla-S%XZWSa4;6^G5ETCwR;&XsM{!W=bsy-_y(@v@rX ziolPFwd8k;1-5v~b>pl}-V#KCHp=Kf^X9@JKFHl&iIZt%2nY$!kGT_D{y23)rng+f zrk(o%Pqh!Ccy8~F0>0h>%J!noZtm13yWI&fRPsitsVwv{Ho(sfeyzQ@hD9(Q&-%uE za9AgC+I&Gk_ny$Z#CDK5xA*E^B^HQ$1c!R@wJzpomzj_I`fg3G<`kO?hXiKN888NS z^qRFIX3f&(FqsVB>k0*U2719>RbI!>0~4_pJpRF3gN8sN=v6N}yIIGFfLORQKK=DO z_%N|*!_{Mv1}oB4$Lg6A%DX4x(NCW?&_)*8NPN`yBvJh&eYCMXbl;SumF$xzQcM=- ze(E@QcPu97n$lBJ(SlUUQrEy`_nd~{^^}SpR^*m^6uGtpJ5uJLXed@*D z;+uq4i0MOK0eu?E!eR%S%Ue{D=_c+U#-0dC-SU4s)R3ABn3r)JIbOLnM+Fl&w50bp zGVf`$AlR$MGc{An&*jp+{j&+C zXS`U$0t(4q_b6EpZEw;QlMmmahO@lgVI|4H!(9mYnEut_{+~~`s5{un?B|a4xx@X% z>iWQ$CT!tq{g+#ArFfb5LyQ^3dZjawVzKaOjb(_r3akR|R&VJLRM)M37>`b0WZh{; z21!KH0)bHD9qqNPWo__7S)V*f=3Gy3x)|>{MpHt++mtoG)j;13 zbdLZNLKw(*G==Uu)}^s}0_zIzrt;CjESqHu&uJsuNRZc(PO`A8f=Z2*`pKxjb(bK% zR!PGUH=&Vvp^UD~B*|Y$C5T#)mLnCy$7<4NVL)S;MO{0^s&uR33w4YQ_gwQet33$^ z#HDzPny@SBYcM{{YE++zz*(C#y$w{mm<2RXzm7a2+7vn>52a~4@X`D_IX*@UFHh4$ zFX)11Hycnw(z34sBBn8Q&LPd;?tO7JtGsU!Lfy!r-G@Uh#iLly+f7Y$jPbicr>#-> zCIt9~X#>7t3>OXhIX@yOSFp%9efd^4++aoX>X%=*8$ar_X$)^h61*eqQo=<=WuCLJ zLnpGksV(r$&fpOKo3e4D7z4|LgS>9fy#__h>$e*X-@-Vcb@Gr-I)pSuIp4Z2M(vPl z6t*@g&z?V5P74GITdb>G>@}4$-k@0*_U>2~FH0S?pz6)fMWSmehc)bg8|7nw~Ts@!J93wtwT*MwztI!of!{JY!*RrLA zxcR1DG>0Q8tJ~;v_qt2%6AmOsaEA|IH+;>@yA^@dJ0A<|3>btY36-g>q>n9jtX!jB zytg3c@Did&COPyYTEwAt+Jn_H7Kf$i@r3C848-sfJ1Q-B`K@Vdi-LQ|ww2b+FEw5w z<>n_~JSZzjV17_m98b3X&Q*IVNci~edC|g?S+q!h4*LdB{ocTVu)k9D5;HTu>trTn z<>c(5>S}!2L_ep~?Hcc#Mx}7Sk86~PYBV`I%1sAD=3@@=+o|XXRHtcIh_8(jj|hCC z7i__syh_s>q`6M>iFsW?FtZ=`sD$%)^z*tnTWUhYlF@Z1Lh~aFR*OdAwHZZ==!0|u zKOy*-c44CHr5+IwIwEBzr)5)_nj0oW6b~J)q&s-uq-P{8f;&h?Cwk2P9DU(tCpXcA zqj(3~IR7pO_2m2whd0KAF1~EUAGL!+>&-M@7Z%%1xKyfej&TN02e z#SFO=T5H=JT&F3%3$$?Gb)R<%1tD4WPmdGbL1~pLHyGcV(W#Y6l$k5EtOWJ*wAGu% zBj^XO7y1sC?K1|?I)wE*^YpqDy)Zc#M-*!}b(x8k z=!PdNi?XzL=b48pUfeA_AgS5%$Pq6TW9$G=ErXp%C6U;KJQxd>2L;~c>CS(AW?7b% zY!dRhJX(}R2UI6!MeXEJfyPO*tl@xaf-3cqrPD6BFV++{W&6ft+hbBgh8y5;s@3b6 z0d@ z6oNe`79Q@YBnTK~d&MHt+pvU>^ey9%5{kSVhJ{!JbI-^>iFcvZ z?#h(!9|vOUBnciN=6kKAKYvIcg>0;~U4*jlRbX1IGE5SAxX7gce9!02S|CBu1|j!; z-hmSCpbyebQ}tOe--PUFZ@i|LAjk_n5#d3%FQKhtOj@ST=JzrAgleUG0yZvc-!g>X6l~D(ijEl#gk<2F7Cgy)&9X7UsDB2l~KV^iC2u1|8X4Q}0 z2)Y0C;1i&FVm@I>o?{@J=POQ`EVoU0h}IA9kv_d-90@YHPls(R>n&2HtV1Kz(ark? zM_sp!J+-|yal(&15O#B4UnW-#vSnmM^Mw&kkv-`A2QV>`f20%3}qN9TdGhlGN07tZX+ZWLR#%A*BZEDnK5Tg z=BoVh42RadH*B(4Bbcr1(wm&_E_1KtBUV4geide^xrM(&wO^DoD|-(!onAimNLE(p z@#EMm%~Cnx7IEys74DGE9S-}eEON(dDll)AeiYL}d-y(r5llYu@cjmiUidFsaaB)e z7c;xRS)OXotriWLrTVWT7wrQtw?hXFvPpz%@t8aj9g0+22i4{q0i<_w(*birmmmx{%*CRwf zc*S)3C`P2Jw^Jr#+JbyeVHPLMOTZ~!W!pJiK>Vf_*PXU!sW0v~DW{{&R3MTGTIyhO zB7-T1UtN16O+|#H|Ka5r32^GNmRFTJ>>3<5iJ39#U7zk6>5Sp=uhA}2pojOW_+tV* ztIDc;wY+XHI6Ej9@tU!`K#j^|oL3nX&{6EP+p!EFILsTQ=`?en2^Grki2sAkgpq zHh--7Z0vG3oe_GK5IQe&H;cLY>hkZ$Yiq19$PQ#$lWsBXZkX!GgQX_f_SvFc4Vb3b zjZ~(ak=FvILW9Y{#UwJ@J5FPt$4b{9)~kGwg2zci!CUtzv+S^FPKx<)V{B6Ol~!B5 z)*)qXzCb2nwD6p*E6qw>!`0RyXJqiaTh_2lSLTP9arOM3nZQLE?+q`~g2Q!cOln!J z68FLO>kGkRNA|25{-0(dRmE5c4RcKcce#6$g<7m>^M`ETUzIEHd+>Q9mEL)pC6V(% zKk06)P{cCcRQ28`CZ9X8sdApzAM!vDu&wvom5}X(?Uwe?#P1ZYE{%h2hp3~qIZFC^z3*dJbi;#YEfenq7)476 z@r^#NE<w?DIRkMFibqX~$xaCN~VWc9bvZNj5xx^!|?+XncM#o7>!uKo%Mi3(ACS)TXpDC8)FcsnsR9g-+X*gG;!IVh}ok|7>U^P%_o z#IyIM7?G&aUoo`y^?IsyomiB4YLnn^;O|8$zB(IYJT_P)I~_4(n)oVH$0g-jJLvTozm z?zYBo=0r^|JQ*k&+&q-)`1H1^y+e1+lBkph`H>u7PqLR=t1RJ-s)IS(MroR(8LxU< z66~mnU3G?ArDK{W5?3s?Wm6b)SLb+a*ep@rB`1TlUw z0CBPoep%q%JFBxQ4*`D?vr|`87>N9+->#S3?@U%b6DaMpsu2YDeA zWECm-uTq}kqWc6h5~6Om9>*TAxQtBqxY}ODuthcCiDZd$jg5Nmh&KV7lHD!A5v=Qy z^56&-w1XXqe7kucF>Obat7Zp2viHI5h1>UEkW+(HW45wAw_z3qss-=63**wqa(O(p zof33vAB3GkpVo$ZVv7%(STTD=fPk#_TBrV}IFi&l>D2ImD9Za^9lr9(`E|E*1$8K* zy7j&1Tb1%nYVTpZ(xVX&C$h{X(Bzf1zxHYgXIL7y zfnEToo$yeVF^q8Il|+6Mg_Uxjhn^NKWH-bQ$|*jW1Q$&juLqgJE5C`9!@}Xh13`vSP+;hRIS4=u1H5ehxd7{MdSSzCiJp7~Nver5%ifU! z&g1@`tjrJY0}1d0BH+e7`Q_=A<9{-j{9iJV=p9)pNmVr#kkokuIw)e`O?P^o5W4~2 z?>brh#tEGQm@%D80Xa?avkL#1@Y=6*Feg;)zb8DEi@yM18DMIj4gB;qaMSz`00t(< z|L}5vUvWZy=}kiyeke4v2p_0+2cYBNe3~*Eb#;6A5;SxsKUz9)Rm(X})t?Hv8z$=9Wcxae^!@C9S z315PD8Y~c4Ofa{ya0T>u0a5D9q5Y`xo~;6zA_AULw%?#}0J2M;4M)tMXHk9;C*c7cP9iY^E0JeG0iX*H9bx=eUUU50 zfqr{Q;ZIxb_ju#bsL%l;&rlV(E=85TJbWZHE_7g~Gh88HmG+X{{?=6g7N!ZB1v>1{ z8H)sw1tqv`{KmOwS*xvKgXjb~_h zXno={crXwb<=^2?TjEb@#n4pHT8U>=BHDjJ^|R9ctGb|t=FUhg_5On7&$4sSC4yGw zIwQ+5{1e&vO-^V`XuX;<%tg~bVV*X~Pw1b2oZDQ2W`R~lIb)eKzrgYj+C`ldXiVr+ z<7b%o_7^e#{tP)Z5A;dqGoH=67kJL~h|?PSt8>lJoX{sx&p6YZ{+si1a|P`JdWPxw z;J-0xFFJ%mXByhu?u_7W@Lv#|w^Emv0NTyzj6gH=0>Q7h#NVtcLYD;Ei{Ok19Cd-{ z!sGgF^t+m+-I0k47+rx_*~M_~NMn|1Qn{{arfISBv& literal 0 HcmV?d00001 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100755 index 0000000..c14d177 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Thu Sep 27 09:13:56 BRT 2012 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=http\://services.gradle.org/distributions/gradle-1.2-bin.zip diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..e61422d --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/bin/bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" +APP_HOME="`pwd -P`" +cd "$SAVED" + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100755 index 0000000..aec9973 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100755 index 0000000..d00c426 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,11 @@ + +def srcDir = file('src') +srcDir.listFiles({ it.isDirectory() } as FileFilter).each { + settings.include it.name +} + +rootProject.children.each { + it.projectDir = new File(srcDir, it.name) + it.buildFileName = "${it.name}.gradle" +} + From ea656fc2afe8210ff00cc7b4b37c50a151929587 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 26 Oct 2012 12:44:45 -0200 Subject: [PATCH 239/276] .gitignore gradle build directories --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index bf471ea..16a85d5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ test-results *.userprefs *.pidb /bin +build +.gradle +lib From d391738f7121622f4755781a835d147026efb239 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 26 Oct 2012 12:48:46 -0200 Subject: [PATCH 240/276] remove unused import --- src/UnityScript.Tests.CSharp/ObsoleteTest.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/UnityScript.Tests.CSharp/ObsoleteTest.cs b/src/UnityScript.Tests.CSharp/ObsoleteTest.cs index ef8293f..3041004 100644 --- a/src/UnityScript.Tests.CSharp/ObsoleteTest.cs +++ b/src/UnityScript.Tests.CSharp/ObsoleteTest.cs @@ -1,5 +1,3 @@ -using Boo.Lang; - namespace UnityScript.Tests.CSharp { public class ObsoleteTest From 3fad646617617dc842599a0bc08934bc1c69fc49 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 26 Oct 2012 12:49:30 -0200 Subject: [PATCH 241/276] don't depend on System.Collections.CollectionBase for it has been removed from newer .net profiles --- src/UnityScript.Lang/Array.boo | 73 ++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 21 deletions(-) diff --git a/src/UnityScript.Lang/Array.boo b/src/UnityScript.Lang/Array.boo index baa6f01..419a013 100755 --- a/src/UnityScript.Lang/Array.boo +++ b/src/UnityScript.Lang/Array.boo @@ -3,7 +3,9 @@ namespace UnityScript.Lang import System import System.Collections -class Array(CollectionBase, Boo.Lang.Runtime.ICoercible): +class Array(IList, Boo.Lang.Runtime.ICoercible): + + InnerList = System.Collections.Generic.List of object() def constructor(): pass @@ -22,6 +24,47 @@ class Array(CollectionBase, Boo.Lang.Runtime.ICoercible): AddRange(items[0]) else: AddRange(items) + + def GetEnumerator(): + return InnerList.GetEnumerator() + + def CopyTo(target as System.Array, targetIndex as int): + elementType = target.GetType().GetElementType() + elementsToCopy = Math.Min(len(target) - targetIndex, Count) + sourceIndex = 0 + while sourceIndex < elementsToCopy: + rawArrayIndexing: + target[targetIndex++] = Boo.Lang.Runtime.RuntimeServices.Coerce(InnerList[sourceIndex++], elementType) + + Count: + get: return InnerList.Count + + ICollection.IsSynchronized: + get: return false + + ICollection.SyncRoot: + get: return self + + def Clear(): + InnerList.Clear() + + def Contains(o): + return InnerList.Contains(o) + + def IndexOf(o): + return InnerList.IndexOf(o) + + def Insert(index as int, element): + InnerList.Insert(index, element) + + def RemoveAt(index as int): + InnerList.RemoveAt(index) + + IList.IsReadOnly: + get: return false + + IList.IsFixedSize: + get: return false static def op_Implicit(e as IEnumerable) as Array: if e is null: return null @@ -48,7 +91,9 @@ class Array(CollectionBase, Boo.Lang.Runtime.ICoercible): return self def ToBuiltin(type as System.Type): - return self.InnerList.ToArray(type) + result = System.Array.CreateInstance(type, Count) + CopyTo(result, 0) + return result def Add(value as object, *items): self.AddImpl(value, items) @@ -143,15 +188,8 @@ class Array(CollectionBase, Boo.Lang.Runtime.ICoercible): callable Comparison(lhs as object, rhs as object) as int - private class ComparisonComparer(IComparer): - def constructor(comparison as Comparison): - _comparison = comparison - def Compare(lhs, rhs): - return _comparison(lhs, rhs) - _comparison as Comparison - def Sort(comparison as Comparison): - self.InnerList.Sort(ComparisonComparer(comparison)) + self.InnerList.Sort({ x, y | comparison(x, y) }) def sort(comparison as Comparison): Sort(comparison) @@ -162,15 +200,14 @@ class Array(CollectionBase, Boo.Lang.Runtime.ICoercible): return self def sort() as Array: - self.Sort() - return self + return self.Sort() # Combine to a string def Join (seperator as String): return Builtins.join(self.InnerList, seperator) def join (seperator as String): - return Builtins.join(self.InnerList, seperator) + return self.Join(seperator) # Remove def Remove (obj as Object): @@ -189,13 +226,9 @@ class Array(CollectionBase, Boo.Lang.Runtime.ICoercible): def AddRange([required] collection as IEnumerable): for item in collection: self.InnerList.Add(item) - - override protected def OnValidate(newValue): - pass // anything goes private def AddImpl(value as object, [required] items as IEnumerable): self.InnerList.Add(value) - for item in items: self.InnerList.Add(item) return self.InnerList.Count @@ -212,11 +245,9 @@ class Array(CollectionBase, Boo.Lang.Runtime.ICoercible): private def ConcatImpl(value as ICollection, [required] items as IEnumerable): arr = Array (self.InnerList) - arr.InnerList.AddRange(value) - + arr.AddRange(value) for item as ICollection in items: - arr.InnerList.AddRange(item) - + arr.AddRange(item) return arr private def EnsureCapacity(capacity as int): From b8fdc0fbccbebe0c4771eafe8c6c5f930a6ac15c Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 29 Oct 2012 16:04:57 -0200 Subject: [PATCH 242/276] prefer pattern matching over sequence of ifs and casts --- src/UnityScript/Steps/Utilities.boo | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/UnityScript/Steps/Utilities.boo b/src/UnityScript/Steps/Utilities.boo index 34f83d1..f18038c 100755 --- a/src/UnityScript/Steps/Utilities.boo +++ b/src/UnityScript/Steps/Utilities.boo @@ -3,17 +3,21 @@ namespace UnityScript.Steps import Boo.Lang.Compiler import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.TypeSystem +import PatternMatching def IsRhsOfAssignment(node as Expression): - be = node.ParentNode as BinaryExpression - if be is null: return false - if be.Operator != BinaryOperatorType.Assign: return false - return be.Right is node + match node.ParentNode: + case BinaryExpression(Operator: BinaryOperatorType.Assign, Right: rhs) and rhs is node: + return true + otherwise: + return false -def IsPossibleStartCoroutineInvocation(node as MethodInvocationExpression): - if node.ParentNode isa ExpressionStatement: return true - if node.ParentNode isa YieldStatement: return true - return IsRhsOfAssignment(node) +def IsPossibleStartCoroutineInvocationForm(node as MethodInvocationExpression): + match node: + case Node(ParentNode: ExpressionStatement() | YieldStatement()) or IsRhsOfAssignment(node): + return true + otherwise: + return false def SetScriptClass(context as CompilerContext, klass as ClassDefinition): context["ScriptClass"] = klass From cc71706be2f75ac8c1cb73e55b2c83e5b5ea3983 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 29 Oct 2012 16:06:06 -0200 Subject: [PATCH 243/276] test warnings are emitted for coroutine invocation from static context --- src/UnityScript/Core/UnityScriptWarnings.boo | 5 ++++- .../cannot-start-coroutine-from-static-function.js | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tests/error-messages/cannot-start-coroutine-from-static-function.js diff --git a/src/UnityScript/Core/UnityScriptWarnings.boo b/src/UnityScript/Core/UnityScriptWarnings.boo index 5c3452a..7a0714a 100755 --- a/src/UnityScript/Core/UnityScriptWarnings.boo +++ b/src/UnityScript/Core/UnityScriptWarnings.boo @@ -8,10 +8,13 @@ static class UnityScriptWarnings: return CreateWarning("UCW0100", location, "WARNING: 'virtual' keyword has no effect and it has been deprecated. Functions are virtual by default.") def ScriptMainMethodIsImplicitlyDefined(location as LexicalInfo, functionName as string): - return CreateWarning("UCW0002", location, "WARNING: Function '${functionName}()' is already implicitly defined to contain global script code. Global code will be merged at the end. Either rename the function, change its signature or remove any global code if that's not what you intended.") + return CreateWarning("UCW0002", location, "WARNING: Function '$functionName()' is already implicitly defined to contain global script code. Global code will be merged at the end. Either rename the function, change its signature or remove any global code if that's not what you intended.") def BitwiseOperatorWithBooleanOperands(location as LexicalInfo, expectedOperator as string, actualOperator as string): return CreateWarning("UCW0003", location, "WARNING: Bitwise operation '$actualOperator' on boolean values won't shortcut. Did you mean '$expectedOperator'?") + + def CannotStartCoroutineFromStaticFunction(location as LexicalInfo, coroutineName as string): + return CreateWarning("UCW0004", location, "WARNING: Coroutine '$coroutineName' cannot be automatically started from a static function.") private def CreateWarning(code as string, location as LexicalInfo, message as string): return Boo.Lang.Compiler.CompilerWarning(location, message, code) diff --git a/tests/error-messages/cannot-start-coroutine-from-static-function.js b/tests/error-messages/cannot-start-coroutine-from-static-function.js new file mode 100644 index 0000000..e970625 --- /dev/null +++ b/tests/error-messages/cannot-start-coroutine-from-static-function.js @@ -0,0 +1,10 @@ +/* +cannot-start-coroutine-from-static-function.js(5,11): UCW0004: WARNING: Coroutine 'go' cannot be automatically started from a static function. +*/ +static function f() { + go(); +} + +static function go() { + yield; +} \ No newline at end of file From 3c375e8690b42629aa3d5d22c1ba92bdf4c0e8eb Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 29 Oct 2012 16:06:53 -0200 Subject: [PATCH 244/276] prefer linq over loops --- src/UnityScript/Steps/ApplySemantics.boo | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/UnityScript/Steps/ApplySemantics.boo b/src/UnityScript/Steps/ApplySemantics.boo index 181983e..01369ff 100755 --- a/src/UnityScript/Steps/ApplySemantics.boo +++ b/src/UnityScript/Steps/ApplySemantics.boo @@ -77,12 +77,13 @@ class ApplySemantics(AbstractVisitorCompilerStep): module.Globals.Accept(DeclareGlobalVariables(script)) def ExistingMainMethodOn(typeDef as TypeDefinition): - for member in typeDef.Members: - method = member as Method - isMainMethod = method is not null \ - and method.Name == ScriptMainMethod \ - and len(method.Parameters) == 0 - return method if isMainMethod + return typeDef.Members.OfType[of Method]().FirstOrDefault(IsMainMethod) + + def IsMainMethod(m as Method): + return ( + m is not null + and m.Name == ScriptMainMethod + and len(m.Parameters) == 0) def MakeItPartial(global as ClassDefinition): global.Modifiers |= TypeMemberModifiers.Partial From 803308184de8f7d6951405f5567090f26eb9c9fd Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 29 Oct 2012 16:07:40 -0200 Subject: [PATCH 245/276] negative test for static coroutines (functions from non MonoBehaviour types are NOT considered coroutines) --- tests/integration/auto-coroutine-2.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/integration/auto-coroutine-2.js b/tests/integration/auto-coroutine-2.js index eb79dc5..dd837d0 100644 --- a/tests/integration/auto-coroutine-2.js +++ b/tests/integration/auto-coroutine-2.js @@ -4,10 +4,13 @@ done // Negative tests to make sure the coroutine detection is not too overeager -class Greeter -{ - function Hello (a : int, b : int) - { +class Greeter { + function Hello(a: int, b: int) { + print(a); + yield; + } + + static function StaticHello(a: int, b: int) { print (a); yield; } @@ -17,13 +20,6 @@ class Greeter var t = Greeter(); t.Hello(1, 2); -// does nothing -StaticHello(1, 2); - -static function StaticHello (a : int, b : int) -{ - print (a); - yield; -} +Greeter.StaticHello(1, 2); print ("done"); \ No newline at end of file From 2d1b557030a71764c5aba04c87d4bf0e62a56a80 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 29 Oct 2012 16:08:07 -0200 Subject: [PATCH 246/276] test for static coroutine behaviour --- tests/integration/auto-coroutine-static.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/integration/auto-coroutine-static.js diff --git a/tests/integration/auto-coroutine-static.js b/tests/integration/auto-coroutine-static.js new file mode 100644 index 0000000..b0f2e84 --- /dev/null +++ b/tests/integration/auto-coroutine-static.js @@ -0,0 +1,10 @@ +/* +Received coroutine +1 +*/ +StaticHello(1, 2); + +static function StaticHello(a: int, b: int) { + print(a); + yield; +} From b74aac3a1722b6af00ae2390214eef7214cb868d Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 29 Oct 2012 16:43:32 -0200 Subject: [PATCH 247/276] support for static coroutines (fixes case #494362) --- .../DuckyIntegrationTestFixture.boo | 4 ++++ .../ErrorMessagesTestFixture.Generated.boo | 4 ++++ ...StrictIntegrationTestFixture.Generated.boo | 4 ++++ .../Steps/ExpandUnityDuckTypedExpressions.boo | 4 ---- .../Steps/ProcessUnityScriptMethods.boo | 20 ++++++++----------- src/UnityScript/Steps/Utilities.boo | 4 ++++ 6 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index c3d1ade..fb30188 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -202,6 +202,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/auto-coroutine-return-2.js") + [Test] def auto_coroutine_static(): + RunTestCase("tests/integration/auto-coroutine-static.js") + + [Test] def cast_operator_1(): RunTestCase("tests/integration/cast-operator-1.js") diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index ce530ab..e2ebae5 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -34,6 +34,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/cannot-convert-error.js") + [Test] def cannot_start_coroutine_from_static_function(): + RunTestCase("tests/error-messages/cannot-start-coroutine-from-static-function.js") + + [Test] def do_while_const_condition(): RunTestCase("tests/error-messages/do-while-const-condition.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo index 0c08598..21f2363 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo @@ -200,6 +200,10 @@ partial class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/auto-coroutine-return-2.js") + [Test] def auto_coroutine_static(): + RunTestCase("tests/integration/auto-coroutine-static.js") + + [Test] def cast_operator_1(): RunTestCase("tests/integration/cast-operator-1.js") diff --git a/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo b/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo index dac438b..1f36cf2 100755 --- a/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo +++ b/src/UnityScript/Steps/ExpandUnityDuckTypedExpressions.boo @@ -32,10 +32,6 @@ class ExpandUnityDuckTypedExpressions(ExpandDuckTypedExpressions): return UnityRuntimeServices_GetProperty override def ExpandQuackInvocation(node as MethodInvocationExpression): - if not IsPossibleStartCoroutineInvocation(node): - super(node) - return - self.ExpandQuackInvocation(node, UnityRuntimeServices_Invoke) node.Arguments.Add(CodeBuilder.CreateTypeofExpression(UnityScriptTypeSystem.ScriptBaseType)) diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index 456c78d..632b235 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -32,7 +32,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): override def Initialize(context as CompilerContext): super(context) - + // don't transform // foo == null // into: @@ -175,28 +175,24 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): """ super(node, method) - if not IsPossibleStartCoroutineInvocation(node): + if not IsPossibleStartCoroutineInvocationForm(node): return - if method.IsStatic: return - tss = self.UnityScriptTypeSystem if not tss.IsScriptType(method.DeclaringType): return if not tss.IsGenerator(method): return + if CurrentMethod.IsStatic: + Warnings.Add(UnityScriptWarnings.CannotStartCoroutineFromStaticFunction(node.LexicalInfo, method.Name)) + return + parentNode = node.ParentNode parentNode.Replace( node, CodeBuilder.CreateMethodInvocation( - TargetForStartCoroutineInvocation(node, method), + CodeBuilder.CreateSelfReference(node.LexicalInfo, CurrentType), _StartCoroutine, - node)) - - def TargetForStartCoroutineInvocation(node as MethodInvocationExpression, method as IMethod): - target = cast(MemberReferenceExpression, node.Target).Target - if target isa SuperLiteralExpression: // super becomes self for coroutine invocation - return CodeBuilder.CreateSelfReference(target.LexicalInfo, method.DeclaringType) - return target.CloneNode() + node)) override def ProcessStaticallyTypedAssignment(node as BinaryExpression): TryToResolveAmbiguousAssignment(node) diff --git a/src/UnityScript/Steps/Utilities.boo b/src/UnityScript/Steps/Utilities.boo index f18038c..ae81266 100755 --- a/src/UnityScript/Steps/Utilities.boo +++ b/src/UnityScript/Steps/Utilities.boo @@ -16,6 +16,10 @@ def IsPossibleStartCoroutineInvocationForm(node as MethodInvocationExpression): match node: case Node(ParentNode: ExpressionStatement() | YieldStatement()) or IsRhsOfAssignment(node): return true + /* + case Node(ParentNode: DeclarationStatement(Initializer: initializer)) and node is initializer: + return true + */ otherwise: return false From 6dda4f4829c9bff04454cd95c162770810b9929b Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 3 Dec 2012 10:28:52 -0200 Subject: [PATCH 248/276] rename root project to avoid conflicts with src/UnityScript --- settings.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/settings.gradle b/settings.gradle index d00c426..be6b57e 100755 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,4 @@ +rootProject.name = 'bundle' def srcDir = file('src') srcDir.listFiles({ it.isDirectory() } as FileFilter).each { From af7c69d0051c7618f6b5785e9d616fa7518c18b9 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 3 Dec 2012 10:30:24 -0200 Subject: [PATCH 249/276] introduce publish task to upload only projects depended upon by the 'default' configuration --- build.gradle | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 0db8352..755e991 100755 --- a/build.gradle +++ b/build.gradle @@ -87,6 +87,7 @@ task bundle(type: Zip) { include 'license.txt' } -artifacts { - 'default' bundle +task publish { + dependsOn configurations['default'].dependencies*.dependencyProject.uploadArchives } + From b76bc612ffb6093f13df8f19c5e5755b6332b8d9 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 3 Dec 2012 10:31:24 -0200 Subject: [PATCH 250/276] all boo compilation tasks depend on the boo configuration --- build.gradle | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 755e991..17e8e7e 100755 --- a/build.gradle +++ b/build.gradle @@ -81,10 +81,12 @@ project(':UnityScript.Tests') { } } -task bundle(type: Zip) { - from projectDir - include 'README.md' - include 'license.txt' +def allCompileTasks = subprojects.collectMany { it.tasks }.findAll { it.name.startsWith('compile') } +def booCompileTasks = allCompileTasks.findAll { it.assembly.language == 'boo' } +booCompileTasks.each { + logger.info "Configuring boo dependencies on $it" + it.dependsOn rootProject.configurations.boo + it.dependsOn rootProject.tasks.updateBoo } task publish { From e72d726ba7e47de8ef8a34eec30cb9fd22050214 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 3 Dec 2012 10:32:09 -0200 Subject: [PATCH 251/276] code gardening --- build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 17e8e7e..fb34823 100755 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,10 @@ buildscript { } } +apply plugin: 'kaizen-bundle' +apply plugin: 'nunit' +apply plugin: 'idea' + allprojects { version = '0.1.1' @@ -18,10 +22,6 @@ allprojects { } } -apply plugin: 'kaizen-bundle' -apply plugin: 'nunit' -apply plugin: 'idea' - configurations { boo } From 983cc27da8758f72563e61b7c5dce956786ee61e Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 3 Dec 2012 10:32:51 -0200 Subject: [PATCH 252/276] all projects are published as part of the 'unityscript' group --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index fb34823..1191f41 100755 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,7 @@ apply plugin: 'nunit' apply plugin: 'idea' allprojects { + group = 'unityscript' version = '0.1.1' repositories { From 49f8471603f072353caf2b897de0d8f20f140bd7 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 3 Dec 2012 10:33:46 -0200 Subject: [PATCH 253/276] publish UnityScript.Lang version retargetd to wp8 --- build.gradle | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 1191f41..a5ad04d 100755 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'kaizen:kaizen:0.2.0' + classpath 'kaizen:kaizen:0.2.6' } } @@ -28,11 +28,12 @@ configurations { } ext { - booVersion = '0.9.5.6+' + booVersion = '0.9.5.7' } dependencies { boo "boo:boo:$booVersion" + boo "boo:RetargetAssembly:0.1.0" 'default' project(':us'), project(':UnityScript'), project(':UnityScript.Lang') } @@ -58,6 +59,18 @@ project(':UnityScript') { } project(':UnityScript.Lang') { + configurations { + windowsPhone8 + } + tasks.compileWindowsPhone8 { + doLast { + rootProject.exec { + executable rootProject.extensions.unity.monoBleedingEdge.cli + args 'lib/Boo/RetargetAssembly.exe' + args assemblyFile + } + } + } } project(':UnityScript.Tests.CSharp') { From a1c1efb4ac3358a88cab65b44c782c6facec2e5c Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 3 Dec 2012 10:48:31 -0200 Subject: [PATCH 254/276] UnityScript.Lang depends on Boo.Lang --- build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.gradle b/build.gradle index a5ad04d..c2b78a1 100755 --- a/build.gradle +++ b/build.gradle @@ -62,6 +62,10 @@ project(':UnityScript.Lang') { configurations { windowsPhone8 } + dependencies { + 'default' "boo:Boo.Lang:$booVersion" + //windowsPhone8 group: 'boo', name: 'Boo.Lang', version: booVersion, configuration: 'windowsPhone8' + } tasks.compileWindowsPhone8 { doLast { rootProject.exec { From 6e48ff133941179d75ba15a0970cdd83a24fafcf Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 2 Jan 2013 10:14:17 -0200 Subject: [PATCH 255/276] dependency on RetargetAssembly:0.2.0 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index c2b78a1..8cea907 100755 --- a/build.gradle +++ b/build.gradle @@ -33,7 +33,7 @@ ext { dependencies { boo "boo:boo:$booVersion" - boo "boo:RetargetAssembly:0.1.0" + boo "boo:RetargetAssembly:0.2.0" 'default' project(':us'), project(':UnityScript'), project(':UnityScript.Lang') } From b75c74ed6d87a307944e9d3ac2c3d248d0c68dee Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 25 Jan 2013 10:52:12 -0200 Subject: [PATCH 256/276] whitespace --- default.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.build b/default.build index c5cf12c..56edff2 100755 --- a/default.build +++ b/default.build @@ -31,7 +31,7 @@ - + From 564a1456127fefa0e3bbddc06382fae38e91a373 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 25 Jan 2013 11:07:51 -0200 Subject: [PATCH 257/276] ability to create a UnityScriptCompiler with a shared IReflectionTypeSystemProvider to avoid assembly loading overhead whenever possible --- src/UnityScript/UnityScriptCompiler.boo | 11 +++++++++-- src/UnityScript/UnityScriptCompilerParameters.boo | 13 ++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/UnityScript/UnityScriptCompiler.boo b/src/UnityScript/UnityScriptCompiler.boo index b08b739..d71ca54 100755 --- a/src/UnityScript/UnityScriptCompiler.boo +++ b/src/UnityScript/UnityScriptCompiler.boo @@ -5,8 +5,15 @@ import Boo.Lang.Compiler class UnityScriptCompiler: [getter(Parameters)] - _parameters = UnityScriptCompilerParameters() - _compiler = BooCompiler(_parameters) + _parameters as UnityScriptCompilerParameters + _compiler as BooCompiler + + def constructor(): + self(UnityScriptCompilerParameters()) + + def constructor([required] parameters as UnityScriptCompilerParameters): + _parameters = parameters + _compiler = BooCompiler(_parameters) def Run(): return _compiler.Run() diff --git a/src/UnityScript/UnityScriptCompilerParameters.boo b/src/UnityScript/UnityScriptCompilerParameters.boo index 6bf46d0..92b4b43 100755 --- a/src/UnityScript/UnityScriptCompilerParameters.boo +++ b/src/UnityScript/UnityScriptCompilerParameters.boo @@ -5,7 +5,7 @@ import Boo.Lang.Compiler import Boo.Lang.Compiler.Services import Boo.Lang.Compiler.TypeSystem import Boo.Lang.Compiler.TypeSystem.Services - +import Boo.Lang.Compiler.TypeSystem.Reflection import UnityScript.TypeSystem class UnityScriptCompilerParameters(CompilerParameters): @@ -25,9 +25,15 @@ class UnityScriptCompilerParameters(CompilerParameters): property DisableEval as string property TabSize = DefaultTabSize + + def constructor(): + self(true) def constructor(loadDefaultReferences as bool): - super(Boo.Lang.Compiler.TypeSystem.Reflection.ReflectionTypeSystemProvider(), loadDefaultReferences) + self(ReflectionTypeSystemProvider(), loadDefaultReferences) + + def constructor(reflectionTypeSystemProvider as IReflectionTypeSystemProvider, loadDefaultReferences as bool): + super(reflectionTypeSystemProvider, loadDefaultReferences) self.Checked = false self.OutputType = CompilerOutputType.Library self.Environment = DeferredEnvironment() { @@ -41,9 +47,6 @@ class UnityScriptCompilerParameters(CompilerParameters): self.References.Add(typeof(UnityScript.Lang.Array).Assembly) self.References.Add(GetType().Assembly) - def constructor(): - self(true) - def AddToEnvironment(serviceType as System.Type, factory as ObjectFactory): (Environment as DeferredEnvironment).Add(serviceType, factory) From 47d2a02384d2b44e138e71426cdb7b0d10fb3af8 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 25 Jan 2013 11:08:05 -0200 Subject: [PATCH 258/276] bump version number --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 8cea907..add062a 100755 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ apply plugin: 'idea' allprojects { group = 'unityscript' - version = '0.1.1' + version = '0.1.2' repositories { ivy { url 'http://unity-technologies.github.com/kaizen/repositories/unstable' } From d3193e2f433b6ad92cb9f4cb43fd5745237d4f67 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Fri, 25 Jan 2013 11:52:16 -0200 Subject: [PATCH 259/276] UnityScript depends on Boo.Lang.Useful --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index add062a..019f467 100755 --- a/build.gradle +++ b/build.gradle @@ -52,7 +52,7 @@ project(':us') { project(':UnityScript') { dependencies { 'default' project(':UnityScript.Lang') - ['Boo.Lang.Extensions', 'Boo.Lang.Parser', 'Boo.Lang.Compiler', 'Boo.Lang.PatternMatching'].each { + ['Boo.Lang.Extensions', 'Boo.Lang.Parser', 'Boo.Lang.Compiler', 'Boo.Lang.PatternMatching', 'Boo.Lang.Useful'].each { 'default' "boo:$it:$booVersion" } } From b2583349e562e213f65bca5a69ae9e905bdb8ac2 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 31 Jan 2013 15:30:31 -0200 Subject: [PATCH 260/276] Revert "don't depend on System.Collections.CollectionBase for it has been removed from newer .net profiles" This reverts commit 3fad646617617dc842599a0bc08934bc1c69fc49. --- src/UnityScript.Lang/Array.boo | 73 ++++++++++------------------------ 1 file changed, 21 insertions(+), 52 deletions(-) diff --git a/src/UnityScript.Lang/Array.boo b/src/UnityScript.Lang/Array.boo index 419a013..baa6f01 100755 --- a/src/UnityScript.Lang/Array.boo +++ b/src/UnityScript.Lang/Array.boo @@ -3,9 +3,7 @@ namespace UnityScript.Lang import System import System.Collections -class Array(IList, Boo.Lang.Runtime.ICoercible): - - InnerList = System.Collections.Generic.List of object() +class Array(CollectionBase, Boo.Lang.Runtime.ICoercible): def constructor(): pass @@ -24,47 +22,6 @@ class Array(IList, Boo.Lang.Runtime.ICoercible): AddRange(items[0]) else: AddRange(items) - - def GetEnumerator(): - return InnerList.GetEnumerator() - - def CopyTo(target as System.Array, targetIndex as int): - elementType = target.GetType().GetElementType() - elementsToCopy = Math.Min(len(target) - targetIndex, Count) - sourceIndex = 0 - while sourceIndex < elementsToCopy: - rawArrayIndexing: - target[targetIndex++] = Boo.Lang.Runtime.RuntimeServices.Coerce(InnerList[sourceIndex++], elementType) - - Count: - get: return InnerList.Count - - ICollection.IsSynchronized: - get: return false - - ICollection.SyncRoot: - get: return self - - def Clear(): - InnerList.Clear() - - def Contains(o): - return InnerList.Contains(o) - - def IndexOf(o): - return InnerList.IndexOf(o) - - def Insert(index as int, element): - InnerList.Insert(index, element) - - def RemoveAt(index as int): - InnerList.RemoveAt(index) - - IList.IsReadOnly: - get: return false - - IList.IsFixedSize: - get: return false static def op_Implicit(e as IEnumerable) as Array: if e is null: return null @@ -91,9 +48,7 @@ class Array(IList, Boo.Lang.Runtime.ICoercible): return self def ToBuiltin(type as System.Type): - result = System.Array.CreateInstance(type, Count) - CopyTo(result, 0) - return result + return self.InnerList.ToArray(type) def Add(value as object, *items): self.AddImpl(value, items) @@ -188,8 +143,15 @@ class Array(IList, Boo.Lang.Runtime.ICoercible): callable Comparison(lhs as object, rhs as object) as int + private class ComparisonComparer(IComparer): + def constructor(comparison as Comparison): + _comparison = comparison + def Compare(lhs, rhs): + return _comparison(lhs, rhs) + _comparison as Comparison + def Sort(comparison as Comparison): - self.InnerList.Sort({ x, y | comparison(x, y) }) + self.InnerList.Sort(ComparisonComparer(comparison)) def sort(comparison as Comparison): Sort(comparison) @@ -200,14 +162,15 @@ class Array(IList, Boo.Lang.Runtime.ICoercible): return self def sort() as Array: - return self.Sort() + self.Sort() + return self # Combine to a string def Join (seperator as String): return Builtins.join(self.InnerList, seperator) def join (seperator as String): - return self.Join(seperator) + return Builtins.join(self.InnerList, seperator) # Remove def Remove (obj as Object): @@ -226,9 +189,13 @@ class Array(IList, Boo.Lang.Runtime.ICoercible): def AddRange([required] collection as IEnumerable): for item in collection: self.InnerList.Add(item) + + override protected def OnValidate(newValue): + pass // anything goes private def AddImpl(value as object, [required] items as IEnumerable): self.InnerList.Add(value) + for item in items: self.InnerList.Add(item) return self.InnerList.Count @@ -245,9 +212,11 @@ class Array(IList, Boo.Lang.Runtime.ICoercible): private def ConcatImpl(value as ICollection, [required] items as IEnumerable): arr = Array (self.InnerList) - arr.AddRange(value) + arr.InnerList.AddRange(value) + for item as ICollection in items: - arr.AddRange(item) + arr.InnerList.AddRange(item) + return arr private def EnsureCapacity(capacity as int): From e9f84b99d4e8c72fb501feb69cecc0c5f8c3f21c Mon Sep 17 00:00:00 2001 From: Tak Date: Thu, 21 Feb 2013 15:54:54 +0100 Subject: [PATCH 261/276] Sign unityscript assemblies. --- default.build | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/default.build b/default.build index 56edff2..f93256b 100755 --- a/default.build +++ b/default.build @@ -41,6 +41,17 @@ + + + + + + + + + + + @@ -84,6 +95,7 @@ @@ -137,6 +149,7 @@ target="library" output="${build.dir}/UnityScript.Lang.dll" debug="${debug}" + keyfile="${keyfile.path}" noconfig="true"> @@ -146,6 +159,7 @@ @@ -162,6 +176,7 @@ @@ -174,6 +189,7 @@ + From 4f917e1cddacdef24f46a56d555d7d49939ba226 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Wed, 13 Mar 2013 07:18:03 -0300 Subject: [PATCH 262/276] update to boo 0.9.6 --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 019f467..50dee02 100755 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ apply plugin: 'idea' allprojects { group = 'unityscript' - version = '0.1.2' + version = '0.1.3' repositories { ivy { url 'http://unity-technologies.github.com/kaizen/repositories/unstable' } @@ -28,7 +28,7 @@ configurations { } ext { - booVersion = '0.9.5.7' + booVersion = '0.9.6' } dependencies { From 1d96fb0c5046fec523767ba8a0c87557047f17bc Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 25 Mar 2013 16:20:04 -0300 Subject: [PATCH 263/276] upgrade to boo 0.9.7 and bump version number --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 50dee02..cabf3c1 100755 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ apply plugin: 'idea' allprojects { group = 'unityscript' - version = '0.1.3' + version = '0.1.4' repositories { ivy { url 'http://unity-technologies.github.com/kaizen/repositories/unstable' } @@ -28,12 +28,12 @@ configurations { } ext { - booVersion = '0.9.6' + booVersion = '0.9.7' } dependencies { boo "boo:boo:$booVersion" - boo "boo:RetargetAssembly:0.2.0" + boo "boo:RetargetAssembly:0.2.1" 'default' project(':us'), project(':UnityScript'), project(':UnityScript.Lang') } From 8c41f63706858b643df2a4e34c27c3b4c2db5458 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 4 Apr 2013 13:18:25 -0300 Subject: [PATCH 264/276] code gardening --- src/UnityScript/Steps/ProcessUnityScriptMethods.boo | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo index 632b235..68ec27a 100755 --- a/src/UnityScript/Steps/ProcessUnityScriptMethods.boo +++ b/src/UnityScript/Steps/ProcessUnityScriptMethods.boo @@ -34,11 +34,11 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): super(context) // don't transform - // foo == null + // foo == null // into: - // foo is null + // foo is null // but into: - // foo.Equals(null) + // foo.Equals(null) self.OptimizeNullComparisons = false def ResolveUnityRuntimeMethod(name as string): @@ -70,7 +70,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): return null return super(d) - override def OnModule(module as Module): + override def OnModule(module as Module): ActiveModule = module super(module) @@ -192,7 +192,7 @@ class ProcessUnityScriptMethods(ProcessMethodBodiesWithDuckTyping): CodeBuilder.CreateMethodInvocation( CodeBuilder.CreateSelfReference(node.LexicalInfo, CurrentType), _StartCoroutine, - node)) + node)) override def ProcessStaticallyTypedAssignment(node as BinaryExpression): TryToResolveAmbiguousAssignment(node) From bc25aad37d96eb3aa95150227ec3af19e47a9938 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 4 Apr 2013 13:19:57 -0300 Subject: [PATCH 265/276] test case for yield null (case 494359) --- .../DuckyIntegrationTestFixture.boo | 2 ++ .../StrictIntegrationTestFixture.Generated.boo | 4 ++++ tests/integration/yield-null.js | 15 +++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 tests/integration/yield-null.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index fb30188..9d03288 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -626,6 +626,8 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/vars-1.js") + [Test] def yield_null(): + RunTestCase("tests/integration/yield-null.js") [Test] def Array_cast_to_native_array_of_struct(): RunTestCase("tests/ducky/Array-cast-to-native-array-of-struct.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo index 21f2363..cde109c 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo @@ -622,4 +622,8 @@ partial class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): [Test] def vars_1(): RunTestCase("tests/integration/vars-1.js") + + + [Test] def yield_null(): + RunTestCase("tests/integration/yield-null.js") \ No newline at end of file diff --git a/tests/integration/yield-null.js b/tests/integration/yield-null.js new file mode 100644 index 0000000..e056e45 --- /dev/null +++ b/tests/integration/yield-null.js @@ -0,0 +1,15 @@ +/* +before +after +*/ + +function generator() { + print("before"); + yield null; + print("after"); +} + +for (var e in generator()) { + if (e != null) + throw "expected null"; +} From 4e71aaa296790b2709610565b1e37adcaa1e100f Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 4 Apr 2013 14:24:20 -0300 Subject: [PATCH 266/276] set Module.Name even when the file is completely empty (fixes case 501164) --- src/UnityScript.Tests/ParserTestFixture.boo | 5 ++++- src/UnityScript/Parser/CodeFactory.boo | 6 ++++++ src/UnityScript/Parser/UnityScriptParser.boo | 6 +----- src/UnityScript/Parser/UnityScriptParserExtensions.boo | 2 +- src/UnityScript/UnityScript.g | 6 +----- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/UnityScript.Tests/ParserTestFixture.boo b/src/UnityScript.Tests/ParserTestFixture.boo index 70ed88b..84c0853 100755 --- a/src/UnityScript.Tests/ParserTestFixture.boo +++ b/src/UnityScript.Tests/ParserTestFixture.boo @@ -18,6 +18,9 @@ partial class ParserTestFixture(AbstractCompilerTestFixture): result = CompileTestCase(StringInput("empty", "")) Assert.AreEqual(0, len(result.Errors), result.Errors.ToString(true)) Assert.AreEqual(1, len(result.CompileUnit.Modules)) - Assert.AreEqual("empty", result.CompileUnit.Modules[0].LexicalInfo.FileName) + + module = result.CompileUnit.Modules[0] + Assert.AreEqual("empty", module.Name) + Assert.AreEqual("empty", module.LexicalInfo.FileName) diff --git a/src/UnityScript/Parser/CodeFactory.boo b/src/UnityScript/Parser/CodeFactory.boo index 7ac9aa2..8e7fb01 100755 --- a/src/UnityScript/Parser/CodeFactory.boo +++ b/src/UnityScript/Parser/CodeFactory.boo @@ -5,6 +5,9 @@ import Boo.Lang.Compiler.Ast static class CodeFactory: + def NewModule(fileName as string): + return Module(LexicalInfo(fileName, 1, 1), Name: ModuleNameFromFileName(fileName)) + def NewArrayComprehension(location as LexicalInfo, projection as Expression, variable as Declaration, expression as Expression, filter as Expression): ge = GeneratorExpression(location, Expression: projection, Iterator: expression) ge.Declarations.Add(variable) @@ -35,3 +38,6 @@ static class CodeFactory: def WithLocation[of T(Node)](node as T, location as LexicalInfo): node.LexicalInfo = location return node + +def ModuleNameFromFileName(fname as string): + return System.IO.Path.GetFileNameWithoutExtension(fname) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index b958151..65d58c0 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -253,9 +253,6 @@ partial class UnityScriptParser(antlr.LLkParser): li = ToLexicalInfo(LT(1)) ReportError(UnityScriptCompilerErrors.SemicolonExpected(li)) - static def CreateModuleName(fname as string): - return System.IO.Path.GetFileNameWithoutExtension(fname) - static def IsConstructorName(name as string, type as TypeDefinition): return type.NodeType != NodeType.Module and name == type.Name @@ -322,8 +319,7 @@ partial class UnityScriptParser(antlr.LLkParser): ) as void: //throws RecognitionException, TokenStreamException eof as IToken = null - module = Module(LexicalInfo(getFilename(), 1, 1)) - module.Name = CreateModuleName(getFilename()) + module = CodeFactory.NewModule(getFilename()) cu.Modules.Add(module) globals = module.Globals diff --git a/src/UnityScript/Parser/UnityScriptParserExtensions.boo b/src/UnityScript/Parser/UnityScriptParserExtensions.boo index 4c1d68c..c884552 100755 --- a/src/UnityScript/Parser/UnityScriptParserExtensions.boo +++ b/src/UnityScript/Parser/UnityScriptParserExtensions.boo @@ -10,7 +10,7 @@ partial class UnityScriptParser: static def ParseReader(reader as TextReader, fileName as string, context as CompilerContext, targetCompileUnit as CompileUnit): lexer = UnityScriptLexerFor(reader, fileName, TabSizeFromContext(context)) if lexer is null: - targetCompileUnit.Modules.Add(Module(LexicalInfo(fileName, 1, 1))) + targetCompileUnit.Modules.Add(CodeFactory.NewModule(fileName)) return parser = UnityScriptParser(lexer, CompilerContext: context) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index be1228e..266b385 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -231,9 +231,6 @@ tokens li = ToLexicalInfo(LT(1)) ReportError(UnityScriptCompilerErrors.SemicolonExpected(li)) - static def CreateModuleName(fname as string): - return System.IO.Path.GetFileNameWithoutExtension(fname) - static def IsConstructorName(name as string, type as TypeDefinition): return type.NodeType != NodeType.Module and name == type.Name @@ -276,8 +273,7 @@ tokens start[CompileUnit cu] { - module = Module(LexicalInfo(getFilename(), 1, 1)) - module.Name = CreateModuleName(getFilename()) + module = CodeFactory.NewModule(getFilename()) cu.Modules.Add(module) globals = module.Globals }: From 0fe15149f6d279920fc0e66a4743673a7f24e23c Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 4 Apr 2013 15:03:49 -0300 Subject: [PATCH 267/276] Revert "Sign unityscript assemblies." This reverts commit e9f84b99d4e8c72fb501feb69cecc0c5f8c3f21c. --- default.build | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/default.build b/default.build index f93256b..56edff2 100755 --- a/default.build +++ b/default.build @@ -41,17 +41,6 @@ - - - - - - - - - - - @@ -95,7 +84,6 @@ @@ -149,7 +137,6 @@ target="library" output="${build.dir}/UnityScript.Lang.dll" debug="${debug}" - keyfile="${keyfile.path}" noconfig="true"> @@ -159,7 +146,6 @@ @@ -176,7 +162,6 @@ @@ -189,7 +174,6 @@ - From d6241af80206c746df2245bbad1d58521217cdb7 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 4 Apr 2013 17:13:13 -0300 Subject: [PATCH 268/276] emit error for property setter declaring return type (fixes case 495977) --- .../ErrorMessagesTestFixture.Generated.boo | 8 ++++ .../Core/UnityScriptCompilerErrors.boo | 3 ++ src/UnityScript/Parser/UnityScriptParser.boo | 17 -------- src/UnityScript/Steps/Parse.boo | 43 ++++++++++++++++++- src/UnityScript/UnityScript.g | 15 ------- .../invalid-setter-return-type.js | 6 +++ tests/error-messages/invalid-setter.js | 6 +++ 7 files changed, 65 insertions(+), 33 deletions(-) create mode 100644 tests/error-messages/invalid-setter-return-type.js create mode 100644 tests/error-messages/invalid-setter.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index e2ebae5..49b5748 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -98,6 +98,14 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/invalid-generator-return-type.js") + [Test] def invalid_setter_return_type(): + RunTestCase("tests/error-messages/invalid-setter-return-type.js") + + + [Test] def invalid_setter(): + RunTestCase("tests/error-messages/invalid-setter.js") + + [Test] def iterator_warning(): RunTestCase("tests/error-messages/iterator-warning.js") diff --git a/src/UnityScript/Core/UnityScriptCompilerErrors.boo b/src/UnityScript/Core/UnityScriptCompilerErrors.boo index bc86aaa..a47fabd 100755 --- a/src/UnityScript/Core/UnityScriptCompilerErrors.boo +++ b/src/UnityScript/Core/UnityScriptCompilerErrors.boo @@ -28,6 +28,9 @@ static class UnityScriptCompilerErrors: def EvalHasBeenDisabled(location as LexicalInfo, reason as string): return CreateError("UCE0008", location, reason) + def SetterCanNotDeclareReturnType(location as LexicalInfo): + return CreateError("UCE0009", location, "Property setter can not declare return type.") + private def CreateError(code as string, location as LexicalInfo, message as string): return Boo.Lang.Compiler.CompilerError(code, location, message, null) diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index 65d58c0..ab28852 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -278,19 +278,6 @@ partial class UnityScriptParser(antlr.LLkParser): type.Members.Add(function) FlushAttributes(function) return function - - def ValidateFunctionDeclaration(function as Method, getter as IToken, setter as IToken): - // TODO: move this error checking to a compiler step - // as well as properly checking the type of the accessors - // against the type of the property - if setter is not null: - if function.Parameters.Count != 1 or function.Parameters[0].Name != "value": - ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(function.LexicalInfo)) - function.Parameters.Clear() - return - if getter is not null: - if function.Parameters.Count > 0: - ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(function.LexicalInfo)) protected def initialize(): tokenNames = tokenNames_ @@ -1223,8 +1210,6 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: member = function = AddFunctionTo(cd, memberName, getter, setter) function_body(function) - if 0 == inputState.guessing: - ValidateFunctionDeclaration(function, getter, setter) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) @@ -1547,8 +1532,6 @@ partial class UnityScriptParser(antlr.LLkParser): else: // line 1969 raise NoViableAltException(LT(1), getFilename()) match(RPAREN) - if 0 == inputState.guessing: - ValidateFunctionDeclaration(function, getter, setter) _givenValue = LA(1) if ((_givenValue == COLON)): // 1831 match(COLON) diff --git a/src/UnityScript/Steps/Parse.boo b/src/UnityScript/Steps/Parse.boo index 2de6259..0482aca 100644 --- a/src/UnityScript/Steps/Parse.boo +++ b/src/UnityScript/Steps/Parse.boo @@ -2,18 +2,59 @@ namespace UnityScript.Steps import System import Boo.Lang.Compiler +import Boo.Lang.Compiler.Ast import Boo.Lang.Compiler.Steps +import UnityScript.Core import UnityScript.Parser class Parse(AbstractCompilerStep): override def Run(): + ParseInputs() + NormalizePropertyAccessors() + + private def ParseInputs(): for input in self.Parameters.Input: try: ParseInput(input) except x: Errors.Add(CompilerErrorFactory.InputError(input.Name, x)) + + private def NormalizePropertyAccessors(): + CompileUnit.Accept(PropertyAccessorNormalizer(Errors: Errors)) private def ParseInput(input as ICompilerInput): using reader = input.Open(): - UnityScriptParser.ParseReader(reader, input.Name, self.Context, self.CompileUnit) \ No newline at end of file + UnityScriptParser.ParseReader(reader, input.Name, self.Context, self.CompileUnit) + + class PropertyAccessorNormalizer(FastDepthFirstVisitor): + property Errors as CompilerErrorCollection + + override def OnProperty(node as Property): + NormalizeSetter node.Setter + NormalizeGetter node.Getter + + def NormalizeSetter(setter as Method): + if setter is null: + return + NormalizeSetterParameters setter + CheckSetterReturnType setter + + def NormalizeSetterParameters(setter as Method): + if setter.Parameters.Count != 1 or setter.Parameters[0].Name != "value": + ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(setter.LexicalInfo)) + return + setter.Parameters.Clear() + + def CheckSetterReturnType(setter as Method): + if setter.ReturnType is null: + return + ReportError(UnityScriptCompilerErrors.SetterCanNotDeclareReturnType(setter.ReturnType.LexicalInfo)) + + def NormalizeGetter(getter as Method): + if getter is null or getter.Parameters.Count == 0: + return + ReportError(UnityScriptCompilerErrors.InvalidPropertyGetter(getter.LexicalInfo)) + + def ReportError(error as CompilerError): + Errors.Add(error) diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index 266b385..a7727ae 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -256,19 +256,6 @@ tokens type.Members.Add(function) FlushAttributes(function) return function - - def ValidateFunctionDeclaration(function as Method, getter as IToken, setter as IToken): - // TODO: move this error checking to a compiler step - // as well as properly checking the type of the accessors - // against the type of the property - if setter is not null: - if function.Parameters.Count != 1 or function.Parameters[0].Name != "value": - ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(function.LexicalInfo)) - function.Parameters.Clear() - return - if getter is not null: - if function.Parameters.Count > 0: - ReportError(UnityScriptCompilerErrors.InvalidPropertySetter(function.LexicalInfo)) } start[CompileUnit cu] @@ -554,7 +541,6 @@ interface_member[TypeDefinition parent] function = AddFunctionTo(parent, memberName, getter, setter) } LPAREN (parameter_declaration_list[function])? RPAREN - { ValidateFunctionDeclaration(function, getter, setter) } ( COLON tr=type_reference { function.ReturnType = tr; } )? @@ -625,7 +611,6 @@ function_member[TypeDefinition cd] returns [TypeMember member] FUNCTION (getter:GET | setter:SET)? memberName=identifier { member = function = AddFunctionTo(cd, memberName, getter, setter) } function_body[function] - { ValidateFunctionDeclaration(function, getter, setter) } ; function_body[Method method] diff --git a/tests/error-messages/invalid-setter-return-type.js b/tests/error-messages/invalid-setter-return-type.js new file mode 100644 index 0000000..4b108d9 --- /dev/null +++ b/tests/error-messages/invalid-setter-return-type.js @@ -0,0 +1,6 @@ +/* +invalid-setter-return-type.js(4,30): UCE0009: Property setter can not declare return type. +*/ +function set invalid(value): Object { + print('wut?'); +} diff --git a/tests/error-messages/invalid-setter.js b/tests/error-messages/invalid-setter.js new file mode 100644 index 0000000..1e07e23 --- /dev/null +++ b/tests/error-messages/invalid-setter.js @@ -0,0 +1,6 @@ +/* +invalid-setter.js(4,14): UCE0003: Property setter must have a single argument named 'value'. +*/ +function set invalid() { + print('wut?'); +} From a4926a9c9e514d8647d31a6b273a07d1dade2fff Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 4 Apr 2013 17:38:14 -0300 Subject: [PATCH 269/276] test case for empty map literals --- tests/parser/empty-map-literal.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/parser/empty-map-literal.js diff --git a/tests/parser/empty-map-literal.js b/tests/parser/empty-map-literal.js new file mode 100644 index 0000000..61fc0d0 --- /dev/null +++ b/tests/parser/empty-map-literal.js @@ -0,0 +1,7 @@ +/* +def f(): + return {} +*/ +function f() { + return {}; +} From c7c3ead0410f71356ce8e1b663f163c6035e93ee Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 4 Apr 2013 17:40:33 -0300 Subject: [PATCH 270/276] allow empty blocks (fixes case 487547) --- .../ParserTestFixture.Generated.boo | 8 + src/UnityScript/Parser/UnityScriptParser.boo | 420 +++++++++--------- src/UnityScript/UnityScript.g | 4 +- tests/parser/empty-blocks.js | 10 + 4 files changed, 230 insertions(+), 212 deletions(-) create mode 100644 tests/parser/empty-blocks.js diff --git a/src/UnityScript.Tests/ParserTestFixture.Generated.boo b/src/UnityScript.Tests/ParserTestFixture.Generated.boo index 12a967f..f45e7b8 100644 --- a/src/UnityScript.Tests/ParserTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ParserTestFixture.Generated.boo @@ -50,6 +50,14 @@ partial class ParserTestFixture: RunTestCase("tests/parser/do-while-false.js") + [Test] def empty_blocks(): + RunTestCase("tests/parser/empty-blocks.js") + + + [Test] def empty_map_literal(): + RunTestCase("tests/parser/empty-map-literal.js") + + [Test] def enums(): RunTestCase("tests/parser/enums.js") diff --git a/src/UnityScript/Parser/UnityScriptParser.boo b/src/UnityScript/Parser/UnityScriptParser.boo index ab28852..119e842 100755 --- a/src/UnityScript/Parser/UnityScriptParser.boo +++ b/src/UnityScript/Parser/UnityScriptParser.boo @@ -360,7 +360,7 @@ partial class UnityScriptParser(antlr.LLkParser): elif ((tokenSet_0_.member(cast(int, LA(1)))) and (tokenSet_1_.member(cast(int, LA(2))))): // line 2102 module_member(module) elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_3_.member(cast(int, LA(2))))): // line 2102 - statement(globals) + compound_or_single_stmt(globals) else: goto _loop10_breakloop :_loop10_breakloop @@ -532,45 +532,22 @@ partial class UnityScriptParser(antlr.LLkParser): else: raise - public def statement( + public def compound_or_single_stmt( b as Block ) as void: //throws RecognitionException, TokenStreamException try: // for error handling - synPredMatched107 as bool = false - if ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): - _m107 as int = mark() - synPredMatched107 = true - ++inputState.guessing - try: - macro_application_test() - except x as RecognitionException: - synPredMatched107 = false - rewind(_m107) - --inputState.guessing - if synPredMatched107: - macro_application_block(b) - elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 - builtin_statement(b) - elif ((LA(1)==EOS)): // line 2102 - _cnt109 as int = 0 - while true: - if ((LA(1)==EOS) and (tokenSet_17_.member(cast(int, LA(2))))): - match(EOS) - else: - if (_cnt109 >= 1): - goto _loop109_breakloop - else: - raise NoViableAltException(LT(1), getFilename()) - ++_cnt109 - :_loop109_breakloop + if ((LA(1)==LBRACE) and (tokenSet_13_.member(cast(int, LA(2))))): + compound_statement(b) + elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + statement(b) else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -598,7 +575,7 @@ partial class UnityScriptParser(antlr.LLkParser): value=expression() if 0 == inputState.guessing: attr.NamedArguments.Add(ExpressionPair(name, value)) - elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): // line 2102 value=expression() if 0 == inputState.guessing: attr.Arguments.Add(value) @@ -607,7 +584,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_18_) else: raise @@ -627,7 +604,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_20_) + recover(ex,tokenSet_19_) else: raise return e @@ -641,7 +618,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -657,7 +634,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_22_) + recover(ex,tokenSet_21_) else: raise @@ -669,7 +646,7 @@ partial class UnityScriptParser(antlr.LLkParser): name=qname() if 0 == inputState.guessing: attr = Ast.Attribute(ToLexicalInfo(name), name.getText()) - if ((LA(1)==LPAREN) and (tokenSet_23_.member(cast(int, LA(2))))): + if ((LA(1)==LPAREN) and (tokenSet_22_.member(cast(int, LA(2))))): match(LPAREN) _givenValue = LA(1) if ((_givenValue == EACH) @@ -710,14 +687,14 @@ partial class UnityScriptParser(antlr.LLkParser): else: // line 1969 raise NoViableAltException(LT(1), getFilename()) match(RPAREN) - elif ((tokenSet_24_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_23_.member(cast(int, LA(1)))) and (tokenSet_24_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_24_) + recover(ex,tokenSet_23_) else: raise return attr @@ -751,7 +728,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_26_) + recover(ex,tokenSet_25_) else: raise return id @@ -800,7 +777,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_27_) + recover(ex,tokenSet_26_) else: raise return m @@ -901,7 +878,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -911,10 +888,10 @@ partial class UnityScriptParser(antlr.LLkParser): t as IToken = null try: // for error handling - if ((LA(1)==EOS) and (tokenSet_28_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_27_.member(cast(int, LA(2))))): _cnt42 as int = 0 while true: - if ((LA(1)==EOS) and (tokenSet_28_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_27_.member(cast(int, LA(2))))): t = LT(1) match(EOS) if 0 == inputState.guessing: @@ -926,7 +903,7 @@ partial class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) ++_cnt42 :_loop42_breakloop - elif ((tokenSet_28_.member(cast(int, LA(1)))) and (tokenSet_29_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_27_.member(cast(int, LA(1)))) and (tokenSet_28_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: SemicolonExpected() else: @@ -934,7 +911,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_28_) + recover(ex,tokenSet_27_) else: raise return firstEOS @@ -994,7 +971,7 @@ partial class UnityScriptParser(antlr.LLkParser): BaseTypeAnnotations.AnnotateImplements(typeRef) match(LBRACE) while true: - if ((tokenSet_30_.member(cast(int, LA(1))))): + if ((tokenSet_29_.member(cast(int, LA(1))))): if 0 == inputState.guessing: mod = TypeMemberModifiers.None _givenValue = LA(1) @@ -1019,9 +996,9 @@ partial class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((tokenSet_31_.member(cast(int, LA(1)))) and (tokenSet_32_.member(cast(int, LA(2))))): + if ((tokenSet_30_.member(cast(int, LA(1)))) and (tokenSet_31_.member(cast(int, LA(2))))): mod=member_modifiers() - elif ((tokenSet_27_.member(cast(int, LA(1)))) and (tokenSet_33_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_26_.member(cast(int, LA(1)))) and (tokenSet_32_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -1050,7 +1027,7 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: SetEndSourceLocation(cd, rbrace) while true: - if ((LA(1)==EOS) and (tokenSet_34_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_33_.member(cast(int, LA(2))))): match(EOS) else: goto _loop59_breakloop @@ -1058,7 +1035,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_34_) + recover(ex,tokenSet_33_) else: raise return member @@ -1107,7 +1084,7 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: SetEndSourceLocation(td, rbrace) while true: - if ((LA(1)==EOS) and (tokenSet_34_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_33_.member(cast(int, LA(2))))): match(EOS) else: goto _loop66_breakloop @@ -1115,7 +1092,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_34_) + recover(ex,tokenSet_33_) else: raise return member @@ -1146,7 +1123,7 @@ partial class UnityScriptParser(antlr.LLkParser): ): // 1827 enum_member(ed) while true: - if ((LA(1)==COMMA) and (tokenSet_35_.member(cast(int, LA(2))))): + if ((LA(1)==COMMA) and (tokenSet_34_.member(cast(int, LA(2))))): match(COMMA) enum_member(ed) else: @@ -1168,7 +1145,7 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: SetEndSourceLocation(ed, rbrace) while true: - if ((LA(1)==EOS) and (tokenSet_34_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_33_.member(cast(int, LA(2))))): match(EOS) else: goto _loop79_breakloop @@ -1176,7 +1153,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_34_) + recover(ex,tokenSet_33_) else: raise return member @@ -1213,7 +1190,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_34_) + recover(ex,tokenSet_33_) else: raise return member @@ -1364,7 +1341,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_34_) + recover(ex,tokenSet_33_) else: raise return member @@ -1421,7 +1398,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_27_) + recover(ex,tokenSet_26_) else: raise return m @@ -1454,14 +1431,14 @@ partial class UnityScriptParser(antlr.LLkParser): match(RBRACK) if 0 == inputState.guessing: tr = ArrayTypeReference(tr.LexicalInfo, tr, IntegerLiteralExpression(ToLexicalInfo(lbrack), rank)) - elif ((tokenSet_36_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_35_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_35_) else: raise return tr @@ -1487,7 +1464,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_37_) + recover(ex,tokenSet_36_) else: raise @@ -1555,7 +1532,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_38_) + recover(ex,tokenSet_37_) else: raise @@ -1594,7 +1571,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_39_) + recover(ex,tokenSet_38_) else: raise return token @@ -1616,7 +1593,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_40_) + recover(ex,tokenSet_39_) else: raise @@ -1655,7 +1632,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_41_) + recover(ex,tokenSet_40_) else: raise @@ -1683,7 +1660,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -1724,7 +1701,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_34_) + recover(ex,tokenSet_33_) else: raise @@ -1736,7 +1713,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling block(b) while true: - if ((LA(1)==EOS) and (tokenSet_42_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_41_.member(cast(int, LA(2))))): match(EOS) else: goto _loop101_breakloop @@ -1744,7 +1721,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_42_) + recover(ex,tokenSet_41_) else: raise @@ -1783,26 +1760,49 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_19_) + recover(ex,tokenSet_18_) else: raise - public def compound_or_single_stmt( + public def statement( b as Block ) as void: //throws RecognitionException, TokenStreamException try: // for error handling - if ((LA(1)==LBRACE) and (tokenSet_43_.member(cast(int, LA(2))))): - compound_statement(b) - elif ((tokenSet_2_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 - statement(b) + synPredMatched107 as bool = false + if ((tokenSet_42_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): + _m107 as int = mark() + synPredMatched107 = true + ++inputState.guessing + try: + macro_application_test() + except x as RecognitionException: + synPredMatched107 = false + rewind(_m107) + --inputState.guessing + if synPredMatched107: + macro_application_block(b) + elif ((tokenSet_43_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + builtin_statement(b) + elif ((LA(1)==EOS)): // line 2102 + _cnt109 as int = 0 + while true: + if ((LA(1)==EOS) and (tokenSet_15_.member(cast(int, LA(2))))): + match(EOS) + else: + if (_cnt109 >= 1): + goto _loop109_breakloop + else: + raise NoViableAltException(LT(1), getFilename()) + ++_cnt109 + :_loop109_breakloop else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -1816,7 +1816,7 @@ partial class UnityScriptParser(antlr.LLkParser): match(LBRACE) while true: if ((tokenSet_2_.member(cast(int, LA(1))))): - statement(b) + compound_or_single_stmt(b) else: goto _loop104_breakloop :_loop104_breakloop @@ -1827,7 +1827,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise @@ -1835,10 +1835,10 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling - if ((tokenSet_13_.member(cast(int, LA(1)))) and (LA(2)==LBRACE)): + if ((tokenSet_42_.member(cast(int, LA(1)))) and (LA(2)==LBRACE)): member() match(LBRACE) - elif ((tokenSet_13_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_42_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 member() expression_list(null) match(LBRACE) @@ -1862,7 +1862,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling macroName=member() synPredMatched148 as bool = false - if ((LA(1)==LBRACE) and (tokenSet_43_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_13_.member(cast(int, LA(2))))): _m148 as int = mark() synPredMatched148 = true ++inputState.guessing @@ -1874,7 +1874,7 @@ partial class UnityScriptParser(antlr.LLkParser): --inputState.guessing if synPredMatched148: compound_statement(b) - elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_44_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_44_.member(cast(int, LA(2))))): // line 2102 expression_list(args) compound_statement(b) else: @@ -1886,7 +1886,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -1997,7 +1997,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -2027,7 +2027,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -2052,7 +2052,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -2107,7 +2107,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -2133,14 +2133,14 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: b = s.FalseBlock = Block(ToLexicalInfo(et)) compound_or_single_stmt(b) - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_20_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -2190,14 +2190,14 @@ partial class UnityScriptParser(antlr.LLkParser): :_loop167_breakloop if ((LA(1)==FINALLY) and (tokenSet_2_.member(cast(int, LA(2))))): finally_block(s) - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_20_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -2282,7 +2282,7 @@ partial class UnityScriptParser(antlr.LLkParser): raise NoViableAltException(LT(1), getFilename()) match(RBRACE) while true: - if ((LA(1)==EOS) and (tokenSet_17_.member(cast(int, LA(2))))): + if ((LA(1)==EOS) and (tokenSet_15_.member(cast(int, LA(2))))): match(EOS) else: goto _loop163_breakloop @@ -2290,7 +2290,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -2306,7 +2306,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -2319,9 +2319,9 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling yt = LT(1) match(YIELD) - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): + if ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_20_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -2330,7 +2330,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -2343,9 +2343,9 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling ret = LT(1) match(RETURN) - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): + if ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_20_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -2354,7 +2354,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -2372,7 +2372,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -2395,7 +2395,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -2408,9 +2408,9 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling t = LT(1) match(THROW) - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): + if ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_49_.member(cast(int, LA(2))))): e=expression() - elif ((tokenSet_17_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_15_.member(cast(int, LA(1)))) and (tokenSet_20_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -2419,7 +2419,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -2705,7 +2705,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise return stmt @@ -2837,7 +2837,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise return stmt @@ -2877,7 +2877,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return name @@ -2888,7 +2888,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_18_.member(cast(int, LA(2))))): + if ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_17_.member(cast(int, LA(2))))): e=expression() if 0 == inputState.guessing: ec.Add(e); @@ -2901,7 +2901,7 @@ partial class UnityScriptParser(antlr.LLkParser): else: goto _loop229_breakloop :_loop229_breakloop - elif ((LA(1)==LBRACE or LA(1)==RPAREN or LA(1)==RBRACK) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==LBRACE or LA(1)==RPAREN or LA(1)==RBRACK) and (tokenSet_20_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -2923,7 +2923,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -2943,7 +2943,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_17_) + recover(ex,tokenSet_15_) else: raise @@ -2954,7 +2954,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=logical_or() - if ((LA(1)==QUESTION_MARK) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==QUESTION_MARK) and (tokenSet_16_.member(cast(int, LA(2))))): qm = LT(1) match(QUESTION_MARK) trueValue=logical_or() @@ -2965,14 +2965,14 @@ partial class UnityScriptParser(antlr.LLkParser): Condition: e, TrueValue: trueValue, FalseValue: falseValue) - elif ((tokenSet_21_.member(cast(int, LA(1)))) and (tokenSet_29_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_20_.member(cast(int, LA(1)))) and (tokenSet_28_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -2991,7 +2991,7 @@ partial class UnityScriptParser(antlr.LLkParser): arguments = gtr.GenericArguments type_reference_list(arguments) match(GREATER_THAN) - elif ((tokenSet_36_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_35_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: tr = SimpleTypeReference(ToLexicalInfo(typeName), Name: typeName.getText()) else: @@ -2999,7 +2999,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_35_) else: raise return tr @@ -3021,14 +3021,14 @@ partial class UnityScriptParser(antlr.LLkParser): returnType=type_reference() if 0 == inputState.guessing: callableTypeRef.ReturnType = returnType - elif ((tokenSet_36_.member(cast(int, LA(1)))) and (tokenSet_26_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_35_.member(cast(int, LA(1)))) and (tokenSet_25_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_35_) else: raise return tr @@ -3064,7 +3064,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_36_) + recover(ex,tokenSet_35_) else: raise @@ -3094,7 +3094,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3109,7 +3109,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=term() while true: - if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==ADD or LA(1)==SUBTRACT) and (tokenSet_16_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == ADD)): // 1831 add = LT(1) @@ -3136,7 +3136,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3151,7 +3151,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3188,7 +3188,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3231,7 +3231,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3273,7 +3273,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3338,9 +3338,9 @@ partial class UnityScriptParser(antlr.LLkParser): pass // 947 else: // line 1969 raise NoViableAltException(LT(1), getFilename()) - if ((LA(1)==LBRACE) and (tokenSet_43_.member(cast(int, LA(2))))): + if ((LA(1)==LBRACE) and (tokenSet_13_.member(cast(int, LA(2))))): block(body) - elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_20_.member(cast(int, LA(2))))): // line 2102 returnValue=expression() if 0 == inputState.guessing: body.Add(returnValue) @@ -3349,7 +3349,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3377,7 +3377,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3388,7 +3388,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling synPredMatched218 as bool = false - if ((LA(1)==TYPEOF) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==TYPEOF) and (tokenSet_16_.member(cast(int, LA(2))))): _m218 as int = mark() synPredMatched218 = true ++inputState.guessing @@ -3403,14 +3403,14 @@ partial class UnityScriptParser(antlr.LLkParser): --inputState.guessing if synPredMatched218: e=typeof_with_expression() - elif ((LA(1)==TYPEOF) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==TYPEOF) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 e=typeof_expression_alt() else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3446,7 +3446,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3459,11 +3459,11 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling t = LT(1) match(TYPEOF) - if ((LA(1)==LPAREN) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==LPAREN) and (tokenSet_16_.member(cast(int, LA(2))))): match(LPAREN) arg=expression() match(RPAREN) - elif ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_20_.member(cast(int, LA(2))))): // line 2102 arg=expression() else: raise NoViableAltException(LT(1), getFilename()) @@ -3475,7 +3475,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3501,14 +3501,14 @@ partial class UnityScriptParser(antlr.LLkParser): --inputState.guessing if synPredMatched221: e=typeof_with_typeref() - elif ((LA(1)==TYPEOF) and (tokenSet_14_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==TYPEOF) and (tokenSet_16_.member(cast(int, LA(2))))): // line 2102 e=typeof_with_expression() else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3529,7 +3529,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3708,7 +3708,7 @@ partial class UnityScriptParser(antlr.LLkParser): elif ((LA(1)==DOT) and (tokenSet_55_.member(cast(int, LA(2))))): // line 2102 match(DOT) e=member_reference_expression(e) - elif ((LA(1)==LPAREN) and (tokenSet_23_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==LPAREN) and (tokenSet_22_.member(cast(int, LA(2))))): // line 2102 lparen = LT(1) match(LPAREN) if 0 == inputState.guessing: @@ -3724,7 +3724,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3737,17 +3737,17 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=slicing_expression() - if ((LA(1)==INCREMENT) and (tokenSet_21_.member(cast(int, LA(2))))): + if ((LA(1)==INCREMENT) and (tokenSet_20_.member(cast(int, LA(2))))): postinc = LT(1) match(INCREMENT) if 0 == inputState.guessing: token = postinc; operator = UnaryOperatorType.PostIncrement; - elif ((LA(1)==DECREMENT) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + elif ((LA(1)==DECREMENT) and (tokenSet_20_.member(cast(int, LA(2))))): // line 2102 preinc = LT(1) match(DECREMENT) if 0 == inputState.guessing: token = preinc; operator= UnaryOperatorType.PostDecrement; - elif ((tokenSet_21_.member(cast(int, LA(1)))) and (tokenSet_29_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_20_.member(cast(int, LA(1)))) and (tokenSet_28_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) @@ -3756,7 +3756,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3811,14 +3811,14 @@ partial class UnityScriptParser(antlr.LLkParser): tr=type_reference() if 0 == inputState.guessing: e = CastExpression(ToLexicalInfo(c), Target: e, Type: tr) - elif ((tokenSet_21_.member(cast(int, LA(1)))) and (tokenSet_29_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_20_.member(cast(int, LA(1)))) and (tokenSet_28_.member(cast(int, LA(2))))): // line 2102 pass // 947 else: raise NoViableAltException(LT(1), getFilename()) except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3868,7 +3868,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3884,7 +3884,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=unary_expression() while true: - if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==MODULUS or LA(1)==MULTIPLY or LA(1)==DIVISION) and (tokenSet_16_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == MULTIPLY)): // 1831 m = LT(1) @@ -3916,7 +3916,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -3930,7 +3930,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=sum() while true: - if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==SHIFT_LEFT or LA(1)==SHIFT_RIGHT) and (tokenSet_16_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == SHIFT_LEFT)): // 1831 sl = LT(1) @@ -3953,7 +3953,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -4041,7 +4041,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -4057,7 +4057,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=comparison() while true: - if ((tokenSet_58_.member(cast(int, LA(1)))) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((tokenSet_58_.member(cast(int, LA(1)))) and (tokenSet_16_.member(cast(int, LA(2))))): _givenValue = LA(1) if ((_givenValue == EQUALITY)): // 1831 te = LT(1) @@ -4090,7 +4090,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -4103,7 +4103,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=equality() while true: - if ((LA(1)==BITWISE_AND) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_AND) and (tokenSet_16_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_AND) if 0 == inputState.guessing: @@ -4117,7 +4117,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -4130,7 +4130,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_and() while true: - if ((LA(1)==BITWISE_XOR) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_XOR) and (tokenSet_16_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_XOR) if 0 == inputState.guessing: @@ -4144,7 +4144,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -4157,7 +4157,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_xor() while true: - if ((LA(1)==BITWISE_OR) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==BITWISE_OR) and (tokenSet_16_.member(cast(int, LA(2))))): token = LT(1) match(BITWISE_OR) if 0 == inputState.guessing: @@ -4171,7 +4171,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -4184,7 +4184,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=bitwise_or() while true: - if ((LA(1)==LOGICAL_AND) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==LOGICAL_AND) and (tokenSet_16_.member(cast(int, LA(2))))): op = LT(1) match(LOGICAL_AND) rhs=bitwise_or() @@ -4199,7 +4199,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -4212,7 +4212,7 @@ partial class UnityScriptParser(antlr.LLkParser): try: // for error handling e=logical_and() while true: - if ((LA(1)==LOGICAL_OR) and (tokenSet_14_.member(cast(int, LA(2))))): + if ((LA(1)==LOGICAL_OR) and (tokenSet_16_.member(cast(int, LA(2))))): op = LT(1) match(LOGICAL_OR) rhs=logical_and() @@ -4227,7 +4227,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -4257,7 +4257,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -4271,7 +4271,7 @@ partial class UnityScriptParser(antlr.LLkParser): lbrack = LT(1) match(LBRACK) synPredMatched311 as bool = false - if ((tokenSet_14_.member(cast(int, LA(1)))) and (tokenSet_59_.member(cast(int, LA(2))))): + if ((tokenSet_16_.member(cast(int, LA(1)))) and (tokenSet_59_.member(cast(int, LA(2))))): _m311 as int = mark() synPredMatched311 = true ++inputState.guessing @@ -4311,7 +4311,7 @@ partial class UnityScriptParser(antlr.LLkParser): if 0 == inputState.guessing: if id is not null: variable = Declaration(ToLexicalInfo(id), Name: id.getText()) e = CodeFactory.NewArrayComprehension(ToLexicalInfo(lbrack), projection, variable, iterator, filter) - elif ((tokenSet_60_.member(cast(int, LA(1)))) and (tokenSet_21_.member(cast(int, LA(2))))): // line 2102 + elif ((tokenSet_60_.member(cast(int, LA(1)))) and (tokenSet_20_.member(cast(int, LA(2))))): // line 2102 if 0 == inputState.guessing: e = ale = ArrayLiteralExpression(ToLexicalInfo(lbrack)); items = ale.Items; expression_list(items) @@ -4321,7 +4321,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -4383,7 +4383,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return dle @@ -4401,7 +4401,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return re @@ -4429,7 +4429,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -4447,7 +4447,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -4465,7 +4465,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -4483,7 +4483,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return e @@ -4501,7 +4501,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_21_) + recover(ex,tokenSet_20_) else: raise return rle @@ -4521,7 +4521,7 @@ partial class UnityScriptParser(antlr.LLkParser): except ex as RecognitionException: if (0 == inputState.guessing): reportError(ex) - recover(ex,tokenSet_41_) + recover(ex,tokenSet_40_) else: raise return ep @@ -4707,127 +4707,127 @@ partial class UnityScriptParser(antlr.LLkParser): return data public static final tokenSet_12_ = BitSet(mk_tokenSet_12_()) private static def mk_tokenSet_13_() as (long): - data = (576460889743429632L, 0L, ) + data = (-575405631708817888L, 68719493881872L, 0L, 0L, ) return data public static final tokenSet_13_ = BitSet(mk_tokenSet_13_()) private static def mk_tokenSet_14_() as (long): - data = (-5188123130559164416L, 68719493873680L, 0L, 0L, ) + data = (-504403175457964046L, 70162585747442L, 0L, 0L, ) return data public static final tokenSet_14_ = BitSet(mk_tokenSet_14_()) private static def mk_tokenSet_15_() as (long): - data = (-5187091787576207840L, 68719493873680L, 0L, 0L, ) + data = (-571957170220843102L, 68753853620240L, 0L, 0L, ) return data public static final tokenSet_15_ = BitSet(mk_tokenSet_15_()) private static def mk_tokenSet_16_() as (long): - data = (-504403175457964046L, 70162585747442L, 0L, 0L, ) + data = (-5188123130559164416L, 68719493873680L, 0L, 0L, ) return data public static final tokenSet_16_ = BitSet(mk_tokenSet_16_()) private static def mk_tokenSet_17_() as (long): - data = (-571957170220843102L, 68753853620240L, 0L, 0L, ) + data = (-576437111779454896L, 69835094465403L, 0L, 0L, ) return data public static final tokenSet_17_ = BitSet(mk_tokenSet_17_()) private static def mk_tokenSet_18_() as (long): - data = (-576437111779454896L, 69835094465403L, 0L, 0L, ) + data = (0L, 9L, 0L, 0L, ) return data public static final tokenSet_18_ = BitSet(mk_tokenSet_18_()) private static def mk_tokenSet_19_() as (long): - data = (0L, 9L, 0L, 0L, ) + data = (-9223372036854775808L, 16384L, 0L, 0L, ) return data public static final tokenSet_19_ = BitSet(mk_tokenSet_19_()) private static def mk_tokenSet_20_() as (long): - data = (-9223372036854775808L, 16384L, 0L, 0L, ) + data = (-504403158278094862L, 70162585747455L, 0L, 0L, ) return data public static final tokenSet_20_ = BitSet(mk_tokenSet_20_()) private static def mk_tokenSet_21_() as (long): - data = (-504403158278094862L, 70162585747455L, 0L, 0L, ) + data = (576566715757441280L, 34359738368L, 0L, 0L, ) return data public static final tokenSet_21_ = BitSet(mk_tokenSet_21_()) private static def mk_tokenSet_22_() as (long): - data = (576566715757441280L, 34359738368L, 0L, 0L, ) + data = (-5188123130559164416L, 68719493873681L, 0L, 0L, ) return data public static final tokenSet_22_ = BitSet(mk_tokenSet_22_()) private static def mk_tokenSet_23_() as (long): - data = (-5188123130559164416L, 68719493873681L, 0L, 0L, ) + data = (-4754675306957261022L, 68753853620240L, 0L, 0L, ) return data public static final tokenSet_23_ = BitSet(mk_tokenSet_23_()) private static def mk_tokenSet_24_() as (long): - data = (-4754675306957261022L, 68753853620240L, 0L, 0L, ) + data = (-75435293766994062L, 70162585747455L, 0L, 0L, ) return data public static final tokenSet_24_ = BitSet(mk_tokenSet_24_()) private static def mk_tokenSet_25_() as (long): - data = (-75435293766994062L, 70162585747455L, 0L, 0L, ) + data = (-72057594037944334L, 70162585747455L, 0L, 0L, ) return data public static final tokenSet_25_ = BitSet(mk_tokenSet_25_()) private static def mk_tokenSet_26_() as (long): - data = (-72057594037944334L, 70162585747455L, 0L, 0L, ) + data = (35218765914368L, 0L, ) return data public static final tokenSet_26_ = BitSet(mk_tokenSet_26_()) private static def mk_tokenSet_27_() as (long): - data = (35218765914368L, 0L, ) + data = (-139611588809211998L, 68753853620240L, 0L, 0L, ) return data public static final tokenSet_27_ = BitSet(mk_tokenSet_27_()) private static def mk_tokenSet_28_() as (long): - data = (-139611588809211998L, 68753853620240L, 0L, 0L, ) + data = (-72057594046332942L, 70162585747455L, 0L, 0L, ) return data public static final tokenSet_28_ = BitSet(mk_tokenSet_28_()) private static def mk_tokenSet_29_() as (long): - data = (-72057594046332942L, 70162585747455L, 0L, 0L, ) + data = (105963454013696L, 34359738368L, 0L, 0L, ) return data public static final tokenSet_29_ = BitSet(mk_tokenSet_29_()) private static def mk_tokenSet_30_() as (long): - data = (105963454013696L, 34359738368L, 0L, 0L, ) + data = (105963454013696L, 0L, ) return data public static final tokenSet_30_ = BitSet(mk_tokenSet_30_()) private static def mk_tokenSet_31_() as (long): - data = (105963454013696L, 0L, ) + data = (576566853197443328L, 0L, ) return data public static final tokenSet_31_ = BitSet(mk_tokenSet_31_()) private static def mk_tokenSet_32_() as (long): - data = (576566853197443328L, 0L, ) + data = (576460898333430016L, 0L, ) return data public static final tokenSet_32_ = BitSet(mk_tokenSet_32_()) private static def mk_tokenSet_33_() as (long): - data = (576460898333430016L, 0L, ) + data = (-575334852761635038L, 68753853620240L, 0L, 0L, ) return data public static final tokenSet_33_ = BitSet(mk_tokenSet_33_()) private static def mk_tokenSet_34_() as (long): - data = (-575334852761635038L, 68753853620240L, 0L, 0L, ) + data = (576460760893427712L, 34359738368L, 0L, 0L, ) return data public static final tokenSet_34_ = BitSet(mk_tokenSet_34_()) private static def mk_tokenSet_35_() as (long): - data = (576460760893427712L, 34359738368L, 0L, 0L, ) + data = (-504403158269706254L, 70162585747455L, 0L, 0L, ) return data public static final tokenSet_35_ = BitSet(mk_tokenSet_35_()) private static def mk_tokenSet_36_() as (long): - data = (-504403158269706254L, 70162585747455L, 0L, 0L, ) + data = (2305843009213693952L, 2147483648L, 0L, 0L, ) return data public static final tokenSet_36_ = BitSet(mk_tokenSet_36_()) private static def mk_tokenSet_37_() as (long): - data = (2305843009213693952L, 2147483648L, 0L, 0L, ) + data = (4611686018427912192L, 34359738368L, 0L, 0L, ) return data public static final tokenSet_37_ = BitSet(mk_tokenSet_37_()) private static def mk_tokenSet_38_() as (long): - data = (4611686018427912192L, 34359738368L, 0L, 0L, ) + data = (-571957153024196702L, 68753853636637L, 0L, 0L, ) return data public static final tokenSet_38_ = BitSet(mk_tokenSet_38_()) private static def mk_tokenSet_39_() as (long): - data = (-571957153024196702L, 68753853636637L, 0L, 0L, ) + data = (0L, 1L, 0L, 0L, ) return data public static final tokenSet_39_ = BitSet(mk_tokenSet_39_()) private static def mk_tokenSet_40_() as (long): - data = (0L, 1L, 0L, 0L, ) + data = (4611686018427387904L, 8L, 0L, 0L, ) return data public static final tokenSet_40_ = BitSet(mk_tokenSet_40_()) private static def mk_tokenSet_41_() as (long): - data = (4611686018427387904L, 8L, 0L, 0L, ) + data = (-571957153040973918L, 68753853620240L, 0L, 0L, ) return data public static final tokenSet_41_ = BitSet(mk_tokenSet_41_()) private static def mk_tokenSet_42_() as (long): - data = (-571957153040973918L, 68753853620240L, 0L, 0L, ) + data = (576460889743429632L, 0L, ) return data public static final tokenSet_42_ = BitSet(mk_tokenSet_42_()) private static def mk_tokenSet_43_() as (long): - data = (-575405631708817888L, 68719493881872L, 0L, 0L, ) + data = (-5187091787576207840L, 68719493873680L, 0L, 0L, ) return data public static final tokenSet_43_ = BitSet(mk_tokenSet_43_()) private static def mk_tokenSet_44_() as (long): diff --git a/src/UnityScript/UnityScript.g b/src/UnityScript/UnityScript.g index a7727ae..f12798a 100755 --- a/src/UnityScript/UnityScript.g +++ b/src/UnityScript/UnityScript.g @@ -277,7 +277,7 @@ start[CompileUnit cu] module_member[module] ) | module_member[module] - | statement[globals] + | compound_or_single_stmt[globals] )* eof:EOF { @@ -663,7 +663,7 @@ block[Block b] { }: LBRACE - (statement[b])* + (compound_or_single_stmt[b])* rbrace:RBRACE { SetEndSourceLocation(b, rbrace) } ; diff --git a/tests/parser/empty-blocks.js b/tests/parser/empty-blocks.js new file mode 100644 index 0000000..3ea9258 --- /dev/null +++ b/tests/parser/empty-blocks.js @@ -0,0 +1,10 @@ +/* +def Start(): + pass +*/ +function Start() { + {} +} + +{ {} } + From cb7e7843dff518415f82249b2a92e63224e9ba07 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 4 Apr 2013 17:49:14 -0300 Subject: [PATCH 271/276] improve unused variable test case --- tests/error-messages/unused-variable.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/error-messages/unused-variable.js b/tests/error-messages/unused-variable.js index 0bc3fbb..0021899 100644 --- a/tests/error-messages/unused-variable.js +++ b/tests/error-messages/unused-variable.js @@ -1,5 +1,20 @@ /* +unused-variable.js(11,7): BCW0003: WARNING: Unused local variable 'unused'. +unused-variable.js(15,7): BCW0003: WARNING: Unused local variable 'unused'. +unused-variable.js(19,7): BCW0003: WARNING: Unused local variable 'unused'. */ // Unused member variables should not give any warnings. // This warning also shows up when the variable is used in a function. -var target : String; \ No newline at end of file +var target : String; + +function f() { + var unused; +} + +function g() { + var unused: Object; +} + +function h() { + var unused = 42; +} From b59630622c6f10cd4967fd1f799ea6d3ff0eacf3 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 11 Apr 2013 15:23:32 -0300 Subject: [PATCH 272/276] generate test fixtures deterministically --- refresh-tests.boo | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/refresh-tests.boo b/refresh-tests.boo index e52e9eb..5e96518 100755 --- a/refresh-tests.boo +++ b/refresh-tests.boo @@ -179,4 +179,6 @@ def GenerateTestFixtureSource( return writer.ToString() def JavascriptFilesIn(dir as string): - return fname for fname in Directory.GetFiles(dir) if fname.EndsWith(".js") + jsFiles = array(fname for fname in Directory.GetFiles(dir) if fname.EndsWith(".js")) + Array.Sort(jsFiles, StringComparer.Ordinal) + return jsFiles From 66e12cfd848dc239471e84597c8abf3edaa1e9fe Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 11 Apr 2013 15:25:27 -0300 Subject: [PATCH 273/276] fix breaking out of for..in loop inside a switch (case 489680) --- .../DuckyIntegrationTestFixture.boo | 6 +++ ...StrictIntegrationTestFixture.Generated.boo | 4 ++ src/UnityScript/Macros/SwitchMacro.boo | 8 +++- tests/integration/for-in-switch-break.js | 41 +++++++++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100755 tests/integration/for-in-switch-break.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 9d03288..1d86168 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -358,6 +358,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/for-continue-2.js") + [Test] def for_in_switch_break(): + RunTestCase("tests/integration/for-in-switch-break.js") + + [Test] def for_over_null(): RunTestCase("tests/integration/for-over-null.js") @@ -628,6 +632,8 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): [Test] def yield_null(): RunTestCase("tests/integration/yield-null.js") + + [Test] def Array_cast_to_native_array_of_struct(): RunTestCase("tests/ducky/Array-cast-to-native-array-of-struct.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo index cde109c..d7b18f6 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo @@ -356,6 +356,10 @@ partial class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/for-continue-2.js") + [Test] def for_in_switch_break(): + RunTestCase("tests/integration/for-in-switch-break.js") + + [Test] def for_over_null(): RunTestCase("tests/integration/for-over-null.js") diff --git a/src/UnityScript/Macros/SwitchMacro.boo b/src/UnityScript/Macros/SwitchMacro.boo index a193807..7daee79 100755 --- a/src/UnityScript/Macros/SwitchMacro.boo +++ b/src/UnityScript/Macros/SwitchMacro.boo @@ -96,8 +96,14 @@ class GotoOnTopLevelBreak(DepthFirstTransformer): ReplaceCurrentNode(NewGoto(_label)) override def OnWhileStatement(node as WhileStatement): + OnLoopBody node.Block + + override def OnForStatement(node as ForStatement): + OnLoopBody node.Block + + def OnLoopBody(block as Block): ++_level - node.Block.Accept(self) + block.Accept(self) --_level def NewGoto(label as LabelStatement): diff --git a/tests/integration/for-in-switch-break.js b/tests/integration/for-in-switch-break.js new file mode 100755 index 0000000..f053fac --- /dev/null +++ b/tests/integration/for-in-switch-break.js @@ -0,0 +1,41 @@ +/* +5 +4 +3 +2 +JS for: Boom +5 +4 +3 +2 +JS for in: Boom +*/ +function Start() { + for (var a=1; a<=2; ++a) { + switch (a) { + case 1: + for (var b=5; b>0; b--) { + print(b); + if (b == 2) { + break; + } + } + print("JS for: Boom"); + break; + + case 2: + var ts : int[] = [5,4,3,2,1,0]; + for (var t in ts) { + print(t); + if (t == 2) { + break; + } + } + print("JS for in: Boom"); + break; + } + } +} + +Start(); + From 19ff9bbff66cfa3b8f08670d0d64043ef23a8fe1 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 11 Apr 2013 16:37:56 -0300 Subject: [PATCH 274/276] test case for functions as ternary expression operands (case 434829) --- .../DuckyIntegrationTestFixture.boo | 4 ++++ ...StrictIntegrationTestFixture.Generated.boo | 4 ++++ .../functions-as-ternary-operands.js | 23 +++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 tests/integration/functions-as-ternary-operands.js diff --git a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo index 1d86168..66d41af 100644 --- a/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo +++ b/src/UnityScript.Tests/DuckyIntegrationTestFixture.boo @@ -374,6 +374,10 @@ class DuckyIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/functions-1.js") + [Test] def functions_as_ternary_operands(): + RunTestCase("tests/integration/functions-as-ternary-operands.js") + + [Test] def generator_inheritance_calling_super(): RunTestCase("tests/integration/generator-inheritance-calling-super.js") diff --git a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo index d7b18f6..3a71756 100644 --- a/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo +++ b/src/UnityScript.Tests/StrictIntegrationTestFixture.Generated.boo @@ -372,6 +372,10 @@ partial class StrictIntegrationTestFixture(AbstractIntegrationTestFixture): RunTestCase("tests/integration/functions-1.js") + [Test] def functions_as_ternary_operands(): + RunTestCase("tests/integration/functions-as-ternary-operands.js") + + [Test] def generator_inheritance_calling_super(): RunTestCase("tests/integration/generator-inheritance-calling-super.js") diff --git a/tests/integration/functions-as-ternary-operands.js b/tests/integration/functions-as-ternary-operands.js new file mode 100644 index 0000000..6f298c5 --- /dev/null +++ b/tests/integration/functions-as-ternary-operands.js @@ -0,0 +1,23 @@ +/* +foo +bar +foo +bar +*/ +function choose(value) { + var f = value ? f1 : f2; + f(); +} + +function invoke(value) { + (value ? f1 : f2)(); +} + +function f1() { print('foo'); } +function f2() { print('bar'); } + +choose(true); +choose(false); + +invoke(true); +invoke(false); From 5e93ce08a98edd459ef6ae99029145b0e5120ef3 Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Thu, 11 Apr 2013 16:46:31 -0300 Subject: [PATCH 275/276] code gardening --- tests/integration/do-while.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/do-while.js b/tests/integration/do-while.js index a81d899..f4660c5 100644 --- a/tests/integration/do-while.js +++ b/tests/integration/do-while.js @@ -24,10 +24,10 @@ do { } while (true); i = 100; -do { +do { print(i); var j = 0; - do { + do { print(i + ", " + j); if (++j >= 2) break; } while (true); From 73099e73252bfbd2595c960775b85bc739c9180a Mon Sep 17 00:00:00 2001 From: "Rodrigo B. de Oliveira" Date: Mon, 24 Jun 2013 14:48:23 -0300 Subject: [PATCH 276/276] test case proving enums can be converted to float using latest boo libraries --- .../ErrorMessagesTestFixture.Generated.boo | 4 ++++ tests/error-messages/cannot-convert-enum-to-float.js | 6 ++++++ 2 files changed, 10 insertions(+) create mode 100644 tests/error-messages/cannot-convert-enum-to-float.js diff --git a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo index 49b5748..1012c35 100755 --- a/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo +++ b/src/UnityScript.Tests/ErrorMessagesTestFixture.Generated.boo @@ -30,6 +30,10 @@ partial class ErrorMessagesTestFixture: RunTestCase("tests/error-messages/builtins.js") + [Test] def cannot_convert_enum_to_float(): + RunTestCase("tests/error-messages/cannot-convert-enum-to-float.js") + + [Test] def cannot_convert_error(): RunTestCase("tests/error-messages/cannot-convert-error.js") diff --git a/tests/error-messages/cannot-convert-enum-to-float.js b/tests/error-messages/cannot-convert-enum-to-float.js new file mode 100644 index 0000000..0ae6b45 --- /dev/null +++ b/tests/error-messages/cannot-convert-enum-to-float.js @@ -0,0 +1,6 @@ +/* +cannot-convert-enum-to-float.js(5,27): BCE0022: Cannot convert 'E' to 'float'. +*/ +enum E { E0 }; +var implicitly: float = E.E0; +var explicitly = E.E0 cast float;