alecthomas / alecthomas/participle
Failing to parse "//" while trying to parse comments
- 主要語言
- Go
- 星號
- 3.9k
- 分支
- 213
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Hi, I'm trying to parse proto files, but I want to preserve the comments inside the file. I'm starting with just adding
```
type Comment struct {
Pos lexer.Position
Message string `@("//" | "#" ) @Ident`
}
```
to the proto example in _examples.
but with a file like this
```
syntax = "proto3";
package com.book;
#testcomment
//testcomment2
message Book {
int64 isbn = 1;
string title = 2;
string author = 3;
}
```
it will successfully read the "#" line, but competely skip the "//" comment line. Am i doing something wrong?
the ENBF generated by the parser contains this, but I'm not super familiar with ENBF.
```
Comment = ("//" | "#") .
```
貢獻指南
這個儲存庫沒有索引到貢獻指南
評估
這個 Issue 還沒有評估資料。