Ejemplo 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();
        }
Ejemplo 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();
            }
Ejemplo n.º 3
0
 /**
  * Creates a new parser.
  *
  * @param tokenizer      the tokenizer to use
  */
 public RecursiveDescentParser(Tokenizer tokenizer)
     : base(tokenizer) {
 }
Ejemplo 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) {
 }
Ejemplo 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;
 }
Ejemplo n.º 6
0
 /**
  * Creates a new parser.
  *
  * @param tokenizer       the tokenizer to use
  */
 internal Parser(Tokenizer tokenizer) : this(tokenizer, null) {
 }
Ejemplo 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)
 {
 }