Skip to content

Commit

Permalink
The --no-xxx CLI options did not work! Fix CLI option set: see also h…
Browse files Browse the repository at this point in the history
  • Loading branch information
GerHobbelt committed Jan 31, 2017
1 parent 71f9d5c commit e2c1544
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,24 @@ function getCommandlineOptions() {
default: false,
help: 'Output extra parser tables (rules list + look-ahead analysis) in generated modules to assist debugging / diagnostics purposes'
},
noDefaultResolve: {
full: 'no-default-resolve',
hasDefaultResolve: {
full: 'default-resolve',
abbr: 'X',
flag: true,
default: false,
help: 'Act another way when a conflict is found in the grammar'
default: true,
help: 'Turn this OFF to make jison act another way when a conflict is found in the grammar'
},
noDefaultAction: {
full: 'no-default-action',
hasDefaultAction: {
full: 'default-action',
flag: true,
default: false,
help: 'Generate a parser which does NOT include the default "$$ = $1" action for every rule. This produces a slightly faster parser but now you are solely responsible for propagating rule action "$$" results.'
default: true,
help: 'Generate a parser which includes the default "$$ = $1" action for every rule. When you turn this OFF, it will produce a slightly faster parser but then you are solely responsible for propagating rule action "$$" results.'
},
noTryCatch: {
full: 'no-try-catch',
hasTryCatch: {
full: 'try-catch',
flag: true,
default: false,
help: 'Generate a parser which does NOT try/catch exceptions (from the grammar action code or parseError error reporting calls. This produces a slightly faster parser at the cost of enhanced code safety.'
default: true,
help: 'Generate a parser which catches exceptions from the grammar action code or parseError error reporting calls using a try/catch/finally code block. When you turn this OFF, it will produce a slightly faster parser at the cost of reduced code safety.'
},
errorRecoveryTokenDiscardCount: {
full: 'error-recovery-token-discard-count',
Expand Down Expand Up @@ -142,6 +142,16 @@ function getCommandlineOptions() {
}
}).parse();

opts.noMain = !opts.main;
opts.noDefaultResolve = !opts.hasDefaultResolve;
opts.noDefaultAction = !opts.hasDefaultAction;
opts.noTryCatch = !opts.hasTryCatch;

delete opts.main;
delete opts.hasDefaultResolve;
delete opts.hasDefaultAction;
delete opts.hasTryCatch;

return opts;
}

Expand Down Expand Up @@ -305,7 +315,6 @@ cli.generateParserString = function generateParserString(grammar, optionalLexSec
if (opts.parserType) {
settings.type = opts.parserType;
}
settings.noMain = !opts.main;

for (var key in opts) {
if (opts[key] || opts[key] === 0) {
Expand Down

0 comments on commit e2c1544

Please sign in to comment.