Parser constructor
551953
function(opts){

	if(!opts) opts = {};

	this.shortcodes = {};

	this.options = {
		openPattern: opts.openPattern || '\\[',
		closePattern: opts.closePattern || '\\]'
	};

}
807075
def get_parser(cls):
        """"""
        organizer = cls()
        organizer.setup_parser()
        organizer._finish_parser()
        return organizer.parser
499799
function ParserBlock() {
  /**
   * ParserBlock#ruler -> Ruler
   *
   * [[Ruler]] instance. Keep configuration of block rules.
   **/
  this.ruler = new Ruler();

  for (var i = 0; i < _rules.length; i++) {
    this.ruler.push(_rules[i][0], _rules[i][1], { alt: (_rules[i][2] || []).slice() });
  }
}
45855
function(opts, argv, error)
    {
        var parser = new Parser(opts, argv, error);
        return parser.parse();
    }
639420
function parse(str, opts) {
  var parser = new Parser(str, opts);
  return {attrs: parser._readProtocol(), imports: parser._imports};
}
1045679
function Parser (platform, projectPath) {

    this.platform = platform || '';
    this.path = projectPath || '';

    // Extend with a ParserHelper instance
    Object.defineProperty(this, 'helper', {
        value: new ParserHelper(this.platform),
        enumerable: true,
        configurable: false,
        writable: false
    });

}
415162
def create_parser():
    """"""
    parser = ArgumentParser(
        formatter_class=RawDescriptionHelpFormatter,
        description=DESCRIPTION,
        epilog=EPILOG,
        add_help=False)

    directory = parser.add_argument_group("Directory")
    directory.add_argument(
        dest='directory',
        action="store",
        default=None,
        nargs="?",
        help="The directory from which to start the search "
        "(defaults to current working directory)")

    globs = parser.add_argument_group("Globs")
    globs.add_argument(
        '-i',
        '--include',
        action="store",
        nargs="*",
        help="One or more Ant-like globs in include in the search."
        "If not specified, then all files are implied")
    globs.add_argument(
        '-e',
        '--exclude',
        action="store",
        nargs="*",
        help="One or more Ant-like globs in include in the search")
    globs.add_argument(
        '--no-default-excludes',
        dest="default_excludes",
        action="store_false",
        default=True,
        help="Do not include the default excludes")
    globs.add_argument(
        '--no-symlinks',
        action="store_true",
        default=False,
        help="Do not include symlinks")
    globs.add_argument(
        '--insensitive',
        action="store_true",
        default=False,
        help="Turn off case-sensitive, default sensitive on POSIX, always insensitive on NT.")

    output = parser.add_argument_group("Output")
    output.add_argument(
        '-r',
        '--relative',
        action="store_true",
        default=False,
        help="Print file paths relative to directory.")

    info = parser.add_argument_group("Information")
    info.add_argument(
        '-h',
        '--help',
        action='store_true',
        default=False,
        help="Prints this help and exits")
    info.add_argument(
        '--usage',
        action='store_true',
        default=False,
        help="Prints additional help on globs and exits")
    info.add_argument(
        '--version',
        action='store_true',
        default=False,
        help="Prints the version of formic and exits")
    info.add_argument('--license', action="store_true", help=SUPPRESS)
    return parser
949722
def init_parser(self):
        
        parser = argparse.ArgumentParser(description='ROCA TLS Fingerprinter')

        parser.add_argument('--debug', dest='debug', default=False, action='store_const', const=True,
                            help='Debugging logging')

        parser.add_argument('--dump', dest='dump', default=False, action='store_const', const=True,
                            help='Dump all processed info')

        parser.add_argument('--flatten', dest='flatten', default=False, action='store_const', const=True,
                            help='Flatten the dump')

        parser.add_argument('--indent', dest='indent', default=False, action='store_const', const=True,
                            help='Indent the dump')

        parser.add_argument('--hosts', dest='hosts', default=False, action='store_const', const=True,
                            help='Arguments are host names not file names')

        parser.add_argument('files', nargs=argparse.ZERO_OR_MORE, default=[],
                            help='files to process')
        return parser
