Add first stab a yacc grammar+lexer
This commit is contained in:
parent
b9195afa5a
commit
1ea77385f3
3
Makefile
3
Makefile
|
@ -15,7 +15,10 @@ GOFILES=\
|
|||
dnssec.go\
|
||||
keygen.go\
|
||||
string.go\
|
||||
y.go\
|
||||
|
||||
y.go: dns.y
|
||||
goyacc dns.y
|
||||
|
||||
include $(GOROOT)/src/Make.pkg
|
||||
|
||||
|
|
33
dns.y
33
dns.y
|
@ -6,3 +6,36 @@ package dns
|
|||
// A yacc parser for DNS Resource Records contained in strings
|
||||
|
||||
%}
|
||||
|
||||
%union {
|
||||
string string
|
||||
rrtype uint16
|
||||
class uint16
|
||||
ttl uint16
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Types known to package dns
|
||||
*/
|
||||
%token <rrtype> RR_A RR_NS RR_MX RR_CNAME RR_AAAA RR_DNSKEY RR_RRSIG RR_DS
|
||||
|
||||
/*
|
||||
* Other elements of the Resource Records
|
||||
*/
|
||||
%token <ttl> TTL
|
||||
%token <class> CLASS
|
||||
%token <string> STR
|
||||
%%
|
||||
rr: name TTL CLASS
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
name: label
|
||||
| name '.' label
|
||||
|
||||
label: STR
|
||||
%%
|
||||
|
||||
type DnsLex int
|
||||
|
|
Loading…
Reference in New Issue