File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 1- import { optWhitespace , Parser } from 'parsimmon' ;
1+ import { all , optWhitespace , Parser , seq } from 'parsimmon' ;
22import { VimState } from '../../state/vimState' ;
33import { ExCommand } from '../../vimscript/exCommand' ;
44import { expressionParser , functionCallParser } from '../../vimscript/expression/parser' ;
55import { Expression } from '../../vimscript/expression/types' ;
66import { EvaluationContext } from '../../vimscript/expression/evaluate' ;
7+ import { VimError } from '../../error' ;
78
89export class EvalCommand extends ExCommand {
910 public static argParser : Parser < EvalCommand > = optWhitespace
10- . then ( expressionParser )
11- . map ( ( expression ) => new EvalCommand ( expression ) ) ;
11+ . then ( seq ( expressionParser . fallback ( undefined ) , all ) )
12+ . map ( ( [ expression , trailing ] ) => {
13+ if ( expression === undefined ) {
14+ throw VimError . InvalidExpression ( trailing ) ;
15+ }
16+ if ( trailing ) {
17+ throw VimError . TrailingCharacters ( trailing ) ;
18+ }
19+ return new EvalCommand ( expression ) ;
20+ } ) ;
1221
1322 private expression : Expression ;
1423 private constructor ( expression : Expression ) {
You can’t perform that action at this time.
0 commit comments