Exemplo n.º 1
0
        /**
         * Returns a string representation of this object.
         *
         * @param tokenizer      the tokenizer containing the tokens
         *
         * @return a string representation of this object
         */
        public string ToString(Tokenizer tokenizer) {
            StringBuilder  buffer = new StringBuilder();
            Sequence       seq;

            buffer.Append("{");
            for (int i = 0; i < elements.Count; i++) {
                seq = (Sequence) elements[i];
                buffer.Append("\n  ");
                buffer.Append(seq.ToString(tokenizer));
            }
            buffer.Append("\n}");
            return buffer.ToString();
        }
Exemplo n.º 2
0
            /**
             * Returns a string representation of this object.
             *
             * @param tokenizer      the tokenizer containing the tokens
             *
             * @return a string representation of this object
             */
            public string ToString(Tokenizer tokenizer) {
                StringBuilder  buffer = new StringBuilder();
                string         str;
                int            id;

                if (tokenizer == null) {
                    buffer.Append(tokens.ToString());
                } else {
                    buffer.Append("[");
                    for (int i = 0; i < tokens.Count; i++) {
                        id = (int) tokens[i];
                        str = tokenizer.GetPatternDescription(id);
                        if (i > 0) {
                            buffer.Append(" ");
                        }
                        buffer.Append(str);
                    }
                    buffer.Append("]");
                }
                if (repeat) {
                    buffer.Append(" *");
                }
                return buffer.ToString();
            }
Exemplo n.º 3
0
 /**
  * Creates a new parser.
  *
  * @param tokenizer      the tokenizer to use
  */
 public RecursiveDescentParser(Tokenizer tokenizer)
     : base(tokenizer) {
 }
Exemplo n.º 4
0
 /**
  * Creates a new parser.
  *
  * @param tokenizer      the tokenizer to use
  * @param analyzer       the analyzer callback to use
  */
 public RecursiveDescentParser(Tokenizer tokenizer,
                               Analyzer analyzer)
     : base(tokenizer, analyzer) {
 }
Exemplo n.º 5
0
 /**
  * Creates a new parser.
  *
  * @param tokenizer       the tokenizer to use
  * @param analyzer        the analyzer callback to use
  */
 internal Parser(Tokenizer tokenizer, Analyzer analyzer) {
     this.tokenizer = tokenizer;
     this.analyzer = (analyzer == null) ? NewAnalyzer() : analyzer;
 }
Exemplo n.º 6
0
 /**
  * Creates a new parser.
  *
  * @param tokenizer       the tokenizer to use
  */
 internal Parser(Tokenizer tokenizer) : this(tokenizer, null) {
 }
Exemplo n.º 7
0
 /**
  * Creates a new parser.
  *
  * @param input          the input stream to read from
  * @param analyzer       the analyzer callback to use
  *
  * @throws ParserCreationException if the tokenizer couldn't be
  *             initialized correctly
  *
  * @since 1.5
  */
 internal Parser(TextReader input, Analyzer analyzer) {
     this.tokenizer = NewTokenizer(input);
     this.analyzer = (analyzer == null) ? NewAnalyzer() : analyzer;
 }
 /**
  * Creates a new parser.
  *
  * @param tokenizer      the tokenizer to use
  * @param analyzer       the analyzer callback to use
  */
 public RecursiveDescentParser(Tokenizer tokenizer,
                               Analyzer analyzer)
     : base(tokenizer, analyzer)
 {
 }
 /**
  * Creates a new parser.
  *
  * @param tokenizer      the tokenizer to use
  */
 public RecursiveDescentParser(Tokenizer tokenizer)
     : base(tokenizer)
 {
 }