Parses all collected macros one by one.
967286
@Initiate(priority = AutumnActionPriority.HIGH_PRIORITY)
    private void parseMacros() {
        if (GdxArrays.isEmpty(macros)) {
            return;
        }
        final LmlParser parser = interfaceService.get().getParser();
        for (final FileHandle macro : macros) {
            parser.parseTemplate(macro);
        }
    }
25678
def parse(scanner, rules, scope = ParserScope.empty)
      backtracking(scanner) do
        if scope = parse_children(scanner, rules, scope.nest)
          yield scope if block_given?
          parse_result(scope)
        end
      end
    end
817364
def do_usemacro(parser, token):
    
    tag_name, macro_name, args, kwargs = parse_macro_params(token)
    try:
        macro = parser._macros[macro_name]
    except (AttributeError, KeyError):
        raise template.TemplateSyntaxError(
            "Macro '{0}' is not defined previously to the {1} tag".format(
                macro_name, tag_name))
    macro.parser = parser
    return UseMacroNode(macro, args, kwargs)
592982
def parse_list(self):
        """"""
        try:
            return List([self.parse() for _ in
                         self.collect_tokens_until('CLOSE_BRACKET')])
        except IncompatibleItemType as exc:
            raise self.error(f'Item {str(exc.item)!r} is not a '
                             f'{exc.subtype.__name__} tag') from None
802495
def parse(self, module):
        """"""
        matches = self.RE_TYPE.finditer(module.contents)
        result = {}

        for match in matches:
            name = match.group("name")
            modifiers = match.group("modifiers")
            if modifiers is not None:
                cleanmods = re.split("[\s,]+", modifiers.strip())
            else:
                cleanmods = []

            contents = match.group("contents")
            result[name.lower()] = self._process_type(name, cleanmods, contents, module, match)
            if "public" in result[name.lower()].modifiers:
                module.publics[name.lower()] = 1

        #Set the types we found in the module and then move the embedded
        #ones into their correct parent executables.
        module.types = result
        module.update_embedded("types")
213221
def execute_macros(self):
        

        if self.safe_mode:
            return '', "Safe mode activated. Code not executed."

        # Windows exec does not like Windows newline
        self.macros = self.macros.replace('\r\n', '\n')

        # Set up environment for evaluation
        globals().update(self._get_updated_environment())

        # Create file-like string to capture output
        code_out = cStringIO.StringIO()
        code_err = cStringIO.StringIO()
        err_msg = cStringIO.StringIO()

        # Capture output and errors
        sys.stdout = code_out
        sys.stderr = code_err

        try:
            import signal

            signal.signal(signal.SIGALRM, self.handler)
            signal.alarm(config["timeout"])

        except:
            # No POSIX system
            pass

        try:
            exec(self.macros, globals())
            try:
                signal.alarm(0)
            except:
                # No POSIX system
                pass

        except Exception:
            # Print exception
            # (Because of how the globals are handled during execution
            # we must import modules here)
            from traceback import print_exception
            from src.lib.exception_handling import get_user_codeframe
            exc_info = sys.exc_info()
            user_tb = get_user_codeframe(exc_info[2]) or exc_info[2]
            print_exception(exc_info[0], exc_info[1], user_tb, None, err_msg)
        # Restore stdout and stderr
        sys.stdout = sys.__stdout__
        sys.stderr = sys.__stderr__

        results = code_out.getvalue()
        errs = code_err.getvalue() + err_msg.getvalue()

        code_out.close()
        code_err.close()

        # Reset result cache
        self.result_cache.clear()

        # Reset frozen cache
        self.frozen_cache.clear()

        return results, errs
885427
def parse(fmt, stri):
    """"""
    convdef = get_convert_dict(fmt)
    keyvals = regex_formatter.extract_values(fmt, stri)
    for key in convdef.keys():
        keyvals[key] = _convert(convdef[key], keyvals[key])

    return keyvals
788554
def process_macros(self, content, source=None):
        
        macro_options = {'relative': self.relative, 'linenos': self.linenos}
        classes = []
        for macro_class in self.macros:
            try:
                macro = macro_class(logger=self.logger, embed=self.embed,
                    options=macro_options)
                content, add_classes = macro.process(content, source)
                if add_classes:
                    classes += add_classes
            except Exception as e:
                self.log(u"%s processing failed in %s: %s"
                         % (macro, source, e))
        return content, classes