280578
def init_parser(self):
        

        #self.token_list = None
        #self.prev_token_lists = None

        self.valid_children = dict()
        self.valid_children['lems'] = ['component', 'componenttype',
                                       'target', 'include',
                                       'dimension', 'unit', 'assertion']
                                       
        #TODO: make this generic for any domain specific language based on LEMS
        self.valid_children['neuroml'] = ['include', 'componenttype']
                                       
        self.valid_children['componenttype'] = ['dynamics',
                                                'child', 'children',
                                                'componentreference',
                                                'exposure', 'eventport',
                                                'fixed', 'link', 'parameter',
                                                'property',
                                                'indexparameter',
                                                'path', 'requirement',
                                                'componentrequirement',
                                                'instancerequirement',
                                                'simulation', 'structure',
                                                'text', 'attachments',
                                                'constant', 'derivedparameter']
                                                
        self.valid_children['dynamics'] = ['derivedvariable',
                                           'conditionalderivedvariable',
                                           'oncondition',
                                           'onevent', 'onstart',
                                           'statevariable', 'timederivative',
                                           'kineticscheme', 'regime']
                                           
        self.valid_children['component'] = ['component']
                                           
        self.valid_children['conditionalderivedvariable'] = ['case']
        
        self.valid_children['regime'] = ['oncondition', 'onentry', 'timederivative']
        self.valid_children['oncondition'] = ['eventout', 'stateassignment', 'transition']
        self.valid_children['onentry'] = ['eventout', 'stateassignment', 'transition']
        self.valid_children['onevent'] = ['eventout', 'stateassignment', 'transition']
        self.valid_children['onstart'] = ['eventout', 'stateassignment', 'transition']
        self.valid_children['structure'] = ['childinstance',
                                            'eventconnection',
                                            'foreach',
                                            'multiinstantiate',
                                            'with',
                                            'tunnel']
                                       
        self.valid_children['foreach'] = ['foreach', 'eventconnection']     
                                            
        self.valid_children['simulation'] = ['record', 'eventrecord', 'run',
                                             'datadisplay', 'datawriter', 'eventwriter']

        self.tag_parse_table = dict()
        #self.tag_parse_table['assertion'] = self.parse_assertion
        self.tag_parse_table['attachments'] = self.parse_attachments
        self.tag_parse_table['child'] = self.parse_child
        self.tag_parse_table['childinstance'] = self.parse_child_instance
        self.tag_parse_table['children'] = self.parse_children
        self.tag_parse_table['component'] = self.parse_component
        self.tag_parse_table['componentreference'] = self.parse_component_reference   
        self.tag_parse_table['componentrequirement'] = self.parse_component_requirement
        self.tag_parse_table['componenttype'] = self.parse_component_type
        self.tag_parse_table['constant'] = self.parse_constant
        self.tag_parse_table['datadisplay'] = self.parse_data_display
        self.tag_parse_table['datawriter'] = self.parse_data_writer
        self.tag_parse_table['eventwriter'] = self.parse_event_writer
        self.tag_parse_table['derivedparameter'] = self.parse_derived_parameter
        self.tag_parse_table['derivedvariable'] = self.parse_derived_variable
        self.tag_parse_table['conditionalderivedvariable'] = self.parse_conditional_derived_variable
        self.tag_parse_table['case'] = self.parse_case
        self.tag_parse_table['dimension'] = self.parse_dimension
        self.tag_parse_table['dynamics'] = self.parse_dynamics
        self.tag_parse_table['eventconnection'] = self.parse_event_connection
        self.tag_parse_table['eventout'] = self.parse_event_out
        self.tag_parse_table['eventport'] = self.parse_event_port
        self.tag_parse_table['exposure'] = self.parse_exposure
        self.tag_parse_table['fixed'] = self.parse_fixed
        self.tag_parse_table['foreach'] = self.parse_for_each
        self.tag_parse_table['include'] = self.parse_include
        self.tag_parse_table['indexparameter'] = self.parse_index_parameter
        self.tag_parse_table['kineticscheme'] = self.parse_kinetic_scheme
        self.tag_parse_table['link'] = self.parse_link
        self.tag_parse_table['multiinstantiate'] = self.parse_multi_instantiate
        self.tag_parse_table['oncondition'] = self.parse_on_condition
        self.tag_parse_table['onentry'] = self.parse_on_entry
        self.tag_parse_table['onevent'] = self.parse_on_event
        self.tag_parse_table['onstart'] = self.parse_on_start
        self.tag_parse_table['parameter'] = self.parse_parameter
        self.tag_parse_table['property'] = self.parse_property
        self.tag_parse_table['path'] = self.parse_path
        self.tag_parse_table['record'] = self.parse_record
        self.tag_parse_table['eventrecord'] = self.parse_event_record
        self.tag_parse_table['regime'] = self.parse_regime
        self.tag_parse_table['requirement'] = self.parse_requirement
        self.tag_parse_table['instancerequirement'] = self.parse_instance_requirement     
        self.tag_parse_table['run'] = self.parse_run
        #self.tag_parse_table['show'] = self.parse_show
        self.tag_parse_table['simulation'] = self.parse_simulation
        self.tag_parse_table['stateassignment'] = self.parse_state_assignment
        self.tag_parse_table['statevariable'] = self.parse_state_variable
        self.tag_parse_table['structure'] = self.parse_structure
        self.tag_parse_table['target'] = self.parse_target
        self.tag_parse_table['text'] = self.parse_text
        self.tag_parse_table['timederivative'] = self.parse_time_derivative
        self.tag_parse_table['transition'] = self.parse_transition
        self.tag_parse_table['tunnel'] = self.parse_tunnel
        self.tag_parse_table['unit'] = self.parse_unit
        self.tag_parse_table['with'] = self.parse_with

        self.xml_node_stack = []

        self.current_component_type = None
        self.current_dynamics = None
        self.current_regime = None
        self.current_event_handler = None
        self.current_structure = None
        self.current_simulation = None
        self.current_component = None
        
        def counter():
            count = 1
            while True:
                yield count
                count = count + 1

        self.id_counter = counter()
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]);
  }
}
532599
public final void addParser(@NotNull final ParserConfig parser) {
        Contract.requireArgNotNull("parser", parser);
        if (list == null) {
            list = new ArrayList<>();
        }
        list.add(parser);
    }
