mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[cm6] Allow optional parameters in \def
macro definition (#14329)
* Allow optional parameters in `\def` macro definition * Allow whitespace in `\def` macro definition * [lezer] Add test for optional macro parameter * [lezer] Add test for whitespace before def csname --------- Co-authored-by: Mathias Jakobsen <mathias.jakobsen@overleaf.com> GitOrigin-RevId: 342b1198c90e11a1c6d3f63573d0540dfc5fd9a9
This commit is contained in:
parent
ffdb651998
commit
a8d7306fc4
1 changed files with 5 additions and 1 deletions
|
@ -221,6 +221,10 @@ MacroParameter {
|
|||
"#" ("1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9")
|
||||
}
|
||||
|
||||
OptionalMacroParameter {
|
||||
OpenBracket MacroParameter CloseBracket
|
||||
}
|
||||
|
||||
// The autocompletion code in services/web/frontend/js/features/source-editor/utils/tree-operations/commands.ts
|
||||
// depends on following the `KnownCommand { Command { CommandCtrlSeq [args] } }`
|
||||
// structure
|
||||
|
@ -289,7 +293,7 @@ KnownCommand {
|
|||
} |
|
||||
Def {
|
||||
// allow more general Csname argument to \def commands, since other symbols such as '@' are often used in definitions
|
||||
DefCtrlSeq (Csname | CtrlSym) optionalWhitespace? MacroParameter* optionalWhitespace? DefinitionArgument
|
||||
DefCtrlSeq optionalWhitespace? (Csname | CtrlSym) optionalWhitespace? (MacroParameter | OptionalMacroParameter)* optionalWhitespace? DefinitionArgument
|
||||
} |
|
||||
Hbox {
|
||||
HboxCtrlSeq optionalWhitespace? TextArgument
|
||||
|
|
Loading…
Reference in a new issue