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
 
72
 
73
       node.args = []
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
         node.args.push(this.expr())
79
         node.args.push(this.expr())
77
       }
80
       }
78
 
81
 

+ 4
- 1
test/evaluatorTest.js View File

53
   t.plan(1)
53
   t.plan(1)
54
 
54
 
55
   const tree = helpers.evaluate('(let ((x 1)) x) x')
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
 
14
 
15
   t.deepEqual(tree, [
15
   t.deepEqual(tree, [
16
     new AST.Application({
16
     new AST.Application({
17
-      function: new AST.Identifier({name: 'div', line: 2 }),
17
+      function: new AST.Identifier({ name: 'div', line: 2 }),
18
       args: [
18
       args: [
19
         new AST.Attribute({
19
         new AST.Attribute({
20
           name: 'class',
20
           name: 'class',
79
     new AST.Conditional({
79
     new AST.Conditional({
80
       condition: new AST.Boolean({ value: true }),
80
       condition: new AST.Boolean({ value: true }),
81
       ifCase: new AST.Application({
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
       elseCase: new AST.Application({
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
     new OsloError({
99
     new OsloError({
100
       line: 1,
100
       line: 1,
101
       message: 'Encountered an unexpected EOF while looking for a ).',
101
       message: 'Encountered an unexpected EOF while looking for a ).',
102
-    })
102
+    }),
103
   )
103
   )
104
 })
104
 })
105
 
105
 
112
     new OsloError({
112
     new OsloError({
113
       line: 1,
113
       line: 1,
114
       message: 'Encountered an unexpected EOF while looking for a ".',
114
       message: 'Encountered an unexpected EOF while looking for a ".',
115
-    })
115
+    }),
116
   )
116
   )
117
 })
117
 })

Loading…
Cancel
Save