FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
alanc/parser/driver.go at master · foxeng/alanc · GitHub
foxeng
alanc
Repository navigation
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
alanc
/
parser
/
driver.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
22 lines (18 loc) · 443 Bytes
Breadcrumbs
alanc
/
parser
/
driver.go
Copy path
File metadata and controls
22 lines (18 loc) · 443 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//go:generate goyacc -o parser.go -v "" parser.y
package
parser
import
(
"errors"
"fmt"
"github.com/foxeng/alanc/semantic"
)
// Parse is a wrapper around goyacc's yyParse. When yyParse accepts, this returns the AST produced.
func
Parse
(
l
*
Lexer
) (
*
semantic.
Ast
,
error
) {
r
:=
yyParse
(
l
)
if
lexErr
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"lexer: %v"
,
lexErr
)
}
if
r
!=
0
{
return
nil
,
errors
.
New
(
"parser rejected"
)
}
return
ast
,
nil
}
Back
|
FazBrowse Home
|
New Git URL