262336
function parseArrayInitializer() {
        var elements = [], node = new Node(), restSpread;

        expect('[');

        while (!match(']')) {
            if (match(',')) {
                lex();
                elements.push(null);
            } else if (match('...')) {
                restSpread = new Node();
                lex();
                restSpread.finishSpreadElement(inheritCoverGrammar(parseAssignmentExpression));

                if (!match(']')) {
                    isAssignmentTarget = isBindingElement = false;
                    expect(',');
                }
                elements.push(restSpread);
            } else {
                elements.push(inheritCoverGrammar(parseAssignmentExpression));

                if (!match(']')) {
                    expect(',');
                }
            }
        }

        lex();

        return node.finishArrayExpression(elements);
    }
519859
function Parser(text) {
        if (typeof text !== 'string') {
            throw new Error('not a string');
        }
        this.text = text.trim();
        this.level = 0;
        this.place = 0;
        this.root = null;
        this.stack = [];
        this.currentObject = null;
        this.state = NEUTRAL;
    }
1343069
@SuppressWarnings("unchecked")
    @NotNull
    public final Parser<Object> getParser() {
        if (parser != null) {
            return parser;
        }
        LOG.info("Creating parser: {}", className);
        if (className == null) {
            throw new IllegalStateException("Class name was not set: " + getName());
        }
        if (context == null) {
            throw new IllegalStateException("Context class loader was not set: " + getName() + " / " + className);
        }
        final Object obj = Utils4J.createInstance(className, context.getClassLoader());
        if (!(obj instanceof Parser<?>)) {
            throw new IllegalStateException("Expected class to be of type '" + Parser.class.getName() + "', but was: " + className);
        }
        parser = (Parser<Object>) obj;
        parser.initialize(context, this);
        return parser;
    }
775644
def new_parser(self):
        

        parser = argparse.ArgumentParser(description=self.description)
        parser.add_argument(
            '--version', help='show version and exit',
            default=False, action='store_true')
        parser.add_argument(
            '--debug', help='enable debugging',
            default=False, action='store_true')
        return parser
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;
}
831726
function() {
    var parser, source;
    source = this.source();
    if (source == null) {
      return;
    }
    parser = this.parser();
    if (parser != null) {
      return parser(source);
    } else {
      return source;
    }
  }