Skip to content

Commit

Permalink
Actually add default ignoredSymbols as described in README. Also remove
Browse files Browse the repository at this point in the history
superflous argument. resolves #19.
  • Loading branch information
Tom committed Jun 28, 2018
1 parent 89b465d commit e23339e
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 34 deletions.
10 changes: 5 additions & 5 deletions dist/lindenmayer.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function normalizeProduction(p, forceObjects) {
return p;
}

function LSystem({ axiom = '', productions, finals, branchSymbols = '', ignoredSymbols = '', allowClassicSyntax = true, classicParametricSyntax = false, forceObjects = false, debug = false }) {
function LSystem({ axiom = '', productions, finals, branchSymbols = '[]', ignoredSymbols = '+-&^/|\\', allowClassicSyntax = true, classicParametricSyntax = false, forceObjects = false, debug = false }) {

// TODO: forceObject to be more intelligent based on other productions??

Expand Down Expand Up @@ -167,7 +167,7 @@ function LSystem({ axiom = '', productions, finals, branchSymbols = '', ignoredS

// Apply production transformers and normalizations
if (this.allowClassicSyntax === true) {
newProduction = transformClassicCSProduction(newProduction, this.ignoredSymbols);
newProduction = transformClassicCSProduction(newProduction);
}

newProduction = normalizeProduction(newProduction, this.forceObjects);
Expand Down Expand Up @@ -253,11 +253,11 @@ function LSystem({ axiom = '', productions, finals, branchSymbols = '', ignoredS
precheck = false;
} else if (contextSensitive) {
if (p.leftCtx !== undefined && p.rightCtx !== undefined) {
precheck = this.match({ direction: 'left', match: p.leftCtx, index: index, branchSymbols: '[]' }).result && this.match({ direction: 'right', match: p.rightCtx, index: index, branchSymbols: '[]', ignoredSymbols: ignoredSymbols }).result;
precheck = this.match({ direction: 'left', match: p.leftCtx, index: index, branchSymbols, ignoredSymbols }).result;
} else if (p.leftCtx !== undefined) {
precheck = this.match({ direction: 'left', match: p.leftCtx, index: index, branchSymbols: '[]' }).result;
precheck = this.match({ direction: 'left', match: p.leftCtx, index: index, branchSymbols, ignoredSymbols }).result;
} else if (p.rightCtx !== undefined) {
precheck = this.match({ direction: 'right', match: p.rightCtx, index: index, branchSymbols: '[]' }).result;
precheck = this.match({ direction: 'right', match: p.rightCtx, index: index, branchSymbols, ignoredSymbols }).result;
}
}

Expand Down
2 changes: 1 addition & 1 deletion dist/lindenmayer.browser.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions dist/lindenmayer.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function normalizeProduction(p, forceObjects) {
return p;
}

function LSystem({ axiom = '', productions, finals, branchSymbols = '', ignoredSymbols = '', allowClassicSyntax = true, classicParametricSyntax = false, forceObjects = false, debug = false }) {
function LSystem({ axiom = '', productions, finals, branchSymbols = '[]', ignoredSymbols = '+-&^/|\\', allowClassicSyntax = true, classicParametricSyntax = false, forceObjects = false, debug = false }) {

// TODO: forceObject to be more intelligent based on other productions??

Expand Down Expand Up @@ -164,7 +164,7 @@ function LSystem({ axiom = '', productions, finals, branchSymbols = '', ignoredS

// Apply production transformers and normalizations
if (this.allowClassicSyntax === true) {
newProduction = transformClassicCSProduction(newProduction, this.ignoredSymbols);
newProduction = transformClassicCSProduction(newProduction);
}

newProduction = normalizeProduction(newProduction, this.forceObjects);
Expand Down Expand Up @@ -250,11 +250,11 @@ function LSystem({ axiom = '', productions, finals, branchSymbols = '', ignoredS
precheck = false;
} else if (contextSensitive) {
if (p.leftCtx !== undefined && p.rightCtx !== undefined) {
precheck = this.match({ direction: 'left', match: p.leftCtx, index: index, branchSymbols: '[]' }).result && this.match({ direction: 'right', match: p.rightCtx, index: index, branchSymbols: '[]', ignoredSymbols: ignoredSymbols }).result;
precheck = this.match({ direction: 'left', match: p.leftCtx, index: index, branchSymbols, ignoredSymbols }).result;
} else if (p.leftCtx !== undefined) {
precheck = this.match({ direction: 'left', match: p.leftCtx, index: index, branchSymbols: '[]' }).result;
precheck = this.match({ direction: 'left', match: p.leftCtx, index: index, branchSymbols, ignoredSymbols }).result;
} else if (p.rightCtx !== undefined) {
precheck = this.match({ direction: 'right', match: p.rightCtx, index: index, branchSymbols: '[]' }).result;
precheck = this.match({ direction: 'right', match: p.rightCtx, index: index, branchSymbols, ignoredSymbols }).result;
}
}

Expand Down
Loading

0 comments on commit e23339e

Please sign in to comment.