Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick start example does not run #24

Open
roedoejet opened this issue Aug 12, 2019 · 0 comments
Open

Quick start example does not run #24

roedoejet opened this issue Aug 12, 2019 · 0 comments

Comments

@roedoejet
Copy link

Hi there,

I appear to be getting some strange indenting errors. When I copy the quickstart .gel file and text and run the provided command, I get the error Exception: indent must be a multiple of 4, is 14 in line 24: u' user('

I am using Python 3.7.3, Visual Studio Code with spaces set to 4 and UTF-8 encoding.

Here is the copied quickstart syntax file:

# Define commonly used data types. This is optional, but
# makes your life a litte easier by allowing to reuse regular
# expressions in the grammar.
define nl /[\r\n]/
define ws /\s+/
define fieldname /[\w ]+/
define value /[^\r\n,]+/
define field_end /[\r\n,] */

grammar user:
    match 'Name:' ws value field_end:
        out.add_attribute('.', 'firstname', '$2')
    match 'Lastname:' ws value field_end:
        out.add_attribute('.', 'lastname',  '$2')
    match fieldname ':' ws value field_end:
        out.add('$0', '$3')
    match nl:
        do.return()

# The grammar named "input" is the entry point for the converter.
grammar input:
    match 'User' nl '----' nl:
        out.open('user')
        user()

and the copied text:

User
----
Name: John, Lastname: Doe
Office: 1st Ave
Birth date: 1978-01-01

User
----
Name: Jane, Lastname: Foo
Office: 2nd Ave
Birth date: 1970-01-01

The indentation provided for the syntax file in the docs (https://gelatin.readthedocs.io/en/latest/quick.html) is different from the Readme, but also does not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant