Parse binary operators
For now, they're all left associative.
This commit is contained in:
parent
63f8026007
commit
408219073a
10 changed files with 99 additions and 39 deletions
|
|
@ -6,7 +6,7 @@ use crate::ast::{Expr, TableDestr, TablePattern, TablePatternElem};
|
|||
|
||||
use super::basic::{ident, space, Error};
|
||||
|
||||
pub fn table_pattern_elem() -> impl Parser<char, TablePatternElem, Error = Error> {
|
||||
pub fn table_pattern_elem() -> impl Parser<char, TablePatternElem, Error = Error> + Clone {
|
||||
let positional = ident().map(TablePatternElem::Positional);
|
||||
|
||||
let named = ident()
|
||||
|
|
@ -25,7 +25,7 @@ pub fn table_pattern_elem() -> impl Parser<char, TablePatternElem, Error = Error
|
|||
named.or(positional)
|
||||
}
|
||||
|
||||
pub fn table_pattern() -> impl Parser<char, TablePattern, Error = Error> {
|
||||
pub fn table_pattern() -> impl Parser<char, TablePattern, Error = Error> + Clone {
|
||||
let elem = space()
|
||||
.then(table_pattern_elem())
|
||||
.then(space())
|
||||
|
|
@ -46,8 +46,8 @@ pub fn table_pattern() -> impl Parser<char, TablePattern, Error = Error> {
|
|||
}
|
||||
|
||||
pub fn table_destr(
|
||||
expr: impl Parser<char, Expr, Error = Error>,
|
||||
) -> impl Parser<char, TableDestr, Error = Error> {
|
||||
expr: impl Parser<char, Expr, Error = Error> + Clone,
|
||||
) -> impl Parser<char, TableDestr, Error = Error> + Clone {
|
||||
let local = text::keyword("local").ignore_then(space()).or_not();
|
||||
|
||||
local
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue