示例#1
0
        public ParseContext(ParseContext parent, Parser parser)
            : this(parent.Input, -1)
        {
            Parent = parent;
            Parser = parser;

            WhitespacePolicy = parent.WhitespacePolicy;

            var wsRule = parser as WhitespaceRuleParser;
            if (wsRule != null)
            {
                _whitespaceParsers = new HashSet<Parser>(parent._whitespaceParsers ?? Enumerable.Empty<Parser>())
                {
                    wsRule.WhitespaceParser
                };
            }
            else
            {
                _whitespaceParsers = parent._whitespaceParsers;
            }

            var policy = parser as WhitespacePolicyParser;
            if (policy != null) WhitespacePolicy = policy.Policy;

            InitialOffset = Offset = parent.WhitespacePolicy == WhitespacePolicy.Ignore
                ? SkipWhitespace(parent.Input, parent.Offset) : parent.Offset;
        }
示例#2
0
 public ParseContext(String input, int offset)
 {
     Input = input;
     InitialOffset = Offset = offset;
     WhitespacePolicy = WhitespacePolicy.Match;
     _whitespaceParsers = null;
 }
示例#3
0
        public ParseContext(ParseContext parent, Parser parser)
            : this(parent.Input, -1)
        {
            Parent = parent;
            Parser = parser;

            WhitespacePolicy = parent.WhitespacePolicy;

            var wsRule = parser as WhitespaceRuleParser;

            if (wsRule != null)
            {
                _whitespaceParsers = new HashSet <Parser>(parent._whitespaceParsers ?? Enumerable.Empty <Parser>())
                {
                    wsRule.WhitespaceParser
                };
            }
            else
            {
                _whitespaceParsers = parent._whitespaceParsers;
            }

            var policy = parser as WhitespacePolicyParser;

            if (policy != null)
            {
                WhitespacePolicy = policy.Policy;
            }

            InitialOffset = Offset = parent.WhitespacePolicy == WhitespacePolicy.Ignore
                ? SkipWhitespace(parent.Input, parent.Offset) : parent.Offset;
        }
示例#4
0
 public ParseContext(String input, int offset)
 {
     Input              = input;
     InitialOffset      = Offset = offset;
     WhitespacePolicy   = WhitespacePolicy.Match;
     _whitespaceParsers = null;
 }
        public ParseContext(ParseContext parent, Parser parser)
            : this(parent.Input, parent.WhitespacePolicy == WhitespacePolicy.Ignore
                ? SkipWhitespace(parent.Input, parent.Offset) : parent.Offset)
        {
            Parent = parent;
            Parser = parser;

            WhitespacePolicy = parent.WhitespacePolicy;

            var policy = parser as WhitespacePolicyParser;
            if (policy != null) WhitespacePolicy = policy.Policy;
        }
示例#6
0
        public ParseContext(ParseContext parent, Parser parser)
            : this(parent.Input, parent.WhitespacePolicy == WhitespacePolicy.Ignore
                ? SkipWhitespace(parent.Input, parent.Offset) : parent.Offset)
        {
            Parent = parent;
            Parser = parser;

            WhitespacePolicy = parent.WhitespacePolicy;

            var policy = parser as WhitespacePolicyParser;

            if (policy != null)
            {
                WhitespacePolicy = policy.Policy;
            }
        }
示例#7
0
文件: Parser.cs 项目: CyberSys/UTA
 internal WhitespacePolicyParser(Parser inner, WhitespacePolicy policy)
     : base(inner, true)
 {
     Policy = policy;
 }