872302
def macro_list(self, args: argparse.Namespace) -> None:
        """"""
        if args.name:
            for cur_name in utils.remove_duplicates(args.name):
                if cur_name in self.macros:
                    self.poutput("macro create {} {}".format(cur_name, self.macros[cur_name].value))
                else:
                    self.perror("Macro '{}' not found".format(cur_name), traceback_war=False)
        else:
            sorted_macros = utils.alphabetical_sort(self.macros)
            for cur_macro in sorted_macros:
                self.poutput("macro create {} {}".format(cur_macro, self.macros[cur_macro].value))
512096
private function parse()
    {
        $this->lines = [];
        $parser = new SegmentParser();
        foreach (explode(';', $this->sMappings) as $num => $sLine) {
            $sLine = trim($sLine);
            if ($sLine !== '') {
                $this->lines[$num] = Line::loadFromMappings($num, $sLine, $parser, $this->context);
            }
        }
    }
434095
function parse(contents, retained, parser) {
    var errors = [], data = [], lines = 0;

    // optional parser
    if (!parser) parser = JSON;

    // process each line of the file
    contents.toString().split('\n').forEach(function(line) {
        if (!line) return;
        lines++;
        try {
            data.push(parser.parse(line));
        } catch (e) {
            e.line = line;
            errors.push(e);
        }
    });

    // if no errors/data, don't return an empty array
    var ret = {};
    if (errors.length) ret.errors = errors;
    if (data.length) ret.data = data;

    // if every line failed, probably not line-delimited
    if (errors.length == lines) ret.errors = retained;

    return ret;
}
923719
def MACRO_DEFINITION(self, cursor):
        
        # TODO: optionalize macro parsing. It takes a LOT of time.
        # ignore system macro
        if (not hasattr(cursor, 'location') or cursor.location is None or
                cursor.location.file is None):
            return False
        name = self.get_unique_name(cursor)
        # if name == 'A':
        #    code.interact(local=locals())
        # Tokens !!! .kind = {IDENTIFIER, KEYWORD, LITERAL, PUNCTUATION,
        # COMMENT ? } etc. see TokenKinds.def
        comment = None
        tokens = self._literal_handling(cursor)
        # Macro name is tokens[0]
        # get Macro value(s)
        value = True
        if isinstance(tokens, list):
            if len(tokens) == 2:
                value = tokens[1]
            else:
                # just merge the list of tokens
                value = ''.join(tokens[1:])
        # macro comment maybe in tokens. Not in cursor.raw_comment
        for t in cursor.get_tokens():
            if t.kind == TokenKind.COMMENT:
                comment = t.spelling
        # special case. internal __null
        # FIXME, there are probable a lot of others.
        # why not Cursor.kind GNU_NULL_EXPR child instead of a token ?
        if name == 'NULL' or value == '__null':
            value = None
        log.debug('MACRO: #define %s %s', tokens[0], value)
        obj = typedesc.Macro(name, None, value)
        try:
            self.register(name, obj)
        except DuplicateDefinitionException:
            log.info(
                'Redefinition of %s %s->%s',
                name, self.parser.all[name].args, value)
            # HACK
            self.parser.all[name] = obj
        self.set_location(obj, cursor)
        # set the comment in the obj
        obj.comment = comment
        return True
158953
def _loadmacros(self):
        
        macro_path = os.path.dirname(os.path.realpath(__file__))
        fd = os.open(macro_path + '/' + 'libname_gen.sas', os.O_RDONLY)
        code = b'options nosource;\n'
        code += os.read(fd, 32767)
        code += b'\noptions source;'

        self._io._asubmit(code.decode(), results='text')
        os.close(fd)
169958
def parse(self, module):
        """"""
        #Because of embedded types, we have to examine the entire module for
        #executable definitions.
        self.parse_block(module.refstring, module, module, 0)

        #Now we can set the value of module.contains as the text after the start of
        #the *first* non-embedded executable.
        min_start = len(module.refstring)
        for x in module.executables:
            if module.executables[x].start < min_start:
                min_start = module.executables[x].start

        module.contains = module.refstring[min_start::]
