Skip to content

parse failure (EngineError) when using multiline rules in captures #433

@rntz

Description

@rntz

parsefailure.talon

<user.weird>: "{weird}"
<user.normal>: "{normal}"

parsefailure.py

from talon import Module

mod = Module()

@mod.capture(rule=""" this will parse | just fine | no problem here """)
def normal(m) -> str:
    """"""
    return str(m)

@mod.capture(rule="""
  this will not parse
| nor will this
| only the last branch parses
""")
def weird(m) -> str:
    """"""
    return str(m)

Now try saying this will parse, just fine, no problem here, this will not parse, nor will this, only the last branch parses. These will work except for this will not parse and nor will this, which will produce an engine error:

   19:       lib/python3.9/threading.py:930 * # cron thread
   18:       lib/python3.9/threading.py:973 * 
   17:       lib/python3.9/threading.py:910 * 
   16:                    talon/cron.py:155 | 
   15:                    talon/cron.py:106 | 
   14:                     talon/vad.py:21  | 
   13: talon/scripting/speech_system.py:355 | 
   12:             talon/engines/w2l.py:1086| 
   11:      talon/scripting/dispatch.py:105 | 
   10:      talon/scripting/dispatch.py:144 | 
    9:      talon/scripting/dispatch.py:133 | 
    8:          talon/scripting/rctx.py:233 | # 'phrase' main:_redispatch()
    7: talon/scripting/speech_system.py:62  | 
    6:      talon/scripting/dispatch.py:105 | 
    5:      talon/scripting/dispatch.py:144 | 
    4:      talon/scripting/dispatch.py:133 | 
    3: -------------------------------------# cron thread
    2:          talon/scripting/rctx.py:233 | # 'phrase' main:engine_event()
    1: talon/scripting/speech_system.py:399 | 
talon.engines.EngineError: failed to parse phrase: ['this', 'will', 'not', 'parse']

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions