Parser Implementation **************************************************
18712
private List<String> split(String expression, int offset) {
        List<String> encodedSpecs = new ArrayList<String>();
        int parenthesisLevel = 0;  // number of open '('
        int bracketLevel = 0;      // number of open '['
        int quoteLevel = 0;        // number of open '\''
        int length = expression.length();
        int specStart = 0;
        char c;
        boolean lead = true;
        for (int i = 0; i < length; i++) {
            c = expression.charAt(i);
            if (lead && Character.isWhitespace(c)) {
                specStart++;
                continue;
            }
            lead = false;
            if (c == ',' && parenthesisLevel == 0 && bracketLevel == 0 && quoteLevel == 0) {
                String token = expression.substring(specStart, i);
                addSpec(encodedSpecs, token, offset + specStart);
                specStart = i + 1;
                lead = true;
            } else if (c == '(') {
                if (bracketLevel > 0) {
                    fail(offset + i, "illegal '(' in [...]");
                }
                parenthesisLevel++;
            } else if (c == ')') {
                if (bracketLevel > 0) {
                    fail(offset + i, "illegal ')' in [...]");
                }
                parenthesisLevel--;
                if (parenthesisLevel < 0) {
                    fail(offset + i, "missing '('");
                }
            } else if (c == '[') {
                if (bracketLevel > 0) {
                    fail(offset + i, "too many '['");
                }
                bracketLevel++;
            } else if (c == ']') {
                bracketLevel--;
                if (bracketLevel < 0) {
                    fail(offset + i, "missing '['");
                }
            } else if (c == '\'') {
                if (quoteLevel == 0) {
                    quoteLevel++;
                } else if (quoteLevel == 1) {
                    quoteLevel--;
                }
            }
        }
        if (parenthesisLevel > 0) {
            fail(offset + length, "missing ')'");
        }
        if (bracketLevel > 0) {
            fail(offset + length, "missing ']");
        }
        if (specStart < length) {
            String token = expression.substring(specStart);
            addSpec(encodedSpecs, token, offset + specStart);
        }
        return encodedSpecs;
    }
1329583
private static List<Integer> parseArray(String value, ValueParser parser){
		final List<Integer> values = new ArrayList<>();
	
		final List<String> parts = StrUtil.split(value, StrUtil.C_COMMA);
		for (String part : parts) {
			CollectionUtil.addAllIfNotContains(values, parseStep(part, parser));
		}
		return values;
	}
1083604
@Override
  protected void initParser() throws MtasConfigException {
    super.initParser();
    if (config != null) {

      // always word, no mappings
      wordType = new MtasParserType<>(MAPPING_TYPE_WORD, null, false);

      for (int i = 0; i < config.children.size(); i++) {
        MtasConfiguration current = config.children.get(i);
        if (current.name.equals("mappings")) {
          for (int j = 0; j < current.children.size(); j++) {
            if (current.children.get(j).name.equals("mapping")) {
              MtasConfiguration mapping = current.children.get(j);
              String typeMapping = mapping.attributes.get("type");
              String nameMapping = mapping.attributes.get("name");
              if ((typeMapping != null)) {
                if (typeMapping.equals(MAPPING_TYPE_WORD)) {
                  MtasSketchParserMappingWord m = new MtasSketchParserMappingWord();
                  m.processConfig(mapping);
                  wordType.addItem(m);
                } else if (typeMapping.equals(MAPPING_TYPE_WORD_ANNOTATION)
                    && (nameMapping != null)) {
                  MtasSketchParserMappingWordAnnotation m = new MtasSketchParserMappingWordAnnotation();
                  m.processConfig(mapping);
                  if (wordAnnotationTypes
                      .containsKey(Integer.parseInt(nameMapping))) {
                    wordAnnotationTypes.get(Integer.parseInt(nameMapping))
                        .addItem(m);
                  } else {
                    MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
                        typeMapping, nameMapping, false);
                    t.addItem(m);
                    wordAnnotationTypes.put(Integer.parseInt(nameMapping), t);
                  }
                } else if (typeMapping.equals(MAPPING_TYPE_GROUP)
                    && (nameMapping != null)) {
                  MtasSketchParserMappingGroup m = new MtasSketchParserMappingGroup();
                  m.processConfig(mapping);
                  if (groupTypes.containsKey(nameMapping)) {
                    groupTypes.get(nameMapping).addItem(m);
                  } else {
                    MtasParserType<MtasParserMapping<?>> t = new MtasParserType<>(
                        typeMapping, nameMapping, false);
                    t.addItem(m);
                    groupTypes.put(nameMapping, t);
                  }
                } else {
                  throw new MtasConfigException("unknown mapping type "
                      + typeMapping + " or missing name");
                }
              }
            }
          }
        }
      }
    }
  }
997469
function Parser(options) {
  options = options || {};
  this.tokens = [];
  this.token = null;
  this.options = options || defaults;
  this.options.renderer = this.options.renderer || new Renderer;
  this.renderer = this.options.renderer;
  this.renderer.options = this.options;
  this.options.sanitize = false;
  this.renderer.parser = this;
}
639916
public function setParser(?ParserInterface $parser): void
    {
        if (is_null($parser)) {
            $options = array_merge($this->options, ['classArgs' => [$this->createSchema()]]);

            $parser = ClassFactory::createParser($this->configType, $options);
            if (!empty($this->options) && $parser instanceof ConfigInterface) {
                $parser->setConfig($this->options);
            }
        }

        $this->parser = $parser;
    }
