From 9446a8cea07a4b4345bbec637378a60c28a70e88 Mon Sep 17 00:00:00 2001 From: Anders Nygren Date: Tue, 24 Feb 2009 17:59:56 -0600 Subject: [PATCH] Initial import --- Makefile | 10 + bin/abnfc | 39 ++ include.mk | 58 ++ include/abnfc_ast.hrl | 19 + samples/Makefile | 31 + samples/http_1_1/README | 2 + samples/http_1_1/rfc2616.abnf | 509 +++++++++++++++++ samples/rfc1035/Makefile | 12 + samples/rfc1035/rfc1035.abnf | 29 + samples/rfc1035/rfc1035.hrl | 20 + samples/rfc2806/Makefile | 12 + samples/rfc2806/rfc2806.abnf | 136 +++++ samples/rfc2806/rfc2806.hrl | 16 + samples/rfc3325/Makefile | 12 + samples/rfc3325/rfc3325.abnf | 9 + samples/rfc3325/rfc3325.hrl | 5 + samples/rfc3325/rfc3325.txt | 1011 +++++++++++++++++++++++++++++++++ samples/sdp/Makefile | 12 + samples/sdp/rfc4566.abnf | 247 ++++++++ samples/sdp/rfc4566.hrl | 15 + samples/sip/Makefile | 12 + samples/sip/rfc3261.abnf | 849 +++++++++++++++++++++++++++ samples/sip/rfc3261.hrl | 18 + samples/uri/Makefile | 12 + samples/uri/rfc3986.abnf | 95 ++++ samples/uri/rfc3986.hrl | 8 + src/Makefile | 14 + src/abnfc.app.src | 9 + src/abnfc.erl | 160 ++++++ src/abnfc_ast.erl | 68 +++ src/abnfc_gen.erl | 271 +++++++++ src/abnfc_rfc4234.abnf | 104 ++++ src/abnfc_rfc4234.erl | 644 +++++++++++++++++++++ src/abnfc_rfc4234.hrl | 33 ++ src/rfc4234_core.abnf | 32 ++ src/rfc4234_core.erl | 273 +++++++++ src/rfc4234_core.hrl | 10 + vsn.mk | 1 + 38 files changed, 4817 insertions(+) create mode 100755 Makefile create mode 100755 bin/abnfc create mode 100644 include.mk create mode 100644 include/abnfc_ast.hrl create mode 100755 samples/Makefile create mode 100644 samples/http_1_1/README create mode 100644 samples/http_1_1/rfc2616.abnf create mode 100755 samples/rfc1035/Makefile create mode 100644 samples/rfc1035/rfc1035.abnf create mode 100644 samples/rfc1035/rfc1035.hrl create mode 100755 samples/rfc2806/Makefile create mode 100644 samples/rfc2806/rfc2806.abnf create mode 100644 samples/rfc2806/rfc2806.hrl create mode 100755 samples/rfc3325/Makefile create mode 100644 samples/rfc3325/rfc3325.abnf create mode 100644 samples/rfc3325/rfc3325.hrl create mode 100644 samples/rfc3325/rfc3325.txt create mode 100755 samples/sdp/Makefile create mode 100644 samples/sdp/rfc4566.abnf create mode 100644 samples/sdp/rfc4566.hrl create mode 100755 samples/sip/Makefile create mode 100644 samples/sip/rfc3261.abnf create mode 100644 samples/sip/rfc3261.hrl create mode 100755 samples/uri/Makefile create mode 100644 samples/uri/rfc3986.abnf create mode 100644 samples/uri/rfc3986.hrl create mode 100755 src/Makefile create mode 100755 src/abnfc.app.src create mode 100644 src/abnfc.erl create mode 100644 src/abnfc_ast.erl create mode 100644 src/abnfc_gen.erl create mode 100644 src/abnfc_rfc4234.abnf create mode 100644 src/abnfc_rfc4234.erl create mode 100644 src/abnfc_rfc4234.hrl create mode 100644 src/rfc4234_core.abnf create mode 100644 src/rfc4234_core.erl create mode 100644 src/rfc4234_core.hrl create mode 100755 vsn.mk diff --git a/Makefile b/Makefile new file mode 100755 index 0000000..ae299aa --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +SUBDIRS=src \ + samples/abnf \ +# samples/sdp \ +# samples/sip + +include ./subdir.mk +include ./vsn.mk + +APPNAME=abnf +DOC_OPTS=[{def,{vsn,"$(ABNF_VSN)"}}] diff --git a/bin/abnfc b/bin/abnfc new file mode 100755 index 0000000..5344418 --- /dev/null +++ b/bin/abnfc @@ -0,0 +1,39 @@ +#!/usr/local/bin/escript +%% -*- erlang -*- + +main(["?"]) -> + usage(); +main([File]) -> + do_it(File,[]); +main(Args) -> + try parse_args(Args) of + {File, Opts} -> + do_it(File,Opts) + catch + _:_ -> + usage() + end. + +do_it(File, Opts) -> + ScriptDir = filename:dirname(escript:script_name()), + EBIN = filename:join([ScriptDir,"../ebin"]), + code:add_patha(EBIN), + R = abnfc:file(File, Opts), + io:format("~p~n",[R]). + +usage() -> + io:format("~s~n",["Usage: abnfc [-o OutDir] [-I InclDir] [-mod Module] File"]). + +parse_args(Args) -> + parse_args(Args, []). + +parse_args(["-o", OutDir|More], Acc) -> + parse_args(More, [{o,OutDir}|Acc]); +parse_args(["-mod",Mod|More], Acc) -> + parse_args(More, [{mod,Mod}|Acc]); +parse_args(["-noobj"|More], Acc) -> + parse_args(More, [noobj|Acc]); +parse_args(["-I",IncludeDir|More], Acc) -> + parse_args(More, [{i,IncludeDir}|Acc]); +parse_args([File], Acc) -> + {File, lists:reverse(Acc)}. diff --git a/include.mk b/include.mk new file mode 100644 index 0000000..161fe03 --- /dev/null +++ b/include.mk @@ -0,0 +1,58 @@ +## -*- makefile -*- + +###################################################################### +## Erlang + +ERL := /usr/local/bin/erl +ERLC := /usr/local/bin/erlc +ABNFC := ../../bin/abnfc + +ERLDIR := /usr/local/lib/erlang +ERL_C_INCLUDE_DIR := $(ERLDIR)/usr/include + +ERLC_FLAGS := -W -I ../include + +ifndef no_debug_info + ERLC_FLAGS += +debug_info +endif + +ifdef debug + ERLC_FLAGS += -Ddebug +endif + +EBIN_DIR := ../ebin +DOC_DIR := ../doc +EMULATOR := beam + +ERL_SOURCES := $(wildcard *.erl) +ERL_HEADERS := $(wildcard *.hrl) $(wildcard ../include/*.hrl) +ERL_OBJECTS := $(ERL_SOURCES:%.erl=$(EBIN_DIR)/%.$(EMULATOR)) +ERL_DOCUMENTS := $(ERL_SOURCES:%.erl=$(DOC_DIR)/%.html) +MODULES = $(ERL_SOURCES:%.erl=%) + +# Hmm, don't know if you are supposed to like this better... ;-) +APPSCRIPT = '$$vsn=shift; $$mods=""; while(@ARGV){ $$_=shift; s/^([A-Z].*)$$/\'\''$$1\'\''/; $$mods.=", " if $$mods; $$mods .= $$_; } while(<>) { s/%VSN%/$$vsn/; s/%MODULES%/$$mods/; print; }' + + +../ebin/%.app: %.app.src ../vsn.mk Makefile + perl -e $(APPSCRIPT) "$(VSN)" $(MODULES) < $< > $@ + +../ebin/%.appup: %.appup + cp $< $@ + + +$(EBIN_DIR)/%.$(EMULATOR): %.erl + $(ERLC) $(ERLC_FLAGS) -o $(EBIN_DIR) $< + +$(EBIN_DIR)/%.$(EMULATOR): %.abnf + $(ABNFC) -o $(EBIN_DIR) $< + + +# generate documentation with edoc: +# this is still not the proper way to do it, but it works +# (see the wumpus application for an example) + +$(DOC_DIR)/%.html: %.erl + ${ERL} -noshell \ + -run edoc file $< -run init stop + mv *.html $(DOC_DIR) diff --git a/include/abnfc_ast.hrl b/include/abnfc_ast.hrl new file mode 100644 index 0000000..75eadb7 --- /dev/null +++ b/include/abnfc_ast.hrl @@ -0,0 +1,19 @@ +-record(rulelist, {mod, rules=[]}). + +-record(rule, {type, name, body, code}). + +-record(rulename, {name}). + +-record(alt, {alts=[]}). + +-record(seq, {elements=[]}). + +-record(repeat, {min=0, max=infinity, body}). + +-record(char_range, {from, to}). + +-record(char_alt, {alts=[]}). + +-record(char_seq, {elements=[]}). + +-record(char_val, {value=[]}). diff --git a/samples/Makefile b/samples/Makefile new file mode 100755 index 0000000..97437a4 --- /dev/null +++ b/samples/Makefile @@ -0,0 +1,31 @@ +LIBS := rfc1035 \ + rfc2806 \ + rfc3325 \ + sdp \ + sip \ + uri +# http_1_1 + +all: $(LIBS) + +docs: + @for dir in $(LIBS); do \ + if [ ! -f $@/SKIP ]; then \ + (cd $$dir; $(MAKE) $@) \ + fi \ + done + +clean: + @for dir in $(LIBS); do \ + if [ ! -f $@/SKIP ]; then \ + (cd $$dir; $(MAKE) $@) \ + fi \ + done + +$(LIBS): + @if [ ! -f $@/SKIP ]; then \ + (cd $@; $(MAKE) all) \ + fi + +.PHONY: $(LIBS) + diff --git a/samples/http_1_1/README b/samples/http_1_1/README new file mode 100644 index 0000000..e82e6ad --- /dev/null +++ b/samples/http_1_1/README @@ -0,0 +1,2 @@ +RFC 2616 uses an older variant of ABNF that is not yet supported by +ABNFC. \ No newline at end of file diff --git a/samples/http_1_1/rfc2616.abnf b/samples/http_1_1/rfc2616.abnf new file mode 100644 index 0000000..bc7692f --- /dev/null +++ b/samples/http_1_1/rfc2616.abnf @@ -0,0 +1,509 @@ +;;;===================================================================== +;;; ABNF for HTTP 1.1, according to RFC 2616. +;;; See http://tools.ietf.org/html/rfc2616 +;;; Note: that this file contains a non standard ABNF notation. +;;;===================================================================== +; +; OCTET = +; CHAR = +; UPALPHA = +; LOALPHA = +; ALPHA = UPALPHA | LOALPHA +; DIGIT = +; CTL = +; CR = +; LF = +; SP = +; HT = +; <"> = + +CRLF = CR LF + +LWS = [CRLF] 1*( SP | HT ) + +TEXT = + +HEX = "A" | "B" | "C" | "D" | "E" | "F" + | "a" | "b" | "c" | "d" | "e" | "f" | DIGIT + +token = 1* + +separators = "(" | ")" | "<" | ">" | "@" + | "," | ";" | ":" | "\" | <"> + | "/" | "[" | "]" | "?" | "=" + | "{" | "}" | SP | HT + +comment = "(" *( ctext | quoted-pair | comment ) ")" + +ctext = + +quoted-string = ( <"> *(qdtext | quoted-pair ) <"> ) + +qdtext = > + +quoted-pair = "\" CHAR + + +HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT + +http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]] + +HTTP-date = rfc1123-date | rfc850-date | asctime-date + +rfc1123-date = wkday "," SP date1 SP time SP "GMT" + +rfc850-date = weekday "," SP date2 SP time SP "GMT" + +asctime-date = wkday SP date3 SP time SP 4DIGIT + +date1 = 2DIGIT SP month SP 4DIGIT + ; day month year (e.g., 02 Jun 1982) + +date2 = 2DIGIT "-" month "-" 2DIGIT + ; day-month-year (e.g., 02-Jun-82) + +date3 = month SP ( 2DIGIT | ( SP 1DIGIT )) + ; month day (e.g., Jun 2) + +time = 2DIGIT ":" 2DIGIT ":" 2DIGIT + ; 00:00:00 - 23:59:59 + +wkday = "Mon" | "Tue" | "Wed" + | "Thu" | "Fri" | "Sat" | "Sun" + +weekday = "Monday" | "Tuesday" | "Wednesday" + | "Thursday" | "Friday" | "Saturday" | "Sunday" + +month = "Jan" | "Feb" | "Mar" | "Apr" + | "May" | "Jun" | "Jul" | "Aug" + | "Sep" | "Oct" | "Nov" | "Dec" + +delta-seconds = 1*DIGIT + +charset = token + +content-coding = token + +transfer-coding = "chunked" | transfer-extension + +transfer-extension = token *( ";" parameter ) + +parameter = attribute "=" value + +attribute = token + +value = token | quoted-string + +Chunked-Body = *chunk + last-chunk + trailer + CRLF + +chunk = chunk-size [ chunk-extension ] CRLF chunk-data CRLF + +chunk-size = 1*HEX + +last-chunk = 1*("0") [ chunk-extension ] CRLF + +chunk-extension = *( ";" chunk-ext-name [ "=" chunk-ext-val ] ) + +chunk-ext-name = token + +chunk-ext-val = token | quoted-string + +chunk-data = chunk-size(OCTET) + +trailer = *(entity-header CRLF) + +media-type = type "/" subtype *( ";" parameter ) + +type = token + +subtype = token + +product = token ["/" product-version] + +product-version = token + +qvalue = ( "0" [ "." 0*3DIGIT ] ) + | ( "1" [ "." 0*3("0") ] ) + + +language-tag = primary-tag *( "-" subtag ) + +primary-tag = 1*8ALPHA + +subtag = 1*8ALPHA + +entity-tag = [ weak ] opaque-tag + +weak = "W/" + +opaque-tag = quoted-string + +range-unit = bytes-unit | other-range-unit + +bytes-unit = "bytes" + +other-range-unit = token + +HTTP-message = Request | Response ; HTTP/1.1 messages + +generic-message = start-line + *(message-header CRLF) + CRLF + [ message-body ] + +start-line = Request-Line | Status-Line + +message-header = field-name ":" [ field-value ] + +field-name = token + +field-value = *( field-content | LWS ) + +field-content = + +message-body = entity-body + | + +general-header = Cache-Control ; Section 14.9 + | Connection ; Section 14.10 + | Date ; Section 14.18 + | Pragma ; Section 14.32 + | Trailer ; Section 14.40 + | Transfer-Encoding ; Section 14.41 + | Upgrade ; Section 14.42 + | Via ; Section 14.45 + | Warning ; Section 14.46 + +Request = Request-Line ; Section 5.1 + *(( general-header ; Section 4.5 + | request-header ; Section 5.3 + | entity-header ) CRLF) ; Section 7.1 + CRLF + [ message-body ] ; Section 4.3 + +Request-Line = Method SP Request-URI SP HTTP-Version CRLF + +Method = "OPTIONS" ; Section 9.2 + | "GET" ; Section 9.3 + | "HEAD" ; Section 9.4 + | "POST" ; Section 9.5 + | "PUT" ; Section 9.6 + | "DELETE" ; Section 9.7 + | "TRACE" ; Section 9.8 + | "CONNECT" ; Section 9.9 + | extension-method + +extension-method = token + +Request-URI = "*" | absoluteURI | abs_path | authority + +request-header = Accept ; Section 14.1 + | Accept-Charset ; Section 14.2 + | Accept-Encoding ; Section 14.3 + | Accept-Language ; Section 14.4 + | Authorization ; Section 14.8 + | Expect ; Section 14.20 + | From ; Section 14.22 + | Host ; Section 14.23 + | If-Match ; Section 14.24 + | If-Modified-Since ; Section 14.25 + | If-None-Match ; Section 14.26 + | If-Range ; Section 14.27 + | If-Unmodified-Since ; Section 14.28 + | Max-Forwards ; Section 14.31 + | Proxy-Authorization ; Section 14.34 + | Range ; Section 14.35 + | Referer ; Section 14.36 + | TE ; Section 14.39 + | User-Agent ; Section 14.43 + +Response = Status-Line ; Section 6.1 + *(( general-header ; Section 4.5 + | response-header ; Section 6.2 + | entity-header ) CRLF) ; Section 7.1 + CRLF + [ message-body ] ; Section 7.2 + +Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF + +Status-Code = "100" ; Section 10.1.1: Continue + | "101" ; Section 10.1.2: Switching Protocols + | "200" ; Section 10.2.1: OK + | "201" ; Section 10.2.2: Created + | "202" ; Section 10.2.3: Accepted + | "203" ; Section 10.2.4: Non-Authoritative Information + | "204" ; Section 10.2.5: No Content + | "205" ; Section 10.2.6: Reset Content + | "206" ; Section 10.2.7: Partial Content + | "300" ; Section 10.3.1: Multiple Choices + | "301" ; Section 10.3.2: Moved Permanently + | "302" ; Section 10.3.3: Found + | "303" ; Section 10.3.4: See Other + | "304" ; Section 10.3.5: Not Modified + | "305" ; Section 10.3.6: Use Proxy + | "307" ; Section 10.3.8: Temporary Redirect + | "400" ; Section 10.4.1: Bad Request + | "401" ; Section 10.4.2: Unauthorized + | "402" ; Section 10.4.3: Payment Required + | "403" ; Section 10.4.4: Forbidden + | "404" ; Section 10.4.5: Not Found + | "405" ; Section 10.4.6: Method Not Allowed + | "406" ; Section 10.4.7: Not Acceptable + | "407" ; Section 10.4.8: Proxy Authentication Required + | "408" ; Section 10.4.9: Request Time-out + | "409" ; Section 10.4.10: Conflict + | "410" ; Section 10.4.11: Gone + | "411" ; Section 10.4.12: Length Required + | "412" ; Section 10.4.13: Precondition Failed + | "413" ; Section 10.4.14: Request Entity Too Large + | "414" ; Section 10.4.15: Request-URI Too Large + | "415" ; Section 10.4.16: Unsupported Media Type + | "416" ; Section 10.4.17: Requested range not satisfiable + | "417" ; Section 10.4.18: Expectation Failed + | "500" ; Section 10.5.1: Internal Server Error + | "501" ; Section 10.5.2: Not Implemented + | "502" ; Section 10.5.3: Bad Gateway + | "503" ; Section 10.5.4: Service Unavailable + | "504" ; Section 10.5.5: Gateway Time-out + | "505" ; Section 10.5.6: HTTP Version not supported + | extension-code + +extension-code = 3DIGIT + +Reason-Phrase = * + +response-header = Accept-Ranges ; Section 14.5 + | Age ; Section 14.6 + | ETag ; Section 14.19 + | Location ; Section 14.30 + | Proxy-Authenticate ; Section 14.33 + | Retry-After ; Section 14.37 + | Server ; Section 14.38 + | Vary ; Section 14.44 + | WWW-Authenticate ; Section 14.47 + +entity-header = Allow ; Section 14.7 + | Content-Encoding ; Section 14.11 + | Content-Language ; Section 14.12 + | Content-Length ; Section 14.13 + | Content-Location ; Section 14.14 + | Content-MD5 ; Section 14.15 + | Content-Range ; Section 14.16 + | Content-Type ; Section 14.17 + | Expires ; Section 14.21 + | Last-Modified ; Section 14.29 + | extension-header + +extension-header = message-header + +entity-body = *OCTET + + + +Accept = "Accept" ":" #( media-range [ accept-params ] ) + +media-range = ( "*/*" | ( type "/" "*" ) | ( type "/" subtype )) + *( ";" parameter ) + +accept-params = ";" "q" "=" qvalue *( accept-extension ) + +accept-extension = ";" token [ "=" ( token | quoted-string ) ] + +Accept-Charset = "Accept-Charset" ":" 1#( ( charset | "*" ) + [ ";" "q" "=" qvalue ] ) + +Accept-Encoding = "Accept-Encoding" ":" + 1#( codings [ ";" "q" "=" qvalue ] ) + +codings = ( content-coding | "*" ) + +Accept-Language = "Accept-Language" ":" + 1#( language-range [ ";" "q" "=" qvalue ] ) +language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" ) + +Accept-Ranges = "Accept-Ranges" ":" acceptable-ranges + +acceptable-ranges = 1#range-unit | "none" + +Age = "Age" ":" age-value +age-value = delta-seconds + +Allow = "Allow" ":" #Method + +Authorization = "Authorization" ":" credentials + +Cache-Control = "Cache-Control" ":" 1#cache-directive + +cache-directive = cache-request-directive | cache-response-directive + +cache-request-directive = + "no-cache" ; Section 14.9.1 + | "no-store" ; Section 14.9.2 + | "max-age" "=" delta-seconds ; Section 14.9.3, 14.9.4 + | "max-stale" [ "=" delta-seconds ]; Section 14.9.3 + | "min-fresh" "=" delta-seconds ; Section 14.9.3 + | "no-transform" ; Section 14.9.5 + | "only-if-cached" ; Section 14.9.4 + | cache-extension ; Section 14.9.6 + +cache-response-directive = + "public" ; Section 14.9.1 + | "private" [ "=" <"> 1#field-name <"> ] ; Section 14.9.1 + | "no-cache" [ "=" <"> 1#field-name <"> ]; Section 14.9.1 + | "no-store" ; Section 14.9.2 + | "no-transform" ; Section 14.9.5 + | "must-revalidate" ; Section 14.9.4 + | "proxy-revalidate" ; Section 14.9.4 + | "max-age" "=" delta-seconds ; Section 14.9.3 + | "s-maxage" "=" delta-seconds ; Section 14.9.3 + | cache-extension ; Section 14.9.6 + +cache-extension = token [ "=" ( token | quoted-string ) ] + +Connection = "Connection" ":" 1#(connection-token) + +connection-token = token + +Content-Encoding = "Content-Encoding" ":" 1#content-coding + +Content-Language = "Content-Language" ":" 1#language-tag + +Content-Length = "Content-Length" ":" 1*DIGIT + +Content-Location = "Content-Location" ":" ( absoluteURI | relativeURI ) + +Content-MD5 = "Content-MD5" ":" md5-digest + +md5-digest = + +Content-Range = "Content-Range" ":" content-range-spec + +content-range-spec = byte-content-range-spec + +byte-content-range-spec = bytes-unit SP byte-range-resp-spec "/" + ( instance-length | "*" ) + +byte-range-resp-spec = (first-byte-pos "-" last-byte-pos) | "*" + +instance-length = 1*DIGIT + +Content-Type = "Content-Type" ":" media-type + +Date = "Date" ":" HTTP-date + +ETag = "ETag" ":" entity-tag + +Expect = "Expect" ":" 1#expectation + +expectation = "100-continue" | expectation-extension + +expectation-extension = token [ "=" ( token | quoted-string ) + *expect-params ] + +expect-params = ";" token [ "=" ( token | quoted-string ) ] + +Expires = "Expires" ":" HTTP-date + +From = "From" ":" mailbox + +Host = "Host" ":" host [ ":" port ] ; Section 3.2.2 + +If-Match = "If-Match" ":" ( "*" | 1#entity-tag ) + +If-Modified-Since = "If-Modified-Since" ":" HTTP-date + +If-None-Match = "If-None-Match" ":" ( "*" | 1#entity-tag ) + +If-Range = "If-Range" ":" ( entity-tag | HTTP-date ) + +If-Unmodified-Since = "If-Unmodified-Since" ":" HTTP-date + +Last-Modified = "Last-Modified" ":" HTTP-date + +Location = "Location" ":" absoluteURI + +Max-Forwards = "Max-Forwards" ":" 1*DIGIT + +Pragma = "Pragma" ":" 1#pragma-directive + +pragma-directive = "no-cache" | extension-pragma + +extension-pragma = token [ "=" ( token | quoted-string ) ] + +Proxy-Authenticate = "Proxy-Authenticate" ":" 1#challenge + +Proxy-Authorization = "Proxy-Authorization" ":" credentials + +ranges-specifier = byte-ranges-specifier + +byte-ranges-specifier = bytes-unit "=" byte-range-set + +byte-range-set = 1#( byte-range-spec | suffix-byte-range-spec ) + +byte-range-spec = first-byte-pos "-" [last-byte-pos] + +first-byte-pos = 1*DIGIT + +last-byte-pos = 1*DIGIT + +suffix-byte-range-spec = "-" suffix-length + +suffix-length = 1*DIGIT + +Range = "Range" ":" ranges-specifier + +Referer = "Referer" ":" ( absoluteURI | relativeURI ) + +Retry-After = "Retry-After" ":" ( HTTP-date | delta-seconds ) + +Server = "Server" ":" 1*( product | comment ) + +TE = "TE" ":" #( t-codings ) + +t-codings = "trailers" + | ( transfer-extension [ accept-params ] ) + +Trailer = "Trailer" ":" 1#field-name + +Transfer-Encoding = "Transfer-Encoding" ":" 1#transfer-coding + +Upgrade = "Upgrade" ":" 1#product + +User-Agent = "User-Agent" ":" 1*( product | comment ) + +Vary = "Vary" ":" ( "*" | 1#field-name ) + +Via = "Via" ":" 1#( received-protocol received-by [ comment ] ) + +received-protocol = [ protocol-name "/" ] protocol-version + +protocol-name = token + +protocol-version = token + +received-by = ( host [ ":" port ] ) | pseudonym + +pseudonym = token + +Warning = "Warning" ":" 1#warning-value + +warning-value = warn-code SP warn-agent SP warn-text [SP warn-date] + +warn-code = 3DIGIT + +warn-agent = ( host [ ":" port ] ) | pseudonym + ; the name or pseudonym of the server adding + ; the Warning header, for use in debugging + +warn-text = quoted-string + +warn-date = <"> HTTP-date <"> + +WWW-Authenticate = "WWW-Authenticate" ":" 1#challenge + diff --git a/samples/rfc1035/Makefile b/samples/rfc1035/Makefile new file mode 100755 index 0000000..4686ed7 --- /dev/null +++ b/samples/rfc1035/Makefile @@ -0,0 +1,12 @@ +include ../../include.mk + +ABNF_SOURCES := $(wildcard *.abnf) +ABNF_OBJECTS := $(ABNF_SOURCES:%.abnf=./%.erl) +ERL_OBJECTS := $(ABNF_SOURCES:%.abnf=$(EBIN_DIR)/%.$(EMULATOR)) + +all: $(ERL_OBJECTS) + +clean: + -rm $(ERL_OBJECTS) $(ABNF_OBJECTS) + +$(EBIN_DIR)/rfc1035.beam: rfc1035.hrl diff --git a/samples/rfc1035/rfc1035.abnf b/samples/rfc1035/rfc1035.abnf new file mode 100644 index 0000000..cafd0e7 --- /dev/null +++ b/samples/rfc1035/rfc1035.abnf @@ -0,0 +1,29 @@ +; ::= | " " +; +; ::=