Browse Source

Prettier

master
Dylan Baker 5 years ago
parent
commit
d66c23ab39
3 changed files with 15 additions and 9 deletions
  1. 4
    1
      src/parser.js
  2. 4
    1
      test/evaluatorTest.js
  3. 7
    7
      test/parserTest.js

+ 4
- 1
src/parser.js View File

@@ -72,7 +72,10 @@ module.exports = class Parser {
72 72
 
73 73
       node.args = []
74 74
 
75
-      while (this.tokenStream.peek().type !== tokenTypes.CPAREN && this.tokenStream.peek().type != tokenTypes.EOF) {
75
+      while (
76
+        this.tokenStream.peek().type !== tokenTypes.CPAREN &&
77
+        this.tokenStream.peek().type != tokenTypes.EOF
78
+      ) {
76 79
         node.args.push(this.expr())
77 80
       }
78 81
 

+ 4
- 1
test/evaluatorTest.js View File

@@ -53,5 +53,8 @@ test('let bindings go out of scope after the let block', t => {
53 53
   t.plan(1)
54 54
 
55 55
   const tree = helpers.evaluate('(let ((x 1)) x) x')
56
-  t.deepEqual(tree, new OsloError({ line: 1, message: 'Symbol \'x\' is not bound' }))
56
+  t.deepEqual(
57
+    tree,
58
+    new OsloError({ line: 1, message: "Symbol 'x' is not bound" }),
59
+  )
57 60
 })

+ 7
- 7
test/parserTest.js View File

@@ -14,7 +14,7 @@ test('parses token stream into a tree', t => {
14 14
 
15 15
   t.deepEqual(tree, [
16 16
     new AST.Application({
17
-      function: new AST.Identifier({name: 'div', line: 2 }),
17
+      function: new AST.Identifier({ name: 'div', line: 2 }),
18 18
       args: [
19 19
         new AST.Attribute({
20 20
           name: 'class',
@@ -79,12 +79,12 @@ test('parse conditionals', t => {
79 79
     new AST.Conditional({
80 80
       condition: new AST.Boolean({ value: true }),
81 81
       ifCase: new AST.Application({
82
-        function: new AST.Identifier({ line: 1,  name: 'do' }),
83
-        args: [new AST.Identifier({ line: 1,  name: 'this' })],
82
+        function: new AST.Identifier({ line: 1, name: 'do' }),
83
+        args: [new AST.Identifier({ line: 1, name: 'this' })],
84 84
       }),
85 85
       elseCase: new AST.Application({
86
-        function: new AST.Identifier({ line: 1,  name: 'do' }),
87
-        args: [new AST.Identifier({ line: 1,  name: 'that' })],
86
+        function: new AST.Identifier({ line: 1, name: 'do' }),
87
+        args: [new AST.Identifier({ line: 1, name: 'that' })],
88 88
       }),
89 89
     }),
90 90
   ])
@@ -99,7 +99,7 @@ test('missing close paren returns error', t => {
99 99
     new OsloError({
100 100
       line: 1,
101 101
       message: 'Encountered an unexpected EOF while looking for a ).',
102
-    })
102
+    }),
103 103
   )
104 104
 })
105 105
 
@@ -112,6 +112,6 @@ test('missing close quote returns an error', t => {
112 112
     new OsloError({
113 113
       line: 1,
114 114
       message: 'Encountered an unexpected EOF while looking for a ".',
115
-    })
115
+    }),
116 116
   )
117 117
 })

Loading…
Cancel
Save