65254
void parse(File file) throws ParseException {
        if (file == null) {
            Log.warn("parsing NULL file, so fallback on default configuration!");
            return;
        }
        if (!file.exists()) {
            Log.warn(String.format("parsing not existing file %s, so fallback on default configuration!", file.getAbsolutePath()));
            return;
        }
        try {
            FileReader reader = new FileReader(file);
            parse(reader);
        } catch (FileNotFoundException fex) {
            Log.warn(String.format("parsing not existing file %s, so fallback on default configuration!", file.getAbsolutePath()), fex);
            return;
        }
    }
345843
@Override
    public Parser newDelimitedParser(final InputStream dataSourceStream, final char delimiter, final char qualifier) {
        return new DelimiterParser(dataSourceStream, delimiter, qualifier, false);
    }
1147211
private void parse(String text, int start, int valueStart, int valueStop, int dictStart, int dictStop)
   {
      m_field = text.substring(start, valueStart);
      if (valueStop - valueStart <= 1)
      {
         m_value = null;
      }
      else
      {
         m_value = text.substring(valueStart + 1, valueStop);
      }
      if (dictStop - dictStart > 1)
      {
         for (int s = getNextOpeningParenthesisPosition(text, dictStart); s >= 0 && s < dictStop;)
         {
            int e = getClosingParenthesisPosition(text, s);
            m_records.add(new Record(text, s, e));
            s = getNextOpeningParenthesisPosition(text, e);
         }
      }
   }
569055
@Override
    public Parser newDelimitedParser(final InputStream pzmapXMLStream, final InputStream dataSourceStream, final char delimiter, final char qualifier,
            final boolean ignoreFirstRecord) {
        return new DelimiterParser(pzmapXMLStream, dataSourceStream, delimiter, qualifier, ignoreFirstRecord);
    }
272195
public void fill(final LmlParser parser) {
        this.parser = parser;
        for (final Entry<String, I18NBundle> bundle : bundles) {
            parser.getData().addI18nBundle(bundle.key, bundle.value);
            if (defaultBundle.equals(bundle.key)) {
                parser.getData().setDefaultI18nBundle(bundle.value);
            }
        }
    }
65871
function Parser( options ) {

  if( !(this instanceof Parser) )
    return new Parser( options )

  Stream.Transform.call( this, options )

  this._readableState.objectMode = true
  this._buffer = ''

}
1290334
function ParserInline() {
  var i;

  /**
   * ParserInline#ruler -> Ruler
   *
   * [[Ruler]] instance. Keep configuration of inline rules.
   **/
  this.ruler = new Ruler();

  for (i = 0; i < _rules.length; i++) {
    this.ruler.push(_rules[i][0], _rules[i][1]);
  }

  /**
   * ParserInline#ruler2 -> Ruler
   *
   * [[Ruler]] instance. Second ruler used for post-processing
   * (e.g. in emphasis-like rules).
   **/
  this.ruler2 = new Ruler();

  for (i = 0; i < _rules2.length; i++) {
    this.ruler2.push(_rules2[i][0], _rules2[i][1]);
  }
}
1297178
function basicParser(condition, str) {
    let result = [];

    for (let i = 0; i < str.length; ++i) {
        if (condition(str[i])) {
            result.push(str[i]);
        }
    }

    return result;
}
537798
function Parser(network) {
  if (!(this instanceof Parser))
    return new Parser(network);

  EventEmitter.call(this);

  this.network = Network.get(network);

  this.pending = [];
  this.total = 0;
  this.waiting = 24;
  this.header = null;
}
740419
static List<TypeArgument> parseList(final Parser parser, final String definingClassName) throws ParseException {
        if (parser.peek() == '<') {
            parser.expect('<');
            final List<TypeArgument> typeArguments = new ArrayList<>(2);
            while (parser.peek() != '>') {
                if (!parser.hasMore()) {
                    throw new ParseException(parser, "Missing '>'");
                }
                typeArguments.add(parse(parser, definingClassName));
            }
            parser.expect('>');
            return typeArguments;
        } else {
            return Collections.emptyList();
        }
    }
700610
private void parse()
    {
        this.elements = new ArrayList<>();

        try {
            for (Tokenizer tokenizer = new Tokenizer(this.rawVersion); tokenizer.next();) {
                Element element = new Element(tokenizer);
                this.elements.add(element);
                if (element.getVersionType() != Type.STABLE) {
                    this.type = element.getVersionType();
                }
            }

            trimPadding(this.elements);
        } catch (Exception e) {
            // Make sure to never fail no matter what
            LOGGER.error("Failed to parse version [" + this.rawVersion + "]", e);
            this.elements.add(new Element(this.rawVersion));
        }
    }
316361
@Override
  protected Parser createParser(final File source) {
    if (source != null) {
      final String sourceName = source.getName();
      final int lastDot = sourceName.lastIndexOf('.');
      if (lastDot >= 0 && lastDot + 1 < sourceName.length()) {
        final char afterDot = sourceName.charAt(lastDot + 1);
        if (afterDot == 'f' || afterDot == 'F') {
          return new FortranParser();
        }
      }
    }
    return new CParser();
  }