Пример #1
0
		public void CompareTextOption()
		{
			string program = "Option Compare Text\n";
			
			var node = new OptionStatement {
				OptionType = OptionType.Compare,
				OptionValue = OptionValue.Text
			};
			
			ParseUtil.AssertGlobal(program, node);
		}
Пример #2
0
		public void InferOnOption()
		{
			string program = "Option Infer On\n";
			
			var node = new OptionStatement {
				OptionType = OptionType.Infer,
				OptionValue = OptionValue.On
			};
			
			ParseUtil.AssertGlobal(program, node);
		}
Пример #3
0
        public void CompareTextOption()
        {
            string program = "Option Compare Text\n";

            var node = new OptionStatement {
                OptionType  = OptionType.Compare,
                OptionValue = OptionValue.Text
            };

            ParseUtil.AssertGlobal(program, node);
        }
Пример #4
0
		public void ExplicitOption()
		{
			string program = "Option Explicit Off\n";
			
			var node = new OptionStatement {
				OptionType = OptionType.Explicit,
				OptionValue = OptionValue.Off
			};
			
			ParseUtil.AssertGlobal(program, node);
		}
Пример #5
0
        public void InferOffOption()
        {
            string program = "Option Infer Off\n";

            var node = new OptionStatement {
                OptionType  = OptionType.Infer,
                OptionValue = OptionValue.Off
            };

            ParseUtil.AssertGlobal(program, node);
        }
Пример #6
0
        public void ExplicitOption()
        {
            string program = "Option Explicit Off\n";

            var node = new OptionStatement {
                OptionType  = OptionType.Explicit,
                OptionValue = OptionValue.Off
            };

            ParseUtil.AssertGlobal(program, node);
        }
Пример #7
0
        public void StrictOption()
        {
            string program = "Option Strict On\n";

            var node = new OptionStatement {
                OptionType  = OptionType.Strict,
                OptionValue = OptionValue.On
            };

            ParseUtil.AssertGlobal(program, node);
        }
Пример #8
0
 void BinaryText(OptionStatement os)
 {
     if (la.kind == 213) {
     Get();
     AddTerminal(Ast.OptionStatement.OptionValueRole);
     os.OptionValue = OptionValue.Text;
     } else if (la.kind == 67) {
     Get();
     AddTerminal(Ast.OptionStatement.OptionValueRole);
     os.OptionValue  = OptionValue.Binary;
     } else SynErr(248);
 }
Пример #9
0
        void OptionStatement(Role role)
        {
            var result = new OptionStatement(); NodeStart(result);

            Expect(173);
            AddTerminal(Roles.Keyword);
            if (la.kind == 121)
            {
                Get();
                AddTerminal(Ast.OptionStatement.OptionTypeRole);
                result.OptionType = OptionType.Explicit;
                if (la.kind == 170 || la.kind == 171)
                {
                    OnOff(result);
                }
            }
            else if (la.kind == 207)
            {
                Get();
                AddTerminal(Ast.OptionStatement.OptionTypeRole);
                result.OptionType = OptionType.Strict;
                if (la.kind == 170 || la.kind == 171)
                {
                    OnOff(result);
                }
            }
            else if (la.kind == 139)
            {
                Get();
                AddTerminal(Ast.OptionStatement.OptionTypeRole);
                result.OptionType = OptionType.Infer;
                if (la.kind == 170 || la.kind == 171)
                {
                    OnOff(result);
                }
            }
            else if (la.kind == 87)
            {
                Get();
                AddTerminal(Ast.OptionStatement.OptionTypeRole);
                result.OptionType = OptionType.Compare;
                BinaryText(result);
            }
            else
            {
                SynErr(241);
            }
            StatementTerminator();
            NodeEnd(result, role);
        }
Пример #10
0
        void OptionStatement(ref StatementNode node)
        {
            string value = null;

            Expect(46);
            Expect(47);
            Expect(3);
            value = t.val;
            if (value != "0" && value != "1")
            {
                SemErr("base must be 0 or 1");
            }
            node = new OptionStatement("base", value);
        }
