SetupInput() public méthode

public SetupInput ( string input ) : void
input string
Résultat void
Exemple #1
0
        public Ruleset Parse(string input, string fileName)
        {
            Ruleset root;

            FileName = fileName;

            try
            {
                Tokenizer.SetupInput(input, fileName);

                var parsers = new Parsers(NodeProvider);
                root = new Root(parsers.Primary(this), GenerateParserError);
            }
            catch (ParsingException e)
            {
                throw GenerateParserError(e);
            }

            if (!Tokenizer.HasCompletedParsing())
            {
                throw GenerateParserError(new ParsingException("Content after finishing parsing (missing opening bracket?)", Tokenizer.GetNodeLocation(Tokenizer.Location.Index)));
            }

            return(root);
        }
Exemple #2
0
        public Ruleset Parse(string input, string fileName)
        {
            Tokenizer.SetupInput(input);
            ParsingException parsingException = null;
            Ruleset          root             = null;

            try
            {
                Tokenizer.SetupInput(input);

                var parsers = new Parsers(NodeProvider);
                root = new Root(parsers.Primary(this), e => GenerateParserError(e, fileName));
            }
            catch (ParsingException e)
            {
                parsingException = e;
            }

            if (Tokenizer.HasCompletedParsing() && parsingException == null)
            {
                return(root);
            }

            throw GenerateParserError(parsingException, fileName);
        }