protected override void ProcessNext() { // Check for an assignment statement. if (DmlTokens.IsMatch(CurrentToken, DmlTokens.KW_ASSIGN)) { throw DmlSyntaxError.BadAssignmentNamespace(); } else if (DmlTokens.IsMatch(CurrentToken, DmlTokens.KW_INIT)) { if (Init != null) { throw DmlSyntaxError.DuplicateNamespaceInBullet("Init"); } SetExpecting(DmlTokens.LANGLE); Advance(exception: DmlSyntaxError.BlockMissingDelimiters("Init")); string[] tokens = GetNamespaceBlock(); BulletInitBuilder initBuilder = new BulletInitBuilder(tokens, currentLine); initBuilder.Parse(); var initBlock = (Instruction[])initBuilder.GetResult(); Init = new CodeBlock(initBlock); } else if (DmlTokens.IsMatch(CurrentToken, DmlTokens.KW_UPDATE)) { if (Update != null) { throw DmlSyntaxError.DuplicateNamespaceInBullet("Update"); } SetExpecting(DmlTokens.LANGLE); Advance(exception: DmlSyntaxError.BlockMissingDelimiters("Update")); string[] tokens = GetNamespaceBlock(); BulletUpdateBuilder updateBuilder = new BulletUpdateBuilder(tokens, currentLine); updateBuilder.Parse(); var updateBlock = (Instruction[])updateBuilder.GetResult(); Update = new CodeBlock(updateBlock); } else { throw DmlSyntaxError.InvalidTokenForContext(CurrentToken, "bullet"); } }
protected override void ProcessNext() { // Check for an assignment statement. if (DmlTokens.IsMatch(CurrentToken, DmlTokens.KW_ASSIGN)) { throw DmlSyntaxError.BadAssignmentNamespace(); } else if (DmlTokens.IsMatch(CurrentToken, DmlTokens.KW_INIT)) { if (Init != null) throw DmlSyntaxError.DuplicateNamespaceInBullet("Init"); SetExpecting(DmlTokens.LANGLE); Advance(exception: DmlSyntaxError.BlockMissingDelimiters("Init")); string[] tokens = GetNamespaceBlock(); BulletInitBuilder initBuilder = new BulletInitBuilder(tokens, currentLine); initBuilder.Parse(); var initBlock = (Instruction[])initBuilder.GetResult(); Init = new CodeBlock(initBlock); } else if (DmlTokens.IsMatch(CurrentToken, DmlTokens.KW_UPDATE)) { if (Update != null) throw DmlSyntaxError.DuplicateNamespaceInBullet("Update"); SetExpecting(DmlTokens.LANGLE); Advance(exception: DmlSyntaxError.BlockMissingDelimiters("Update")); string[] tokens = GetNamespaceBlock(); BulletUpdateBuilder updateBuilder = new BulletUpdateBuilder(tokens, currentLine); updateBuilder.Parse(); var updateBlock = (Instruction[])updateBuilder.GetResult(); Update = new CodeBlock(updateBlock); } else throw DmlSyntaxError.InvalidTokenForContext(CurrentToken, "bullet"); }