Skip to content

Commit

Permalink
Use fat arrow instead of 'function'
Browse files Browse the repository at this point in the history
  • Loading branch information
Shahar Soel committed Jan 18, 2016
1 parent a3fe3a6 commit 75969b3
Show file tree
Hide file tree
Showing 16 changed files with 327 additions and 327 deletions.
6 changes: 3 additions & 3 deletions test/full_flow/backtracking/backtracking_parser_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import * as _ from "lodash"


describe("Simple backtracking example", function () {
describe("Simple backtracking example", () => {

// TODO: modify example to use the Chevrotain Lexer to increase readability
let largeFqnTokenVector = [
Expand All @@ -28,7 +28,7 @@ describe("Simple backtracking example", function () {
// new ElementTok(1, 1), new IdentTok("A" , 0, 1, 1), new ColonTok(1,1),
// largeFqnTokenVector,new DefaultTok(1,1), new NumberTok(1,1,"666"), new SemiColonTok(";", 0, 1, 1)

it("can parse an element with Equals and a very long qualified name", function () {
it("can parse an element with Equals and a very long qualified name", () => {
let input:any = _.flatten([
// element A:ns1.ns2.ns3.ns4.ns5.ns6.ns7.ns8.ns9.ns10.ns11.ns12 = 666;
new ElementTok("element", 0, 1, 1), new IdentTok("A", 0, 1, 1), new ColonTok(":", 0, 1, 1),
Expand All @@ -43,7 +43,7 @@ describe("Simple backtracking example", function () {
expect(result).to.equal(RET_TYPE.WITH_EQUALS)
})

it("can parse an element with Default and a very long qualified name", function () {
it("can parse an element with Default and a very long qualified name", () => {
let input:any = _.flatten([
// element A:ns1.ns2.ns3.ns4.ns5.ns6.ns7.ns8.ns9.ns10.ns11.ns12 default 666;
new ElementTok("element", 0, 1, 1), new IdentTok("A", 0, 1, 1), new ColonTok(":", 0, 1, 1), largeFqnTokenVector,
Expand Down
24 changes: 12 additions & 12 deletions test/full_flow/error_recovery/sql_statements/sql_recovery_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {exceptions} from "../../../../src/parse/exceptions_public"
import {ParseTree} from "../../parse_tree"
import * as _ from "lodash"

describe("Error Recovery SQL DDL Example", function () {
describe("Error Recovery SQL DDL Example", () => {
"use strict"

let schemaFQN = [new IdentTok(1, 1, "schema2"), new DotTok(1, 1), new IdentTok(1, 1, "Persons")]
Expand All @@ -42,7 +42,7 @@ describe("Error Recovery SQL DDL Example", function () {
let shahar31Record = [new LParenTok(1, 1), new IntTok(1, 9, "31"), new CommaTok(1, 1), new StringTok(1, 1, '"SHAHAR"'), new RParenTok(1, 1)]
/* tslint:enable:quotemark */

it("can parse a series of three statements successfully", function () {
it("can parse a series of three statements successfully", () => {
let input:any = _.flatten([
// CREATE TABLE schema2.Persons
new CreateTok(1, 1), new TableTok(1, 1), schemaFQN, new SemiColonTok(1, 1),
Expand Down Expand Up @@ -70,7 +70,7 @@ describe("Error Recovery SQL DDL Example", function () {
new DeleteTok(1, 1), shahar31Record, new FromTok(1, 1), schemaFQN, new SemiColonTok(1, 1)
])

it("can perform single token insertion for a missing semicolon", function () {
it("can perform single token insertion for a missing semicolon", () => {
let parser = new DDLExampleRecoveryParser(input)
let ptResult:any = parser.ddl()
// one error encountered
Expand All @@ -85,7 +85,7 @@ describe("Error Recovery SQL DDL Example", function () {
expect(insertedSemiColon.isInsertedInRecovery).to.equal(true)
})

it("can disable single token insertion for a missing semicolon", function () {
it("can disable single token insertion for a missing semicolon", () => {
let parser = new DDLExampleRecoveryParser(input, false)
let ptResult:any = parser.ddl()
expect(parser.errors.length).to.equal(1)
Expand All @@ -106,7 +106,7 @@ describe("Error Recovery SQL DDL Example", function () {
new DeleteTok(1, 1), shahar31Record, new FromTok(1, 1), schemaFQN, new SemiColonTok(1, 1)
])

it("can perform single token deletion for a redundant keyword", function () {
it("can perform single token deletion for a redundant keyword", () => {
let parser = new DDLExampleRecoveryParser(input)
let ptResult = parser.ddl()
// one error encountered
Expand All @@ -117,7 +117,7 @@ describe("Error Recovery SQL DDL Example", function () {
assertAllThreeStatementsPresentAndValid(ptResult)
})

it("can disable single token deletion for a redundant keyword", function () {
it("can disable single token deletion for a redundant keyword", () => {
let parser = new DDLExampleRecoveryParser(input, false)
let ptResult:any = parser.ddl()
expect(parser.errors.length).to.equal(1)
Expand All @@ -130,7 +130,7 @@ describe("Error Recovery SQL DDL Example", function () {

describe("resync recovery mechanism", () => {

it("can perform re-sync recovery and only 'lose' part of the input", function () {
it("can perform re-sync recovery and only 'lose' part of the input", () => {
let input:any = _.flatten([
// CREATE TABLE schema2.Persons
new CreateTok(1, 1), new TableTok(1, 1), schemaFQN, new SemiColonTok(1, 1),
Expand Down Expand Up @@ -172,7 +172,7 @@ describe("Error Recovery SQL DDL Example", function () {
new DeleteTok(1, 1), shahar31Record, new FromTok(1, 1), schemaFQN, new SemiColonTok(1, 1)
])

it("can perform re-sync recovery and only 'lose' part of the input even when re-syncing to two rules 'above'", function () {
it("can perform re-sync recovery and only 'lose' part of the input even when re-syncing to two rules 'above'", () => {
let parser = new DDLExampleRecoveryParser(input)
let ptResult:any = parser.ddl()
// one error encountered
Expand All @@ -191,7 +191,7 @@ describe("Error Recovery SQL DDL Example", function () {
expect(ptResult.children[2].payload).not.to.be.an.instanceof(INVALID_DELETE_STMT)
})

it("can disable re-sync recovery and only 'lose' part of the input even when re-syncing to two rules 'above'", function () {
it("can disable re-sync recovery and only 'lose' part of the input even when re-syncing to two rules 'above'", () => {
let parser = new DDLExampleRecoveryParser(input, false)
let ptResult:any = parser.ddl()
// one error encountered
Expand All @@ -217,7 +217,7 @@ describe("Error Recovery SQL DDL Example", function () {
}


it("will encounter an NotAllInputParsedException when some of the input vector has not been parsed", function () {
it("will encounter an NotAllInputParsedException when some of the input vector has not been parsed", () => {
let input:any = _.flatten([
// CREATE TABLE schema2.Persons; TABLE <-- redundant "TABLE" token
new CreateTok(1, 1), new TableTok(1, 1), schemaFQN, new SemiColonTok(1, 1), new TableTok(1, 1)])
Expand All @@ -228,7 +228,7 @@ describe("Error Recovery SQL DDL Example", function () {
expect(parser.errors[0]).to.be.an.instanceof(exceptions.NotAllInputParsedException)
})

it("can use the same parser instance to parse multiple inputs", function () {
it("can use the same parser instance to parse multiple inputs", () => {
let input1:any = _.flatten([
// CREATE TABLE schema2.Persons;
new CreateTok(1, 1), new TableTok(1, 1), schemaFQN, new SemiColonTok(1, 1)])
Expand All @@ -254,7 +254,7 @@ describe("Error Recovery SQL DDL Example", function () {
expect(ptResult.children[0].payload).not.to.be.an.instanceof(INVALID_DELETE_STMT)
})

it("can re-sync to the next iteration in a MANY rule", function () {
it("can re-sync to the next iteration in a MANY rule", () => {
let input:any = _.flatten([
// CREATE TABLE schema2.Persons
new CreateTok(1, 1), new TableTok(1, 1), schemaFQN, new SemiColonTok(1, 1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import {exceptions} from "../../../../src/parse/exceptions_public"
import * as _ from "lodash"


describe("Error Recovery switch-case Example", function () {
describe("Error Recovery switch-case Example", () => {
"use strict"

it("can parse a valid text successfully", function () {
it("can parse a valid text successfully", () => {
let input = [
// switch (name) {
new SwitchTok(1, 1), new LParenTok(1, 1), new IdentTok("name", 0, 1, 1), new RParenTok(1, 1), new LCurlyTok(1, 1),
Expand All @@ -48,7 +48,7 @@ describe("Error Recovery switch-case Example", function () {
})
})

it("can perform re-sync recovery to the next case stmt", function () {
it("can perform re-sync recovery to the next case stmt", () => {
let input = [
// switch (name) {
new SwitchTok(1, 1), new LParenTok(1, 1), new IdentTok("name", 0, 1, 1), new RParenTok(1, 1), new LCurlyTok(1, 1),
Expand All @@ -73,7 +73,7 @@ describe("Error Recovery switch-case Example", function () {
})
})

it("will detect an error if missing AT_LEAST_ONCE occurrence", function () {
it("will detect an error if missing AT_LEAST_ONCE occurrence", () => {
let input = [
// switch (name) { }
new SwitchTok(1, 1), new LParenTok(1, 1), new IdentTok("name", 0, 1, 1), new RParenTok(1, 1), new LCurlyTok(1, 1), new RCurlyTok(1, 1)
Expand All @@ -89,7 +89,7 @@ describe("Error Recovery switch-case Example", function () {
})


it("can perform re-sync recovery to the next case stmt even if the unexpected tokens are between valid case stmts", function () {
it("can perform re-sync recovery to the next case stmt even if the unexpected tokens are between valid case stmts", () => {
let input = [
// switch (name) {
new SwitchTok(1, 1), new LParenTok(1, 1), new IdentTok("name", 0, 1, 1), new RParenTok(1, 1), new LCurlyTok(1, 1),
Expand Down Expand Up @@ -118,7 +118,7 @@ describe("Error Recovery switch-case Example", function () {
})
})

it("can also sometimes fail in automatic error recovery :)", function () {
it("can also sometimes fail in automatic error recovery :)", () => {
let input = [
// switch (name) {
new SwitchTok(1, 1), new LParenTok(1, 1), new IdentTok("name", 0, 1, 1), new RParenTok(1, 1), new LCurlyTok(1, 1),
Expand All @@ -142,7 +142,7 @@ describe("Error Recovery switch-case Example", function () {
expect(parseResult).to.deep.equal({})
})

it("can perform single token deletion recovery", function () {
it("can perform single token deletion recovery", () => {
let input = [
// switch (name) {
new SwitchTok(1, 1), new LParenTok(1, 1), new IdentTok("name", 0, 1, 1), new RParenTok(1, 1), new LCurlyTok(1, 1),
Expand All @@ -167,7 +167,7 @@ describe("Error Recovery switch-case Example", function () {
})
})

it("will perform single token insertion for a missing colon", function () {
it("will perform single token insertion for a missing colon", () => {
let input = [
// case "Terry" return 2 <-- missing the colon between "Terry" and return
new CaseTok(1, 1), new StringTok("Terry", 0, 1, 1), /* new ColonTok(1, 1) ,*/ new ReturnTok(1, 1), new IntTok("2", 0, 1, 1), new SemiColonTok(1, 1),
Expand All @@ -181,7 +181,7 @@ describe("Error Recovery switch-case Example", function () {
expect(parseResult).to.deep.equal({"Terry": 2})
})

it("will NOT perform single token insertion for a missing string", function () {
it("will NOT perform single token insertion for a missing string", () => {
let input = [
// case : return 2 <-- missing the string for the case's value
new CaseTok(1, 1), /* new StringTok("Terry" , 0, 1, 1),*/ new ColonTok(1, 1), new ReturnTok(1, 1),
Expand Down
6 changes: 3 additions & 3 deletions test/lang/hash_table_spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {HashTable} from "../../src/lang/lang_extensions"

describe("The HashTable implementation", function () {
describe("The HashTable implementation", () => {

it("will return undefined for a key that does not exist, and the value for a key that does exist", function () {
it("will return undefined for a key that does not exist, and the value for a key that does exist", () => {
let hashTable = new HashTable<number>();
hashTable.put("one", 1)
hashTable.put("two", 2)
Expand All @@ -12,7 +12,7 @@ describe("The HashTable implementation", function () {
expect(hashTable.get("three")).to.be.undefined
})

it("support property names that are also names of built in properties on javascript Object", function () {
it("support property names that are also names of built in properties on javascript Object", () => {
let hashTable = new HashTable<number>();
hashTable.put("toString", 1)
hashTable.put("hasOwnProperty", 2)
Expand Down
Loading

0 comments on commit 75969b3

Please sign in to comment.