private EventStatement ParseEventStatement()
        {
            var options = new List <OptionDeclaration>();

            var eventType = _current.Value;

            var start = _current;

            Take(TokenKind.Keyword);

            var @event = _current.Value;

            Take(TokenKind.StringLiteral);

            while (!Keyword.IsEventKeyword(_current.Value) && _current.Kind != TokenKind.RightBracket)
            {
                var token = Take();

                if (!Keyword.EventOptionKeywords.Contains(token.Value))
                {
                    throw UnexpectedToken(Keyword.EventOptionKeywords.ToOr());
                }

                List <string> parameters = new List <string>();
                var           opt        = new OptionDeclaration(CreateSpan(token), token.Value, token.Value, parameters);

                token = ParseParameters(token, parameters);

                options.Add(opt);
            }

            return(new EventStatement(CreateSpan(start), eventType, @event, options));
        }
Esempio n. 2
0
        public void VBNetCompareTextOptionDeclarationTest()
        {
            string            program = "Option Compare Text\n";
            OptionDeclaration opDec   = ParseUtilVBNet.ParseGlobal <OptionDeclaration>(program);

            Assert.AreEqual(OptionType.CompareText, opDec.OptionType);
            Assert.IsTrue(opDec.OptionValue);
        }
Esempio n. 3
0
        public void VBNetExplicitOptionDeclarationTest()
        {
            string            program = "Option Explicit Off\n";
            OptionDeclaration opDec   = ParseUtilVBNet.ParseGlobal <OptionDeclaration>(program);

            Assert.AreEqual(OptionType.Explicit, opDec.OptionType);
            Assert.IsFalse(opDec.OptionValue, "Off option value excepted!");
        }
        public void VBNetInferOptionDeclarationTest()
        {
            string            program = "Option Infer\n";
            OptionDeclaration oParameterDeclarationExpression = ParseUtilVBNet.ParseGlobal <OptionDeclaration>(program);

            Assert.AreEqual(OptionType.Infer, oParameterDeclarationExpression.OptionType);
            Assert.IsTrue(oParameterDeclarationExpression.OptionValue);
        }
Esempio n. 5
0
        public void VBNetInferOptionDeclarationTest()
        {
            string            program = "Option Infer\n";
            OptionDeclaration opDec   = ParseUtil.ParseGlobal <OptionDeclaration>(program);

            Assert.AreEqual(OptionType.Infer, opDec.OptionType);
            Assert.IsTrue(opDec.OptionValue);
        }
        public void VBNetCompareBinaryOptionDeclarationTest()
        {
            string            program = "Option Compare Binary\n";
            OptionDeclaration oParameterDeclarationExpression = ParseUtilVBNet.ParseGlobal <OptionDeclaration>(program);

            Assert.AreEqual(OptionType.CompareBinary, oParameterDeclarationExpression.OptionType);
            Assert.IsTrue(oParameterDeclarationExpression.OptionValue);
        }
 public override object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data)
 {
     if (optionDeclaration.OptionType == OptionType.Infer)
     {
         OptionInfer = optionDeclaration.OptionValue;
     }
     if (optionDeclaration.OptionType == OptionType.Strict)
     {
         OptionStrict = optionDeclaration.OptionValue;
     }
     return(base.VisitOptionDeclaration(optionDeclaration, data));
 }
        private OptionDeclaration ParseOptionDeclaration()
        {
            if (_current == TokenKind.Colon)
                Take();

            if (_current != TokenKind.Keyword)
                throw UnexpectedToken($"{Keyword.PatternKeywords.ToOr()}");

            var token = Take();

            List<string> parameters = new List<string>();
            var opt = new OptionDeclaration(CreateSpan(token), token.Value, token.Value, parameters);
            token = ParseParameters(token, parameters);

            return opt;
        }
Esempio n. 9
0
 public override object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data)
 {
     return(base.VisitOptionDeclaration(optionDeclaration, data));
 }
Esempio n. 10
0
 public object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data)
 {
     AddError(optionDeclaration, "Option statement is not supported.");
     return(null);
 }
Esempio n. 11
0
 // VB only:
 public virtual object Visit(OptionDeclaration optionDeclaration, object data)
 {
     Debug.Assert(optionDeclaration != null);
     return(data);
 }
		public sealed override object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data) {
			BeginVisit(optionDeclaration);
			object result = TrackedVisitOptionDeclaration(optionDeclaration, data);
			EndVisit(optionDeclaration);
			return result;
		}
Esempio n. 13
0
 public virtual object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data)
 {
     throw new global::System.NotImplementedException("OptionDeclaration");
 }
Esempio n. 14
0
		public virtual object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data) {
			Debug.Assert((optionDeclaration != null));
			return null;
		}
 public object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data)
 {
     throw new NotImplementedException();
 }
 private bool IsMatch(OptionDeclaration left, OptionDeclaration data)
 {
     return(false);
 }
		public virtual object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data) {
			throw new global::System.NotImplementedException("OptionDeclaration");
		}
Esempio n. 18
0
	void OptionStmt() {

#line  258 "VBNET.ATG" 
		INode node = null; bool val = true; 
		Expect(159);

#line  259 "VBNET.ATG" 
		Location startPos = t.Location; 
		if (la.kind == 108) {
			lexer.NextToken();
			if (la.kind == 156 || la.kind == 157) {
				OptionValue(
#line  261 "VBNET.ATG" 
ref val);
			}

#line  262 "VBNET.ATG" 
			node = new OptionDeclaration(OptionType.Explicit, val); 
		} else if (la.kind == 192) {
			lexer.NextToken();
			if (la.kind == 156 || la.kind == 157) {
				OptionValue(
#line  264 "VBNET.ATG" 
ref val);
			}

#line  265 "VBNET.ATG" 
			node = new OptionDeclaration(OptionType.Strict, val); 
		} else if (la.kind == 74) {
			lexer.NextToken();
			if (la.kind == 54) {
				lexer.NextToken();

#line  267 "VBNET.ATG" 
				node = new OptionDeclaration(OptionType.CompareBinary, val); 
			} else if (la.kind == 198) {
				lexer.NextToken();

#line  268 "VBNET.ATG" 
				node = new OptionDeclaration(OptionType.CompareText, val); 
			} else SynErr(224);
		} else if (la.kind == 126) {
			lexer.NextToken();
			if (la.kind == 156 || la.kind == 157) {
				OptionValue(
#line  271 "VBNET.ATG" 
ref val);
			}

#line  272 "VBNET.ATG" 
			node = new OptionDeclaration(OptionType.Infer, val); 
		} else SynErr(225);
		EndOfStmt();

#line  276 "VBNET.ATG" 
		if (node != null) {
		node.StartLocation = startPos;
		node.EndLocation   = t.Location;
		compilationUnit.AddChild(node);
		}
		
	}
		public virtual object TrackedVisitOptionDeclaration(OptionDeclaration optionDeclaration, object data) {
			return base.VisitOptionDeclaration(optionDeclaration, data);
		}