Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Commit e5adc3d

Browse files
committed
use new Token::name() fn
1 parent 75cfc50 commit e5adc3d

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ jobs:
1313
test:
1414
name: run tests
1515
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
node: [ '10', '12', '14' ]
1619

1720
steps:
1821
- name: checkout
@@ -27,8 +30,13 @@ jobs:
2730
toolchain: stable
2831
override: true
2932

33+
- name: install node
34+
uses: actions/setup-node@v2-beta
35+
with:
36+
node-version: ${{ matrix.node }}
37+
3038
- name: install node-gyp
31-
run: npm install -g node-gyp
39+
run: sudo npm install -g node-gyp
3240

3341
- name: npm install
3442
run: npm install

convert.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ namespace lib_ruby_parser_node
3737
Value convert(Token token, Env env)
3838
{
3939
Object obj = Object::New(env);
40-
obj.Set("token_type", token.token_type);
41-
obj.Set("token_value", String::New(env, token.token_value));
40+
obj.Set("name", String::New(env, token.name()));
41+
obj.Set("value", String::New(env, token.token_value));
4242
obj.Set("loc", convert(std::move(token.loc), env));
4343
return obj;
4444
}

test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,20 @@ assert(arg.operator_l === null)
6767
assert_range(arg.expression_l, 9, 12)
6868

6969
let expected_tokens = [
70-
[288, "self", [0, 4]],
71-
[323, ".", [4, 5]],
72-
[307, "foo", [5, 8]],
73-
[391, "(", [8, 9]],
74-
[314, "123", [9, 12]],
75-
[358, ")", [12, 13]],
76-
[0, "", [13, 13]]
70+
["kSELF", "self", [0, 4]],
71+
["tDOT", ".", [4, 5]],
72+
["tIDENTIFIER", "foo", [5, 8]],
73+
["tLPAREN2", "(", [8, 9]],
74+
["tINTEGER", "123", [9, 12]],
75+
["tRPAREN", ")", [12, 13]],
76+
["EOF", "", [13, 13]]
7777
]
7878

7979
assert(tokens.length == expected_tokens.length)
8080

8181
for (let i = 0; i < tokens.length; i++) {
82-
assert(tokens[i].token_type == expected_tokens[i][0])
83-
assert(tokens[i].token_value == expected_tokens[i][1])
82+
assert(tokens[i].name == expected_tokens[i][0])
83+
assert(tokens[i].value == expected_tokens[i][1])
8484
assert(tokens[i].loc.begin == expected_tokens[i][2][0])
8585
assert(tokens[i].loc.end == expected_tokens[i][2][1])
8686
}

0 commit comments

Comments
 (0)