chore: move helper functions to Parser.lean
This commit is contained in:
parent
15a2d7d8ca
commit
dd2936d28e
2 changed files with 14 additions and 14 deletions
|
|
@ -1809,6 +1809,20 @@ mkAntiquot "fieldIdx" `fieldIdx <|>
|
|||
{ fn := fun _ => fieldIdxFn,
|
||||
info := mkAtomicInfo "fieldIdx" }
|
||||
|
||||
/- Helper functions for defining simple parsers -/
|
||||
|
||||
def unicodeInfixR (sym : String) (asciiSym : String) (lbp : Nat) : TrailingParser :=
|
||||
pushLeading >> unicodeSymbol sym asciiSym lbp >> termParser (lbp - 1)
|
||||
|
||||
def infixR (sym : String) (lbp : Nat) : TrailingParser :=
|
||||
pushLeading >> symbol sym lbp >> termParser (lbp - 1)
|
||||
|
||||
def unicodeInfixL (sym : String) (asciiSym : String) (lbp : Nat) : TrailingParser :=
|
||||
pushLeading >> unicodeSymbol sym asciiSym lbp >> termParser lbp
|
||||
|
||||
def infixL (sym : String) (lbp : Nat) : TrailingParser :=
|
||||
pushLeading >> symbol sym lbp >> termParser lbp
|
||||
|
||||
end Parser
|
||||
|
||||
namespace Syntax
|
||||
|
|
|
|||
|
|
@ -9,20 +9,6 @@ import Init.Lean.Parser.Level
|
|||
|
||||
namespace Lean
|
||||
namespace Parser
|
||||
/- Helper functions for defining simple parsers -/
|
||||
|
||||
def unicodeInfixR (sym : String) (asciiSym : String) (lbp : Nat) : TrailingParser :=
|
||||
pushLeading >> unicodeSymbol sym asciiSym lbp >> termParser (lbp - 1)
|
||||
|
||||
def infixR (sym : String) (lbp : Nat) : TrailingParser :=
|
||||
pushLeading >> symbol sym lbp >> termParser (lbp - 1)
|
||||
|
||||
def unicodeInfixL (sym : String) (asciiSym : String) (lbp : Nat) : TrailingParser :=
|
||||
pushLeading >> unicodeSymbol sym asciiSym lbp >> termParser lbp
|
||||
|
||||
def infixL (sym : String) (lbp : Nat) : TrailingParser :=
|
||||
pushLeading >> symbol sym lbp >> termParser lbp
|
||||
|
||||
namespace Term
|
||||
|
||||
/- Built-in parsers -/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue