Ejemplo n.º 1
0
                })

        # format texts
        for entry in attribs:
            if process_txt and 'text' in entry and len(entry['text'])>0:
                if format_:
                    entry["text"] = self.formatText(entry["text"])
                else:
                    entry["text"] = self.cleanupText(entry["text"])

        #from pprint import pprint
        #pprint( attribs)
        return attribs


    gr_at__default_ = ( py.Suppress('@') + py.Word(py.alphas)('category') + py.restOfLine("text") )
    ##
    # "@<hint> text"
    def parse_at__default_(self, line):
        grammar = self.gr_at__default_
        presult = grammar.parseString(line)
        res = {
            'category' : presult.category,
            'text' : presult.text.strip(),
        }
        return res

    # the next would be close to the spec (but huge!)
    #identi = py.Word(u''.join(lang.IDENTIFIER_CHARS_START), u''.join(lang.IDENTIFIER_CHARS_BODY))
    # but using regex, to be consistent with the parser
    py_js_identifier = py.Regex(lang.IDENTIFIER_REGEXP)
Ejemplo n.º 2
0
                })

        # format texts
        for entry in attribs:
            if 'text' in entry and len(entry['text']) > 0:
                if format_:
                    entry["text"] = self.formatText(entry["text"])
                else:
                    entry["text"] = self.cleanupText(entry["text"])

        #from pprint import pprint
        #pprint( attribs)
        return attribs

    gr_at__default_ = (py.Suppress('@') + py.Word(py.alphas)('category') +
                       py.restOfLine("text"))

    ##
    # "@<hint> text"
    def parse_at__default_(self, line):
        grammar = self.gr_at__default_
        presult = grammar.parseString(line)
        res = {
            'category': presult.category,
            'text': presult.text.strip(),
        }
        return res

    # the next would be close to the spec (but huge!)
    #identi = py.Word(u''.join(lang.IDENTIFIER_CHARS_START), u''.join(lang.IDENTIFIER_CHARS_BODY))
    # but using regex, to be consistent with the parser
Ejemplo n.º 3
0

        # format texts
        for entry in attribs:
            if process_txt and 'text' in entry and len(entry['text'])>0:
                if format_:
                    entry["text"] = self.formatText(entry["text"])
                else:
                    entry["text"] = self.cleanupText(entry["text"])

        #from pprint import pprint
        #pprint( attribs)
        return attribs


    gr_at__default_ = ( py.Suppress('@') + py.Word(py.alphas)('category') + py.restOfLine("text") )
    ##
    # "@<hint> text"
    def parse_at__default_(self, line):
        grammar = self.gr_at__default_
        presult = grammar.parseString(line)
        res = {
            'category' : presult.category,
            'text' : presult.text.strip(),
        }
        return res

    # the next would be close to the spec (but huge!)
    #identi = py.Word(u''.join(lang.IDENTIFIER_CHARS_START), u''.join(lang.IDENTIFIER_CHARS_BODY))
    # but using regex, to be consistent with the parser
    py_js_identifier = py.Regex(lang.IDENTIFIER_REGEXP)
Ejemplo n.º 4
0
                })

        # format texts
        for entry in attribs:
            if 'text' in entry and len(entry['text'])>0:
                if format_:
                    entry["text"] = self.formatText(entry["text"])
                else:
                    entry["text"] = self.cleanupText(entry["text"])
 
        #from pprint import pprint
        #pprint( attribs)
        return attribs


    gr_at__default_ = ( py.Suppress('@') + py.Word(py.alphas)('category') + py.restOfLine("text") )
    ##
    # "@<hint> text" 
    def parse_at__default_(self, line):
        grammar = self.gr_at__default_
        presult = grammar.parseString(line)
        res = {
            'category' : presult.category,
            'text' : presult.text.strip(),
        }
        return res

    # the next would be close to the spec (but huge!)
    #identi = py.Word(u''.join(lang.IDENTIFIER_CHARS_START), u''.join(lang.IDENTIFIER_CHARS_BODY))
    # but using regex, to be consistent with the parser
    py_js_identifier = py.Regex(lang.IDENTIFIER_REGEXP)
Ejemplo n.º 5
0
                entry["line"] = line_no
                attribs.append(entry)

        # format texts
        for entry in attribs:
            if process_txt and "text" in entry and len(entry["text"]) > 0:
                if format_:
                    entry["text"] = self.formatText(entry["text"])
                else:
                    entry["text"] = self.cleanupText(entry["text"])

        # from pprint import pprint
        # pprint( attribs)
        return attribs

    gr_at__default_ = py.Suppress("@") + py.Word(py.alphas)("category") + py.restOfLine("text")
    ##
    # "@<hint> text"
    def parse_at__default_(self, line):
        grammar = self.gr_at__default_
        presult = grammar.parseString(line)
        res = {"category": presult.category, "text": presult.text.strip()}
        return res

    # the next would be close to the spec (but huge!)
    # identi = py.Word(u''.join(lang.IDENTIFIER_CHARS_START), u''.join(lang.IDENTIFIER_CHARS_BODY))
    # but using regex, to be consistent with the parser
    py_js_identifier = py.Regex(lang.IDENTIFIER_REGEXP)
    # next: Ugly hack to add '*' to identifier globs
    __idx = lang.IDENTIFIER_REGEXP.rfind("]")
    py_js_identifier_glob = py.Regex(lang.IDENTIFIER_REGEXP[:__idx] + "\\*" + lang.IDENTIFIER_REGEXP[__idx:])
Ejemplo n.º 6
0
            else:
                attribs.append({"category": "description", "text": line.strip()})

        # format texts
        for entry in attribs:
            if "text" in entry and len(entry["text"]) > 0:
                if format_:
                    entry["text"] = self.formatText(entry["text"])
                else:
                    entry["text"] = self.cleanupText(entry["text"])

        # from pprint import pprint
        # pprint( attribs)
        return attribs

    gr_at__default_ = py.Suppress("@") + py.Word(py.alphas)("category") + py.restOfLine("text")
    ##
    # "@<hint> text"
    def parse_at__default_(self, line):
        grammar = self.gr_at__default_
        presult = grammar.parseString(line)
        res = {"category": presult.category, "text": presult.text.strip()}
        return res

    # the next would be close to the spec (but huge!)
    # identi = py.Word(u''.join(lang.IDENTIFIER_CHARS_START), u''.join(lang.IDENTIFIER_CHARS_BODY))
    # but using regex, to be consistent with the parser
    py_js_identifier = py.Regex(lang.IDENTIFIER_REGEXP)

    py_simple_type = py.Suppress("{") + py_js_identifier.copy()("type_name") + py.Suppress("}")
Ejemplo n.º 7
0
                attribs.append(entry)

        # format texts
        for entry in attribs:
            if process_txt and 'text' in entry and len(entry['text']) > 0:
                if format_:
                    entry["text"] = self.formatText(entry["text"])
                else:
                    entry["text"] = self.cleanupText(entry["text"])

        #from pprint import pprint
        #pprint( attribs)
        return attribs

    gr_at__default_ = (py.Suppress('@') + py.Word(py.alphas)('category') +
                       py.restOfLine("text"))

    ##
    # "@<hint> text"
    def parse_at__default_(self, line):
        grammar = self.gr_at__default_
        presult = grammar.parseString(line)
        res = {
            'category': presult.category,
            'text': presult.text.strip(),
        }
        return res

    # the next would be close to the spec (but huge!)
    #identi = py.Word(u''.join(lang.IDENTIFIER_CHARS_START), u''.join(lang.IDENTIFIER_CHARS_BODY))
    # but using regex, to be consistent with the parser