You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initially, #80 was opened to be able to directly parsed on the rust token stream and, taking advantages of techniques already used in OMeta, being able to parse on arbitrary tree structure. However we are in a typed context and it seems more difficult than what I first thought. Similarly to #92, we propose to use the string literal to parse on enum's variants.
Design
Provide a stream structure encapsulating the Rust parser, it will also be useful to interact with external parser.
Implement the trait ConsumePrefix such that it consumes one or more tokens depending on the prefix.
A literal, for example "=" will correspond to the token Eq. If the literal cannot be mapped, then an assert will be triggered at runtime. General parsing on tree proposed by Tree pattern matching #80 would avoid this runtime error, however, for now, we believe it's easy enough to find and fix.
Tokens containing data must be parsed with an external parser (Ident(..), Literal(..), Lifetime(..),....) if you want to extract the contained data. Otherwise, the token data will be compared against the string literal. Note that Ident("a_variable") does not match "a_var" "iable" but only "a_variable".
The text was updated successfully, but these errors were encountered:
Initially, #80 was opened to be able to directly parsed on the rust token stream and, taking advantages of techniques already used in OMeta, being able to parse on arbitrary tree structure. However we are in a typed context and it seems more difficult than what I first thought. Similarly to #92, we propose to use the string literal to parse on enum's variants.
Design
ConsumePrefix
such that it consumes one or more tokens depending on the prefix."="
will correspond to the tokenEq
. If the literal cannot be mapped, then an assert will be triggered at runtime. General parsing on tree proposed by Tree pattern matching #80 would avoid this runtime error, however, for now, we believe it's easy enough to find and fix.Ident(..)
,Literal(..)
,Lifetime(..)
,....) if you want to extract the contained data. Otherwise, the token data will be compared against the string literal. Note thatIdent("a_variable")
does not match"a_var" "iable"
but only"a_variable"
.The text was updated successfully, but these errors were encountered: