diff --git a/eodermdrome/__init__.py b/eodermdrome/__init__.py index 25caf14..98eb209 100644 --- a/eodermdrome/__init__.py +++ b/eodermdrome/__init__.py @@ -10,7 +10,7 @@ def usage(prog): def run(fname, debug): p = parse(fname) p.render = debug - p.run("".join(stdin)) + p.run("".join(stdin.read()) if any([cmd.input for cmd in p.commands]) else None) def main(): if len(argv) < 2: diff --git a/eodermdrome/parser.py b/eodermdrome/parser.py index 7573d3a..a00c896 100755 --- a/eodermdrome/parser.py +++ b/eodermdrome/parser.py @@ -1,7 +1,9 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- from pyparsing import Suppress, Optional, CharsNotIn, Word, \ - QuotedString, ZeroOrMore, stringEnd + QuotedString, OneOrMore, ZeroOrMore, stringEnd, \ + Combine, White from eodermdrome.program import Command, Program def parse(path): @@ -10,7 +12,9 @@ def parse(path): # Graph characters and construction graphchars = "abcdefghijklmnopqrstuvwxyz" - graph = Word(graphchars) + punctchars = ".!?¡¿;:[]{}-_‹›«»'\"" + punctuated_whitespace = ZeroOrMore(Optional(White()) + Word(punctchars) + Optional(White())) + graph = Combine(OneOrMore(Word(graphchars) + Optional(Suppress(punctuated_whitespace)))) # Input and output text text = QuotedString("(", endQuoteChar = ")", multiline = True) diff --git a/samples/hello-world.eo b/samples/hello-world.eo new file mode 100644 index 0000000..fd2e87b --- /dev/null +++ b/samples/hello-world.eo @@ -0,0 +1 @@ +this (Hello, World!) says... hi!