diff --git a/grammar.js b/grammar.js index 22ce9de7a..47ae79004 100644 --- a/grammar.js +++ b/grammar.js @@ -386,7 +386,7 @@ module.exports = grammar({ word: $ => /[^\s\\%\{\},\$\[\]\(\)=\#&_\^\-\+\/\*]+/, - placeholder: $ => /#\d/, + placeholder: $ => /#+\d/, delimiter: $ => /&/, diff --git a/src/grammar.json b/src/grammar.json index a849444cb..e36d37131 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -1673,7 +1673,7 @@ }, "placeholder": { "type": "PATTERN", - "value": "#\\d" + "value": "#+\\d" }, "delimiter": { "type": "PATTERN", diff --git a/test/corpus/commands.txt b/test/corpus/commands.txt index 3e82b8f77..f6c65b782 100644 --- a/test/corpus/commands.txt +++ b/test/corpus/commands.txt @@ -195,6 +195,35 @@ Command definition with optional argument (xparse) (placeholder) (placeholder))))) +================================================================================ +Nested command definition with arguments +================================================================================ +\NewDocumentCommand{\foo}{m}{ + \DeclareDocumentCommand{\bar}{m}{#1, ##1} +} + +-------------------------------------------------------------------------------- + +(source_file + (new_command_definition + (curly_group_command_name + (command_name)) + (curly_group_spec + (text + (word))) + (curly_group + (new_command_definition + (curly_group_command_name + (command_name)) + (curly_group_spec + (text + (word))) + (curly_group + (text + (placeholder)) + (text + (placeholder))))))) + ================================================================================ Command copy (of command defined in grammar which requires a following node) ================================================================================