Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  try_it.py   Sprache: Python

 
#!/usr/bin/env python

"""js.py - Repl-like toy to explore parsing of lines of JS.

See README.md for instructions.
"""

import argparse
import traceback
from .lexer import JSLexer
from .parser import JSParser
from jsparagus.lexer import SyntaxError


def interactive_input(lexer, prompt="js> "):
    while True:
        line = input(prompt)
        lexer.write(line + "\n")
        if lexer.can_close():
            return lexer.close()
        prompt = "..> "


def rpl():
    """Read-print loop."""
    while True:
        parser = JSLexer(JSParser(), filename="")
        try:
            result = interactive_input(parser)
        except EOFError:
            print()
            break
        except SyntaxError:
            traceback.print_exc(limit=0)
            continue
        print(result)


def main():
    parser = argparse.ArgumentParser(description="Try out the JS parser.")
    parser.add_argument('input_file', metavar='FILE', nargs='?',
                        help=".js file to parse")
    options = parser.parse_args()

    if options.input_file is not None:
        with open(options.input_file) as f:
            source = f.readlines()
        lexer = JSLexer(JSParser())
        for line in source:
            print(line.rstrip())
            lexer.write(line)
        ast = lexer.close()
        print(ast)
    else:
        rpl()


if __name__ == '__main__':
    main()

Messung V0.5
C=99 H=70 G=85

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge