-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Description
I need to write a lexer which highlights my command-line tool commands properly.
$ dvc add file.csv
$ dvc pipeline list
So the command starts with dvc and it may have one or two subcommands - add or pipeline list respectively.
Therefore, it should highlight dvc add and dvc pipeline list in first and second case respectively.
contains: [
{
begin: /^\s*\$\s(dvc|git) [a-z-]+/,
returnBegin: true,
contains: [
{
begin: /dvc [a-z-]+ ?/,
lexemes: '[a-z-]+',
keywords: {
built_in:
'dvc'
},
contains: [
{
begin: /\w+(?![\S])/,
keywords: {
built_in: 'list'
}
}
],
className: 'strong'
}
]
}
]
It matches $ dvc pipeline list even though the parent regex i.e. /^\s*\$\s(dvc|git) [a-z-]+/ and should only match till $ dvc pipeline. How is it exactly functioning?
How does /dvc [a-z-]+ ?/ override it and continues matching the expression?
shcheklein
Metadata
Metadata
Assignees
Labels
No labels