成功测试identifier和Punctutation , 增加界符;
This commit is contained in:
parent
7eb6630248
commit
dbb1abdcd5
@ -264,7 +264,7 @@ a = point {x:24, y:43};
|
||||
#### 界符表
|
||||
|
||||
| id | 关键字 |
|
||||
| ------ | ------ |
|
||||
|----|------|
|
||||
| 1 | - |
|
||||
| 2 | ! |
|
||||
| 3 | ~ |
|
||||
@ -308,6 +308,7 @@ a = point {x:24, y:43};
|
||||
| 41 | ? |
|
||||
| 42 | : |
|
||||
| 43 | -> |
|
||||
| 44 | : |
|
||||
|
||||
#### 常量表
|
||||
|
||||
@ -329,14 +330,13 @@ a = point {x:24, y:43};
|
||||
|
||||
### Hydrogen样例
|
||||
```Hydrogen
|
||||
|
||||
struct Point {
|
||||
x:i8;
|
||||
y:i8;
|
||||
}
|
||||
|
||||
|
||||
[Point:105] tmp;
|
||||
|
||||
fn MergeSort([Point:20] v,i8 l,i8 r) -> {
|
||||
if l>r {
|
||||
return ;
|
||||
|
@ -76,7 +76,8 @@ public:
|
||||
{40, "]"},
|
||||
{41, "?"},
|
||||
{42, ":"},
|
||||
{43, "->"}
|
||||
{43, "->"},
|
||||
{44,";"}
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -8,7 +8,7 @@ using std::string,std::vector;
|
||||
|
||||
TEST_CASE("Scanner test identifier table") {
|
||||
Tbs tables;
|
||||
std::string src = "abcvljl laadfs fafarwrw";
|
||||
std::string src = "a += b b<<=casd;";
|
||||
Scanner scan(src, tables);
|
||||
scan.scan();
|
||||
|
||||
@ -18,13 +18,13 @@ TEST_CASE("Scanner test identifier table") {
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("Scanner test Punct table") {
|
||||
Tbs tables = {};
|
||||
std::string src = "+=---<<=>>>===--((([]--<<<>.";
|
||||
Scanner scan(src, tables);
|
||||
scan.scan();
|
||||
std::cout<<"test\n";
|
||||
for (auto e : scan.get_token_list()) {
|
||||
std::cout<<e.id<<" "<<e.type<<" "<<tables.PunctTable[e.id]<<"\n";
|
||||
}
|
||||
}
|
||||
// TEST_CASE("Scanner test Punct table") {
|
||||
// Tbs tables = {};
|
||||
// std::string src = "+=---<<=>>>===--((([]--<<<>.";
|
||||
// Scanner scan(src, tables);
|
||||
// scan.scan();
|
||||
// std::cout<<"test\n";
|
||||
// for (auto e : scan.get_token_list()) {
|
||||
// std::cout<<e.id<<" "<<e.type<<" "<<tables.PunctTable[e.id]<<"\n";
|
||||
// }
|
||||
// }
|
||||
|
Loading…
Reference in New Issue
Block a user