Пример #11
0
 void BinaryText(OptionStatement os)
 {
     if (la.kind == 213)
     {
         Get();
         AddTerminal(Ast.OptionStatement.OptionValueRole);
         os.OptionValue = OptionValue.Text;
     }
     else if (la.kind == 67)
     {
         Get();
         AddTerminal(Ast.OptionStatement.OptionValueRole);
         os.OptionValue = OptionValue.Binary;
     }
     else
     {
         SynErr(248);
     }
 }
Пример #12
0
 void OnOff(OptionStatement os)
 {
     if (la.kind == 171)
     {
         Get();
         AddTerminal(Ast.OptionStatement.OptionValueRole);
         os.OptionValue = OptionValue.On;
     }
     else if (la.kind == 170)
     {
         Get();
         AddTerminal(Ast.OptionStatement.OptionValueRole);
         os.OptionValue = OptionValue.Off;
     }
     else
     {
         SynErr(247);
     }
 }
Пример #13
0
 void OptionStatement(Role role)
 {
     var result = new OptionStatement(); NodeStart(result);
     Expect(173);
     AddTerminal(Roles.Keyword);
     if (la.kind == 121) {
     Get();
     AddTerminal(Ast.OptionStatement.OptionTypeRole);
     result.OptionType = OptionType.Explicit;
     if (la.kind == 170 || la.kind == 171) {
         OnOff(result);
     }
     } else if (la.kind == 207) {
     Get();
     AddTerminal(Ast.OptionStatement.OptionTypeRole);
     result.OptionType = OptionType.Strict;
     if (la.kind == 170 || la.kind == 171) {
         OnOff(result);
     }
     } else if (la.kind == 139) {
     Get();
     AddTerminal(Ast.OptionStatement.OptionTypeRole);
     result.OptionType = OptionType.Infer;
     if (la.kind == 170 || la.kind == 171) {
         OnOff(result);
     }
     } else if (la.kind == 87) {
     Get();
     AddTerminal(Ast.OptionStatement.OptionTypeRole);
     result.OptionType = OptionType.Compare;
     BinaryText(result);
     } else SynErr(241);
     StatementTerminator();
     NodeEnd(result, role);
 }
Пример #14
0
 void OnOff(OptionStatement os)
 {
     if (la.kind == 171) {
     Get();
     AddTerminal(Ast.OptionStatement.OptionValueRole);
     os.OptionValue = OptionValue.On;
     } else if (la.kind == 170) {
     Get();
     AddTerminal(Ast.OptionStatement.OptionValueRole);
     os.OptionValue  = OptionValue.Off;
     } else SynErr(247);
 }
Пример #15
0
 public object VisitOptionStatement(OptionStatement optionStatement, object data)
 {
     throw new NotImplementedException();
 }
Пример #16
0
 internal Statement(ParseNode parent, Parser p)
     : base(parent, p)
 {
     if (Block.CanParse(p)) {
         type = Type.Block;
         block = new Block(this, p);
         return;
     } else if (IfStatement.CanParse(p)) {
         type = Type.IfStatement;
         ifStatement = new IfStatement(this, p);
         return;
     } else if (OptionStatement.CanParse(p)) {
         type = Type.OptionStatement;
         optionStatement = new OptionStatement(this, p);
         return;
     } else if (AssignmentStatement.CanParse(p)) {
         type = Type.AssignmentStatement;
         assignmentStatement = new AssignmentStatement(this, p);
         return;
     } else if (ShortcutOptionGroup.CanParse(p)) {
         type = Type.ShortcutOptionGroup;
         shortcutOptionGroup = new ShortcutOptionGroup(this, p);
         return;
     } else if (CustomCommand.CanParse(p)) {
         type = Type.CustomCommand;
         customCommand = new CustomCommand(this, p);
         return;
     } else if (p.NextSymbolIs(TokenType.Text)) {
         line = p.ExpectSymbol(TokenType.Text).value as string;
         type = Type.Line;
     } else {
         throw ParseException.Make(p.tokens.Peek(), "Expected a statement here but got " + p.tokens.Peek().ToString() +" instead (was there an unbalanced if statement earlier?)");
     }
 }