1017257
def parse_flags(*flags, **kwargs):
    """"""

    parsed = {
        'ASFLAGS':       OrderedSet(),
        'CFLAGS':        OrderedSet(),
        'DEFINES':       OrderedSet(),
        'INCLUDES':      OrderedSet(),
        'FRAMEWORKS':    OrderedSet(),
        'FRAMEWORKPATH': OrderedSet(),
        'LDFLAGS':       OrderedSet(),
        'LIBS':          OrderedSet(),
        'LIBPATH':       OrderedSet(),
    }

    def _parse(arg):
        if not arg:
            return

        if not isinstance(arg, STR_TYPES):
            for item in arg:
                _parse(arg)
            return

        def add_define(name):
            part = name.split('=')
            if len(part) == 1:
                parsed['DEFINES'].add(name)
            else:
                parsed['DEFINES'].add([part[0], '='.join(part[1:])])

        part = shlex.split(arg)
        curr = None   # For multiword arguments
        for item in part:
            if curr is not None:
                if curr == 'DEFINES':
                    add_define(item)
                elif curr == '-include':
                    parsed['CFLAGS'].add(('-include', item))
                elif curr == '-isysroot':
                    parsed['CFLAGS'].add(('-isysroot', item))
                    parsed['LDFLAGS'].add(('-isysroot', item))
                elif curr == '-arch':
                    parsed['CFLAGS'].add(('-arch', item))
                    parsed['LDFLAGS'].add(('-arch', item))
                else:
                    parsed[curr].add(item)
                curr = None

            elif not item[0] in '-+':
                parsed['LIBS'].add(item)

            elif item == '-dylib_file':
                parsed['LDFLAGS'].add(item)
                curr = 'LDFLAGS'

            elif item[:2] == '-L':
                if item[2:]:
                    parsed['LIBPATH'].add(item[2:])
                else:
                    curr = 'LIBPATH'

            elif item[:2] == '-l':
                if item[2:]:
                    parsed['LIBS'].add(item[2:])
                else:
                    curr = 'LIBS'

            elif item[:2] == '-I':
                if item[2:]:
                    parsed['INCLUDES'].add(item[2:])
                else:
                    curr = 'INCLUDES'

            elif item[:4] == '-Wa,':
                parsed['ASFLAGS'].add(arg[4:])
                parsed['CFLAGS'].add(item)

            elif item[:4] == '-Wp,':
                parsed['CFLAGS'].add(item)

            elif item[:2] == '-D':
                if item[2:]:
                    parsed['DEFINES'].add(item[2:])
                else:
                    curr = 'DEFINES'

            elif item == '-framework':
                curr = 'FRAMEWORKS'

            elif item[:14] == '-frameworkdir=':
                parsed['FRAMEWORKPATH'].add(item[14:])

            elif item[:2] == '-F':
                if item[2:]:
                    parsed['FRAMEWORKPATH'].add(item[2:])
                else:
                    curr = 'FRAMEWORKPATH'

            elif item in ('-mno-cygwin', '-pthread', '-openmp', '-fopenmp'):
                parsed['CFLAGS'].add(item)
                parsed['LDFLAGS'].add(item)

            elif item == '-mwindows':
                parsed['LDFLAGS'].add(item)

            elif item[:5] == '-std=':
                parsed['CFLAGS'].add(item)

            elif item[0] == '+':
                parsed['CFLAGS'].add(item)
                parsed['LDFLAGS'].add(item)

            elif item in ('-include', '-isysroot', '-arch'):
                curr = item

            else:
                parsed[kwargs.get('origin', 'CFLAGS')].add(item)

    for arg in flags:
        _parse(arg)

    return parsed
115525
private function parsing() : void
    {
        $lines = explode("\n", $this->raw);

        foreach ($lines as $line) {
            // check "at" mark
            if (false === strpos($line, '@')) {
                continue;
            }

            // check inline annotation
            if ($anp = strpos($line, '//')) {
                $line = substr($line, 0, $anp);
            }

            // trim blanks
            $line = trim(ltrim($line, ' *'));

            // analyze expr
            if (false === $fws = strpos($line, ' ')) {
                // @some-key
                $key = substr($line, 1);
                $val = true;
            } else {
                // @some-key some-val
                $key = substr($line, 1, $fws - 1);
                $val = trim(substr($line, $fws));
            }

            $this->lines[] = [$key, $val];

            $this->declares[$key][] = $val;
        }
    }
1122785
def _load_lexers(module_name):
    """"""
    mod = __import__(module_name, None, None, ['__all__'])
    for lexer_name in mod.__all__:
        cls = getattr(mod, lexer_name)
        _lexer_cache[cls.name] = cls