Skip to content

Minor error fixes #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/parse/parse-declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function parseImport(parser:AS3Parser):Node {
let tok = consume(parser, Keywords.IMPORT);
let name = parseImportName(parser);
let result:Node = createNode(NodeKind.IMPORT, {start: tok.index, text: name});
skip(parser, Operators.SEMI_COLUMN);
skip(parser, Operators.SEMICOLON);
//if(VERBOSE >= 2) {
if((VERBOSE_MASK & ReportFlags.PARSER_IMPORTS) == ReportFlags.PARSER_IMPORTS) {
console.log("parse-declarations.ts - parseImport() - name: " + name + ", line: " + parser.scn.lastLineScanned);
Expand Down Expand Up @@ -145,7 +145,7 @@ function parseUse(parser:AS3Parser):Node {
end: nameIndex + namespace.length,
text: namespace
});
skip(parser, Operators.SEMI_COLUMN);
skip(parser, Operators.SEMICOLON);
return result;
}

Expand Down Expand Up @@ -271,7 +271,7 @@ function parseClassContent(parser:AS3Parser):Node {
if (tokIs(parser, Operators.LEFT_CURLY_BRACKET)) {
result.children.push(parseBlock(parser));
}
if (tokIs(parser, Operators.LEFT_SQUARE_BRACKET)) {
else if (tokIs(parser, Operators.LEFT_SQUARE_BRACKET)) {
meta.push(parseMetaData(parser));
} else if (tokIs(parser, Keywords.VAR)) {
parseClassField(parser, result, modifiers, meta);
Expand Down Expand Up @@ -305,7 +305,7 @@ function parseClassField(parser:AS3Parser, result:Node, modifiers:Token[], meta:
result.children.push(parser.currentMultiLineComment);
parser.currentMultiLineComment = null;
}
if (tokIs(parser, Operators.SEMI_COLUMN)) {
if (tokIs(parser, Operators.SEMICOLON)) {
nextToken(parser);
}
meta.length = 0;
Expand All @@ -315,7 +315,7 @@ function parseClassField(parser:AS3Parser, result:Node, modifiers:Token[], meta:

function parseClassConstant(parser:AS3Parser, result:Node, modifiers:Token[], meta:Node[]):void {
result.children.push(parseConstList(parser, meta, modifiers));
if (tokIs(parser, Operators.SEMI_COLUMN)) {
if (tokIs(parser, Operators.SEMICOLON)) {
nextToken(parser);
}
meta.length = 0;
Expand Down Expand Up @@ -431,8 +431,8 @@ function parseFunction(parser:AS3Parser, meta:Node[], modifiers:Token[]):Node {
result.children.push(params);
result.children.push(returnType);

if (tokIs(parser, Operators.SEMI_COLUMN)) {
consume(parser, Operators.SEMI_COLUMN);
if (tokIs(parser, Operators.SEMICOLON)) {
consume(parser, Operators.SEMICOLON);
} else {
result.children.push(parseFunctionBlock(parser));
}
Expand All @@ -449,7 +449,7 @@ function parseFunction(parser:AS3Parser, meta:Node[], modifiers:Token[]):Node {

function parseFunctionSignature(parser:AS3Parser):Node {
let {type, name, params, returnType} = doParseSignature(parser);
skip(parser, Operators.SEMI_COLUMN);
skip(parser, Operators.SEMICOLON);
let result:Node = createNode(
type.kind,
{start: type.start, end: -1, text: type.text},
Expand Down
26 changes: 13 additions & 13 deletions src/parse/parse-statements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ export function parseStatement(parser:AS3Parser):Node {
result = parseThrowStatement(parser);
} else if (tokIs(parser, Keywords.BREAK) || tokIs(parser, Keywords.CONTINUE)) {
result = parseBreakOrContinueStatement(parser);
} else if (tokIs(parser, Operators.SEMI_COLUMN)) {
} else if (tokIs(parser, Operators.SEMICOLON)) {
result = parseEmptyStatement(parser);
} else {
result = parseExpressionList(parser);
skip(parser, Operators.SEMI_COLUMN);
skip(parser, Operators.SEMICOLON);
}
return result;
}
Expand Down Expand Up @@ -95,7 +95,7 @@ function parseTraditionalFor(parser:AS3Parser, index:number):Node {
consume(parser, Operators.LEFT_PARENTHESIS);

let result:Node = createNode(NodeKind.FOR, {start: index});
if (!tokIs(parser, Operators.SEMI_COLUMN)) {
if (!tokIs(parser, Operators.SEMICOLON)) {
if (tokIs(parser, Keywords.VAR)) {
let varList = parseVarList(parser, null, null);
result.children.push(createNode(NodeKind.INIT, {start: varList.start, end: varList.end}, varList));
Expand All @@ -109,12 +109,12 @@ function parseTraditionalFor(parser:AS3Parser, index:number):Node {
return parseForIn(parser, result);
}
}
consume(parser, Operators.SEMI_COLUMN);
if (!tokIs(parser, Operators.SEMI_COLUMN)) {
consume(parser, Operators.SEMICOLON);
if (!tokIs(parser, Operators.SEMICOLON)) {
let expr = parseExpression(parser);
result.children.push(createNode(NodeKind.COND, {start: expr.start, end: expr.end}, expr));
}
consume(parser, Operators.SEMI_COLUMN);
consume(parser, Operators.SEMICOLON);
if (!tokIs(parser, Operators.RIGHT_PARENTHESIS)) {
let expr = parseExpressionList(parser);
result.children.push(createNode(NodeKind.ITER, {start: expr.start, end: expr.end}, expr));
Expand Down Expand Up @@ -218,7 +218,7 @@ function parseDo(parser:AS3Parser):Node {
let cond = parseCondition(parser);
result.children.push(cond);
result.end = cond.end;
if (tokIs(parser, Operators.SEMI_COLUMN)) {
if (tokIs(parser, Operators.SEMICOLON)) {
nextToken(parser, true);
}
return result;
Expand Down Expand Up @@ -281,14 +281,14 @@ function parseFinally(parser:AS3Parser):Node {
function parseVar(parser:AS3Parser):Node {
let result:Node;
result = parseVarList(parser, null, null);
skip(parser, Operators.SEMI_COLUMN);
skip(parser, Operators.SEMICOLON);
return result;
}


function parseConst(parser:AS3Parser):Node {
let result = parseConstList(parser, null, null);
skip(parser, Operators.SEMI_COLUMN);
skip(parser, Operators.SEMICOLON);
return result;
}

Expand All @@ -299,13 +299,13 @@ function parseReturnStatement(parser:AS3Parser):Node {
let index = parser.tok.index,
end = parser.tok.end;
nextTokenAllowNewLine(parser);
if (tokIs(parser, NEW_LINE) || tokIs(parser, Operators.SEMI_COLUMN)) {
if (tokIs(parser, NEW_LINE) || tokIs(parser, Operators.SEMICOLON)) {
nextToken(parser, true);
result = createNode(NodeKind.RETURN, {start: index, end: end});
} else {
let expr = parseExpression(parser);
result = createNode(NodeKind.RETURN, {start: index, end: expr.end}, expr);
skip(parser, Operators.SEMI_COLUMN);
skip(parser, Operators.SEMICOLON);
}
return result;
}
Expand Down Expand Up @@ -334,7 +334,7 @@ function parseBreakOrContinueStatement(parser:AS3Parser):Node {
);
}
let result:Node;
if (tokIs(parser, NEW_LINE) || tokIs(parser, Operators.SEMI_COLUMN)) {
if (tokIs(parser, NEW_LINE) || tokIs(parser, Operators.SEMICOLON)) {
nextToken(parser, true);
result = createNode(kind, {start: tok.index, end: tok.end});
} else {
Expand All @@ -355,7 +355,7 @@ function parseBreakOrContinueStatement(parser:AS3Parser):Node {
}
result = createNode(kind, {start: tok.index, end: ident.end}, ident);
}
skip(parser, Operators.SEMI_COLUMN);
skip(parser, Operators.SEMICOLON);
return result;
}

Expand Down
2 changes: 1 addition & 1 deletion src/parse/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ function scanUntilDelimiter(scanner: AS3Scanner, start: string, delimiter: strin
return null;
}
buffer += currentCharacter;
if ((currentCharacter === delimiter && numberOfBackslashes == 0) ) {
if ((currentCharacter === delimiter && numberOfBackslashes === 0) ) {
let result = new Token(buffer, scanner.index);
scanner.skipChars(buffer.toString().length - 1);
return result;
Expand Down
2 changes: 1 addition & 1 deletion src/reports/report-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const enum ReportFlags {

LOG_ALL = -1,
LOG_NOTHING = 0,
LOG_PARCER = 0 | PARSER_CONTENT | PARSER_FUNCTIONS | PARSER_IMPORTS | PARSER_POINTS | PARSER_DETAILS,
LOG_PARSER = 0 | PARSER_CONTENT | PARSER_FUNCTIONS | PARSER_IMPORTS | PARSER_POINTS | PARSER_DETAILS,
LOG_EMITTER = 0 | CREATE_NODES | TRANSPILED_CODE,
VERBOSE_1 = 0 | KEY_POINTS,
VERBOSE_2 = 0 | SCANNER_POINTS | PARSER_POINTS | PARSER_FUNCTIONS | PARSER_CONTENT | KEY_POINTS | TRANSPILED_CODE | PARSER_IMPORTS ,
Expand Down
2 changes: 1 addition & 1 deletion src/syntax/operators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export let REST_PARAMETERS = '...';
export let RIGHT_CURLY_BRACKET = '}';
export let RIGHT_PARENTHESIS = ')';
export let RIGHT_SQUARE_BRACKET = ']';
export let SEMI_COLUMN = ';';
export let SEMICOLON = ';';
export let SIMPLE_QUOTE = '\'';
export let SLASH = '/';
export let STRICTLY_EQUAL = '===';
Expand Down