diff --git a/.gitignore b/.gitignore index 7d1e7398751a96ddfe87e044e5799228bde781a9..ceacbb1d636d950470486ed8962152a9c6651d14 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,19 @@ -doc -_build .rebar3 -rebar3 -rebar.lock -erl_crash.dump +_* +.eunit +*.o +*.beam +*.plt +*.swp +*.swo +.erlang.cookie +ebin +log +var +erl_crash.dump +.rebar +logs +_build +_checkouts +src/gherkin_lexer.erl +src/gherkin_parser.erl diff --git a/Makefile b/Makefile deleted file mode 100644 index 843e42fd0797895486db4b12a4c8035c968d1032..0000000000000000000000000000000000000000 --- a/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -REBAR_VERSION := $(shell rebar3 --version 2>/dev/null) -ifdef REBAR_VERSION -REBAR := rebar3 -else -REBAR := $(CURDIR)/rebar3 -$(shell if ! [ -e "$(REBAR)" ]; then curl -jksSL -o $(REBAR) https://s3.amazonaws.com/rebar3/rebar3; chmod +x $(REBAR); fi) -endif - -all: eunit - -compile: - @$(REBAR) compile - -eunit: - @$(REBAR) do eunit --cover --dir=test, cover --verbose - -dialyzer: - @$(REBAR) dialyzer - -release: - @$(REBAR) release - -edoc: - @$(REBAR) edoc - -clean: - @$(REBAR) clean - -distclean: - @rm -rf _build rebar.lock $(REBAR) diff --git a/rebar.config b/rebar.config index e884fbec3ddd0f144d5349287a6a5611571a17a7..77f906108734d95b292628445f11fb8253a779f8 100644 --- a/rebar.config +++ b/rebar.config @@ -1,6 +1,20 @@ {global_rebar_dir, ".rebar3"}. -{plugins, [rebar3_hex]}. +{plugins, [ + rebar3_hex, + rebar_alias, + {rebar_cmd, "0.2.3"} +]}. + +{erl_opts, [{parse_transform, lager_transform}]}. + +{eunit_opts, [{report, {eunit_surefire, [{dir, "_build/test"}]}}]}. + +{edoc_opts, [ + {dir, "_build/edoc"}, + {preprocess, true}, + {includes, ["include"]} +]}. {relx, [ {release, {gurka, semver}, [gurka]}, @@ -9,21 +23,43 @@ {extended_start_script, true} ]}. -{edoc_opts, [ - {preprocess, true}, - {includes, ["include"]} -]}. - {profiles, [ {test, [ {eunit_opts, [{report, {eunit_surefire, [{dir, "_build/test"}]}}]}, {erl_opts, [debug_info, nowarn_unused_vars]} ]}, - {production, [ - {relx, [ - {dev_mode, false}, - {include_erts, false} - ]}, + {prod, [ {erl_opts, [no_debug_info, warnings_as_errors]} ]} ]}. + +{dist_node, [ + {setcookie, 'cookie'}, + {sname, 'gurka@localhost'} +]}. + +{dialyzer, [ + {base_plt_location, global} +]}. + +{alias, [ + {test, [ + {eunit, "--cover --application=gurka --dir=test"}, + {cover, "--verbose"} + ]}, + {analyze, [ + dialyzer, + xref + ]}, + {cleanup, [ + clean, + {cmd, "distclean"} + ]} +]}. + +{commands, [ + {distclean, "rm -rf .rebar3 _build _checkouts/*/ebin ebin log"}, + {sync, "git fetch upstream && git merge upstream/master"} +]}. + + diff --git a/src/gherkin_lexer.erl b/src/gherkin_lexer.erl deleted file mode 100644 index bb272f3ce5ea44c2dfdba2d9e70b131f19ccb9d0..0000000000000000000000000000000000000000 --- a/src/gherkin_lexer.erl +++ /dev/null @@ -1,967 +0,0 @@ --file("/usr/local/Cellar/erlang/18.3/lib/erlang/lib/parsetools-2.1.1/include/leexinc.hrl", 0). -%% The source of this file is part of leex distribution, as such it -%% has the same Copyright as the other files in the leex -%% distribution. The Copyright is defined in the accompanying file -%% COPYRIGHT. However, the resultant scanner generated by leex is the -%% property of the creator of the scanner and is not covered by that -%% Copyright. - --module(gherkin_lexer). - --export([string/1,string/2,token/2,token/3,tokens/2,tokens/3]). --export([format_error/1]). - -%% User code. This is placed here to allow extra attributes. --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 37). - --file("/usr/local/Cellar/erlang/18.3/lib/erlang/lib/parsetools-2.1.1/include/leexinc.hrl", 14). - -format_error({illegal,S}) -> ["illegal characters ",io_lib:write_string(S)]; -format_error({user,S}) -> S. - -string(String) -> string(String, 1). - -string(String, Line) -> string(String, Line, String, []). - -%% string(InChars, Line, TokenChars, Tokens) -> -%% {ok,Tokens,Line} | {error,ErrorInfo,Line}. -%% Note the line number going into yystate, L0, is line of token -%% start while line number returned is line of token end. We want line -%% of token start. - -string([], L, [], Ts) -> % No partial tokens! - {ok,yyrev(Ts),L}; -string(Ics0, L0, Tcs, Ts) -> - case yystate(yystate(), Ics0, L0, 0, reject, 0) of - {A,Alen,Ics1,L1} -> % Accepting end state - string_cont(Ics1, L1, yyaction(A, Alen, Tcs, L0), Ts); - {A,Alen,Ics1,L1,_S1} -> % Accepting transistion state - string_cont(Ics1, L1, yyaction(A, Alen, Tcs, L0), Ts); - {reject,_Alen,Tlen,_Ics1,L1,_S1} -> % After a non-accepting state - {error,{L0,?MODULE,{illegal,yypre(Tcs, Tlen+1)}},L1}; - {A,Alen,_Tlen,_Ics1,_L1,_S1} -> - string_cont(yysuf(Tcs, Alen), L0, yyaction(A, Alen, Tcs, L0), Ts) - end. - -%% string_cont(RestChars, Line, Token, Tokens) -%% Test for and remove the end token wrapper. Push back characters -%% are prepended to RestChars. - --dialyzer({nowarn_function, string_cont/4}). - -string_cont(Rest, Line, {token,T}, Ts) -> - string(Rest, Line, Rest, [T|Ts]); -string_cont(Rest, Line, {token,T,Push}, Ts) -> - NewRest = Push ++ Rest, - string(NewRest, Line, NewRest, [T|Ts]); -string_cont(Rest, Line, {end_token,T}, Ts) -> - string(Rest, Line, Rest, [T|Ts]); -string_cont(Rest, Line, {end_token,T,Push}, Ts) -> - NewRest = Push ++ Rest, - string(NewRest, Line, NewRest, [T|Ts]); -string_cont(Rest, Line, skip_token, Ts) -> - string(Rest, Line, Rest, Ts); -string_cont(Rest, Line, {skip_token,Push}, Ts) -> - NewRest = Push ++ Rest, - string(NewRest, Line, NewRest, Ts); -string_cont(_Rest, Line, {error,S}, _Ts) -> - {error,{Line,?MODULE,{user,S}},Line}. - -%% token(Continuation, Chars) -> -%% token(Continuation, Chars, Line) -> -%% {more,Continuation} | {done,ReturnVal,RestChars}. -%% Must be careful when re-entering to append the latest characters to the -%% after characters in an accept. The continuation is: -%% {token,State,CurrLine,TokenChars,TokenLen,TokenLine,AccAction,AccLen} - -token(Cont, Chars) -> token(Cont, Chars, 1). - -token([], Chars, Line) -> - token(yystate(), Chars, Line, Chars, 0, Line, reject, 0); -token({token,State,Line,Tcs,Tlen,Tline,Action,Alen}, Chars, _) -> - token(State, Chars, Line, Tcs ++ Chars, Tlen, Tline, Action, Alen). - -%% token(State, InChars, Line, TokenChars, TokenLen, TokenLine, -%% AcceptAction, AcceptLen) -> -%% {more,Continuation} | {done,ReturnVal,RestChars}. -%% The argument order is chosen to be more efficient. - -token(S0, Ics0, L0, Tcs, Tlen0, Tline, A0, Alen0) -> - case yystate(S0, Ics0, L0, Tlen0, A0, Alen0) of - %% Accepting end state, we have a token. - {A1,Alen1,Ics1,L1} -> - token_cont(Ics1, L1, yyaction(A1, Alen1, Tcs, Tline)); - %% Accepting transition state, can take more chars. - {A1,Alen1,[],L1,S1} -> % Need more chars to check - {more,{token,S1,L1,Tcs,Alen1,Tline,A1,Alen1}}; - {A1,Alen1,Ics1,L1,_S1} -> % Take what we got - token_cont(Ics1, L1, yyaction(A1, Alen1, Tcs, Tline)); - %% After a non-accepting state, maybe reach accept state later. - {A1,Alen1,Tlen1,[],L1,S1} -> % Need more chars to check - {more,{token,S1,L1,Tcs,Tlen1,Tline,A1,Alen1}}; - {reject,_Alen1,Tlen1,eof,L1,_S1} -> % No token match - %% Check for partial token which is error. - Ret = if Tlen1 > 0 -> {error,{Tline,?MODULE, - %% Skip eof tail in Tcs. - {illegal,yypre(Tcs, Tlen1)}},L1}; - true -> {eof,L1} - end, - {done,Ret,eof}; - {reject,_Alen1,Tlen1,Ics1,L1,_S1} -> % No token match - Error = {Tline,?MODULE,{illegal,yypre(Tcs, Tlen1+1)}}, - {done,{error,Error,L1},Ics1}; - {A1,Alen1,_Tlen1,_Ics1,_L1,_S1} -> % Use last accept match - token_cont(yysuf(Tcs, Alen1), L0, yyaction(A1, Alen1, Tcs, Tline)) - end. - -%% token_cont(RestChars, Line, Token) -%% If we have a token or error then return done, else if we have a -%% skip_token then continue. - --dialyzer({nowarn_function, token_cont/3}). - -token_cont(Rest, Line, {token,T}) -> - {done,{ok,T,Line},Rest}; -token_cont(Rest, Line, {token,T,Push}) -> - NewRest = Push ++ Rest, - {done,{ok,T,Line},NewRest}; -token_cont(Rest, Line, {end_token,T}) -> - {done,{ok,T,Line},Rest}; -token_cont(Rest, Line, {end_token,T,Push}) -> - NewRest = Push ++ Rest, - {done,{ok,T,Line},NewRest}; -token_cont(Rest, Line, skip_token) -> - token(yystate(), Rest, Line, Rest, 0, Line, reject, 0); -token_cont(Rest, Line, {skip_token,Push}) -> - NewRest = Push ++ Rest, - token(yystate(), NewRest, Line, NewRest, 0, Line, reject, 0); -token_cont(Rest, Line, {error,S}) -> - {done,{error,{Line,?MODULE,{user,S}},Line},Rest}. - -%% tokens(Continuation, Chars, Line) -> -%% {more,Continuation} | {done,ReturnVal,RestChars}. -%% Must be careful when re-entering to append the latest characters to the -%% after characters in an accept. The continuation is: -%% {tokens,State,CurrLine,TokenChars,TokenLen,TokenLine,Tokens,AccAction,AccLen} -%% {skip_tokens,State,CurrLine,TokenChars,TokenLen,TokenLine,Error,AccAction,AccLen} - -tokens(Cont, Chars) -> tokens(Cont, Chars, 1). - -tokens([], Chars, Line) -> - tokens(yystate(), Chars, Line, Chars, 0, Line, [], reject, 0); -tokens({tokens,State,Line,Tcs,Tlen,Tline,Ts,Action,Alen}, Chars, _) -> - tokens(State, Chars, Line, Tcs ++ Chars, Tlen, Tline, Ts, Action, Alen); -tokens({skip_tokens,State,Line,Tcs,Tlen,Tline,Error,Action,Alen}, Chars, _) -> - skip_tokens(State, Chars, Line, Tcs ++ Chars, Tlen, Tline, Error, Action, Alen). - -%% tokens(State, InChars, Line, TokenChars, TokenLen, TokenLine, Tokens, -%% AcceptAction, AcceptLen) -> -%% {more,Continuation} | {done,ReturnVal,RestChars}. - -tokens(S0, Ics0, L0, Tcs, Tlen0, Tline, Ts, A0, Alen0) -> - case yystate(S0, Ics0, L0, Tlen0, A0, Alen0) of - %% Accepting end state, we have a token. - {A1,Alen1,Ics1,L1} -> - tokens_cont(Ics1, L1, yyaction(A1, Alen1, Tcs, Tline), Ts); - %% Accepting transition state, can take more chars. - {A1,Alen1,[],L1,S1} -> % Need more chars to check - {more,{tokens,S1,L1,Tcs,Alen1,Tline,Ts,A1,Alen1}}; - {A1,Alen1,Ics1,L1,_S1} -> % Take what we got - tokens_cont(Ics1, L1, yyaction(A1, Alen1, Tcs, Tline), Ts); - %% After a non-accepting state, maybe reach accept state later. - {A1,Alen1,Tlen1,[],L1,S1} -> % Need more chars to check - {more,{tokens,S1,L1,Tcs,Tlen1,Tline,Ts,A1,Alen1}}; - {reject,_Alen1,Tlen1,eof,L1,_S1} -> % No token match - %% Check for partial token which is error, no need to skip here. - Ret = if Tlen1 > 0 -> {error,{Tline,?MODULE, - %% Skip eof tail in Tcs. - {illegal,yypre(Tcs, Tlen1)}},L1}; - Ts == [] -> {eof,L1}; - true -> {ok,yyrev(Ts),L1} - end, - {done,Ret,eof}; - {reject,_Alen1,Tlen1,_Ics1,L1,_S1} -> - %% Skip rest of tokens. - Error = {L1,?MODULE,{illegal,yypre(Tcs, Tlen1+1)}}, - skip_tokens(yysuf(Tcs, Tlen1+1), L1, Error); - {A1,Alen1,_Tlen1,_Ics1,_L1,_S1} -> - Token = yyaction(A1, Alen1, Tcs, Tline), - tokens_cont(yysuf(Tcs, Alen1), L0, Token, Ts) - end. - -%% tokens_cont(RestChars, Line, Token, Tokens) -%% If we have an end_token or error then return done, else if we have -%% a token then save it and continue, else if we have a skip_token -%% just continue. - --dialyzer({nowarn_function, tokens_cont/4}). - -tokens_cont(Rest, Line, {token,T}, Ts) -> - tokens(yystate(), Rest, Line, Rest, 0, Line, [T|Ts], reject, 0); -tokens_cont(Rest, Line, {token,T,Push}, Ts) -> - NewRest = Push ++ Rest, - tokens(yystate(), NewRest, Line, NewRest, 0, Line, [T|Ts], reject, 0); -tokens_cont(Rest, Line, {end_token,T}, Ts) -> - {done,{ok,yyrev(Ts, [T]),Line},Rest}; -tokens_cont(Rest, Line, {end_token,T,Push}, Ts) -> - NewRest = Push ++ Rest, - {done,{ok,yyrev(Ts, [T]),Line},NewRest}; -tokens_cont(Rest, Line, skip_token, Ts) -> - tokens(yystate(), Rest, Line, Rest, 0, Line, Ts, reject, 0); -tokens_cont(Rest, Line, {skip_token,Push}, Ts) -> - NewRest = Push ++ Rest, - tokens(yystate(), NewRest, Line, NewRest, 0, Line, Ts, reject, 0); -tokens_cont(Rest, Line, {error,S}, _Ts) -> - skip_tokens(Rest, Line, {Line,?MODULE,{user,S}}). - -%%skip_tokens(InChars, Line, Error) -> {done,{error,Error,Line},Ics}. -%% Skip tokens until an end token, junk everything and return the error. - -skip_tokens(Ics, Line, Error) -> - skip_tokens(yystate(), Ics, Line, Ics, 0, Line, Error, reject, 0). - -%% skip_tokens(State, InChars, Line, TokenChars, TokenLen, TokenLine, Tokens, -%% AcceptAction, AcceptLen) -> -%% {more,Continuation} | {done,ReturnVal,RestChars}. - -skip_tokens(S0, Ics0, L0, Tcs, Tlen0, Tline, Error, A0, Alen0) -> - case yystate(S0, Ics0, L0, Tlen0, A0, Alen0) of - {A1,Alen1,Ics1,L1} -> % Accepting end state - skip_cont(Ics1, L1, yyaction(A1, Alen1, Tcs, Tline), Error); - {A1,Alen1,[],L1,S1} -> % After an accepting state - {more,{skip_tokens,S1,L1,Tcs,Alen1,Tline,Error,A1,Alen1}}; - {A1,Alen1,Ics1,L1,_S1} -> - skip_cont(Ics1, L1, yyaction(A1, Alen1, Tcs, Tline), Error); - {A1,Alen1,Tlen1,[],L1,S1} -> % After a non-accepting state - {more,{skip_tokens,S1,L1,Tcs,Tlen1,Tline,Error,A1,Alen1}}; - {reject,_Alen1,_Tlen1,eof,L1,_S1} -> - {done,{error,Error,L1},eof}; - {reject,_Alen1,Tlen1,_Ics1,L1,_S1} -> - skip_tokens(yysuf(Tcs, Tlen1+1), L1, Error); - {A1,Alen1,_Tlen1,_Ics1,L1,_S1} -> - Token = yyaction(A1, Alen1, Tcs, Tline), - skip_cont(yysuf(Tcs, Alen1), L1, Token, Error) - end. - -%% skip_cont(RestChars, Line, Token, Error) -%% Skip tokens until we have an end_token or error then return done -%% with the original rror. - --dialyzer({nowarn_function, skip_cont/4}). - -skip_cont(Rest, Line, {token,_T}, Error) -> - skip_tokens(yystate(), Rest, Line, Rest, 0, Line, Error, reject, 0); -skip_cont(Rest, Line, {token,_T,Push}, Error) -> - NewRest = Push ++ Rest, - skip_tokens(yystate(), NewRest, Line, NewRest, 0, Line, Error, reject, 0); -skip_cont(Rest, Line, {end_token,_T}, Error) -> - {done,{error,Error,Line},Rest}; -skip_cont(Rest, Line, {end_token,_T,Push}, Error) -> - NewRest = Push ++ Rest, - {done,{error,Error,Line},NewRest}; -skip_cont(Rest, Line, skip_token, Error) -> - skip_tokens(yystate(), Rest, Line, Rest, 0, Line, Error, reject, 0); -skip_cont(Rest, Line, {skip_token,Push}, Error) -> - NewRest = Push ++ Rest, - skip_tokens(yystate(), NewRest, Line, NewRest, 0, Line, Error, reject, 0); -skip_cont(Rest, Line, {error,_S}, Error) -> - skip_tokens(yystate(), Rest, Line, Rest, 0, Line, Error, reject, 0). - -yyrev(List) -> lists:reverse(List). -yyrev(List, Tail) -> lists:reverse(List, Tail). -yypre(List, N) -> lists:sublist(List, N). -yysuf(List, N) -> lists:nthtail(N, List). - -%% yystate() -> InitialState. -%% yystate(State, InChars, Line, CurrTokLen, AcceptAction, AcceptLen) -> -%% {Action, AcceptLen, RestChars, Line} | -%% {Action, AcceptLen, RestChars, Line, State} | -%% {reject, AcceptLen, CurrTokLen, RestChars, Line, State} | -%% {Action, AcceptLen, CurrTokLen, RestChars, Line, State}. -%% Generated state transition functions. The non-accepting end state -%% return signal either an unrecognised character or end of current -%% input. - --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.erl", 284). -yystate() -> 80. - -yystate(83, Ics, Line, Tlen, _, _) -> - {6,Tlen,Ics,Line}; -yystate(82, Ics, Line, Tlen, _, _) -> - {7,Tlen,Ics,Line}; -yystate(81, [99|Ics], Line, Tlen, Action, Alen) -> - yystate(77, Ics, Line, Tlen+1, Action, Alen); -yystate(81, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,81}; -yystate(80, [124|Ics], Line, Tlen, Action, Alen) -> - yystate(76, Ics, Line, Tlen+1, Action, Alen); -yystate(80, [102|Ics], Line, Tlen, Action, Alen) -> - yystate(56, Ics, Line, Tlen+1, Action, Alen); -yystate(80, [70|Ics], Line, Tlen, Action, Alen) -> - yystate(56, Ics, Line, Tlen+1, Action, Alen); -yystate(80, [64|Ics], Line, Tlen, Action, Alen) -> - yystate(24, Ics, Line, Tlen+1, Action, Alen); -yystate(80, [60|Ics], Line, Tlen, Action, Alen) -> - yystate(16, Ics, Line, Tlen+1, Action, Alen); -yystate(80, [34|Ics], Line, Tlen, Action, Alen) -> - yystate(4, Ics, Line, Tlen+1, Action, Alen); -yystate(80, [33|Ics], Line, Tlen, Action, Alen) -> - yystate(23, Ics, Line, Tlen+1, Action, Alen); -yystate(80, [32|Ics], Line, Tlen, Action, Alen) -> - yystate(27, Ics, Line, Tlen+1, Action, Alen); -yystate(80, [13|Ics], Line, Tlen, Action, Alen) -> - yystate(31, Ics, Line, Tlen+1, Action, Alen); -yystate(80, [10|Ics], Line, Tlen, Action, Alen) -> - yystate(39, Ics, Line+1, Tlen+1, Action, Alen); -yystate(80, [C|Ics], Line, Tlen, Action, Alen) when C >= 35, C =< 59 -> - yystate(23, Ics, Line, Tlen+1, Action, Alen); -yystate(80, [C|Ics], Line, Tlen, Action, Alen) when C >= 61, C =< 63 -> - yystate(23, Ics, Line, Tlen+1, Action, Alen); -yystate(80, [C|Ics], Line, Tlen, Action, Alen) when C >= 65, C =< 69 -> - yystate(23, Ics, Line, Tlen+1, Action, Alen); -yystate(80, [C|Ics], Line, Tlen, Action, Alen) when C >= 71, C =< 101 -> - yystate(23, Ics, Line, Tlen+1, Action, Alen); -yystate(80, [C|Ics], Line, Tlen, Action, Alen) when C >= 103, C =< 123 -> - yystate(23, Ics, Line, Tlen+1, Action, Alen); -yystate(80, [C|Ics], Line, Tlen, Action, Alen) when C >= 125, C =< 65535 -> - yystate(23, Ics, Line, Tlen+1, Action, Alen); -yystate(80, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,80}; -yystate(79, [32|Ics], Line, Tlen, Action, Alen) -> - yystate(83, Ics, Line, Tlen+1, Action, Alen); -yystate(79, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,79}; -yystate(78, [32|Ics], Line, Tlen, Action, Alen) -> - yystate(82, Ics, Line, Tlen+1, Action, Alen); -yystate(78, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,78}; -yystate(77, [101|Ics], Line, Tlen, Action, Alen) -> - yystate(73, Ics, Line, Tlen+1, Action, Alen); -yystate(77, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,77}; -yystate(76, [32|Ics], Line, Tlen, Action, Alen) -> - yystate(72, Ics, Line, Tlen+1, Action, Alen); -yystate(76, [13|Ics], Line, Tlen, Action, Alen) -> - yystate(64, Ics, Line, Tlen+1, Action, Alen); -yystate(76, [10|Ics], Line, Tlen, Action, Alen) -> - yystate(60, Ics, Line+1, Tlen+1, Action, Alen); -yystate(76, [C|Ics], Line, Tlen, Action, Alen) when C >= 33, C =< 123 -> - yystate(72, Ics, Line, Tlen+1, Action, Alen); -yystate(76, [C|Ics], Line, Tlen, Action, Alen) when C >= 125, C =< 65535 -> - yystate(72, Ics, Line, Tlen+1, Action, Alen); -yystate(76, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,76}; -yystate(75, [110|Ics], Line, Tlen, Action, Alen) -> - yystate(79, Ics, Line, Tlen+1, Action, Alen); -yystate(75, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,75}; -yystate(74, [100|Ics], Line, Tlen, Action, Alen) -> - yystate(78, Ics, Line, Tlen+1, Action, Alen); -yystate(74, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,74}; -yystate(73, [110|Ics], Line, Tlen, Action, Alen) -> - yystate(69, Ics, Line, Tlen+1, Action, Alen); -yystate(73, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,73}; -yystate(72, [124|Ics], Line, Tlen, Action, Alen) -> - yystate(68, Ics, Line, Tlen+1, Action, Alen); -yystate(72, [32|Ics], Line, Tlen, Action, Alen) -> - yystate(72, Ics, Line, Tlen+1, Action, Alen); -yystate(72, [C|Ics], Line, Tlen, Action, Alen) when C >= 33, C =< 123 -> - yystate(72, Ics, Line, Tlen+1, Action, Alen); -yystate(72, [C|Ics], Line, Tlen, Action, Alen) when C >= 125, C =< 65535 -> - yystate(72, Ics, Line, Tlen+1, Action, Alen); -yystate(72, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,72}; -yystate(71, [101|Ics], Line, Tlen, Action, Alen) -> - yystate(75, Ics, Line, Tlen+1, Action, Alen); -yystate(71, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,71}; -yystate(70, [110|Ics], Line, Tlen, Action, Alen) -> - yystate(74, Ics, Line, Tlen+1, Action, Alen); -yystate(70, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,70}; -yystate(69, [97|Ics], Line, Tlen, Action, Alen) -> - yystate(65, Ics, Line, Tlen+1, Action, Alen); -yystate(69, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,69}; -yystate(68, Ics, Line, Tlen, _, _) -> - {11,Tlen,Ics,Line}; -yystate(67, [104|Ics], Line, Tlen, Action, Alen) -> - yystate(71, Ics, Line, Tlen+1, Action, Alen); -yystate(67, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,67}; -yystate(66, Ics, Line, Tlen, _, _) -> - {1,Tlen,Ics,Line}; -yystate(65, [114|Ics], Line, Tlen, Action, Alen) -> - yystate(61, Ics, Line, Tlen+1, Action, Alen); -yystate(65, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,65}; -yystate(64, [10|Ics], Line, Tlen, _, _) -> - yystate(60, Ics, Line+1, Tlen+1, 12, Tlen); -yystate(64, Ics, Line, Tlen, _, _) -> - {12,Tlen,Ics,Line,64}; -yystate(63, Ics, Line, Tlen, _, _) -> - {5,Tlen,Ics,Line}; -yystate(62, [58|Ics], Line, Tlen, Action, Alen) -> - yystate(66, Ics, Line, Tlen+1, Action, Alen); -yystate(62, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,62}; -yystate(61, [105|Ics], Line, Tlen, Action, Alen) -> - yystate(57, Ics, Line, Tlen+1, Action, Alen); -yystate(61, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,61}; -yystate(60, Ics, Line, Tlen, _, _) -> - {12,Tlen,Ics,Line}; -yystate(59, [32|Ics], Line, Tlen, Action, Alen) -> - yystate(63, Ics, Line, Tlen+1, Action, Alen); -yystate(59, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,59}; -yystate(58, [100|Ics], Line, Tlen, Action, Alen) -> - yystate(62, Ics, Line, Tlen+1, Action, Alen); -yystate(58, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,58}; -yystate(57, [111|Ics], Line, Tlen, Action, Alen) -> - yystate(53, Ics, Line, Tlen+1, Action, Alen); -yystate(57, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,57}; -yystate(56, [101|Ics], Line, Tlen, _, _) -> - yystate(52, Ics, Line, Tlen+1, 15, Tlen); -yystate(56, [C|Ics], Line, Tlen, _, _) when C >= 33, C =< 100 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(56, [C|Ics], Line, Tlen, _, _) when C >= 102, C =< 123 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(56, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(56, Ics, Line, Tlen, _, _) -> - {15,Tlen,Ics,Line,56}; -yystate(55, [110|Ics], Line, Tlen, Action, Alen) -> - yystate(59, Ics, Line, Tlen+1, Action, Alen); -yystate(55, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,55}; -yystate(54, [110|Ics], Line, Tlen, Action, Alen) -> - yystate(58, Ics, Line, Tlen+1, Action, Alen); -yystate(54, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,54}; -yystate(53, [58|Ics], Line, Tlen, Action, Alen) -> - yystate(49, Ics, Line, Tlen+1, Action, Alen); -yystate(53, [32|Ics], Line, Tlen, Action, Alen) -> - yystate(45, Ics, Line, Tlen+1, Action, Alen); -yystate(53, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,53}; -yystate(52, [97|Ics], Line, Tlen, _, _) -> - yystate(48, Ics, Line, Tlen+1, 15, Tlen); -yystate(52, [C|Ics], Line, Tlen, _, _) when C >= 33, C =< 96 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(52, [C|Ics], Line, Tlen, _, _) when C >= 98, C =< 123 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(52, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(52, Ics, Line, Tlen, _, _) -> - {15,Tlen,Ics,Line,52}; -yystate(51, [101|Ics], Line, Tlen, Action, Alen) -> - yystate(55, Ics, Line, Tlen+1, Action, Alen); -yystate(51, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,51}; -yystate(50, [117|Ics], Line, Tlen, Action, Alen) -> - yystate(54, Ics, Line, Tlen+1, Action, Alen); -yystate(50, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,50}; -yystate(49, Ics, Line, Tlen, _, _) -> - {2,Tlen,Ics,Line}; -yystate(48, [116|Ics], Line, Tlen, _, _) -> - yystate(44, Ics, Line, Tlen+1, 15, Tlen); -yystate(48, [C|Ics], Line, Tlen, _, _) when C >= 33, C =< 115 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(48, [C|Ics], Line, Tlen, _, _) when C >= 117, C =< 123 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(48, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(48, Ics, Line, Tlen, _, _) -> - {15,Tlen,Ics,Line,48}; -yystate(47, [104|Ics], Line, Tlen, Action, Alen) -> - yystate(51, Ics, Line, Tlen+1, Action, Alen); -yystate(47, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,47}; -yystate(46, [111|Ics], Line, Tlen, Action, Alen) -> - yystate(50, Ics, Line, Tlen+1, Action, Alen); -yystate(46, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,46}; -yystate(45, [111|Ics], Line, Tlen, Action, Alen) -> - yystate(41, Ics, Line, Tlen+1, Action, Alen); -yystate(45, [79|Ics], Line, Tlen, Action, Alen) -> - yystate(41, Ics, Line, Tlen+1, Action, Alen); -yystate(45, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,45}; -yystate(44, [117|Ics], Line, Tlen, _, _) -> - yystate(40, Ics, Line, Tlen+1, 15, Tlen); -yystate(44, [C|Ics], Line, Tlen, _, _) when C >= 33, C =< 116 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(44, [C|Ics], Line, Tlen, _, _) when C >= 118, C =< 123 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(44, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(44, Ics, Line, Tlen, _, _) -> - {15,Tlen,Ics,Line,44}; -yystate(43, [119|Ics], Line, Tlen, Action, Alen) -> - yystate(47, Ics, Line, Tlen+1, Action, Alen); -yystate(43, [116|Ics], Line, Tlen, Action, Alen) -> - yystate(67, Ics, Line, Tlen+1, Action, Alen); -yystate(43, [115|Ics], Line, Tlen, Action, Alen) -> - yystate(81, Ics, Line, Tlen+1, Action, Alen); -yystate(43, [103|Ics], Line, Tlen, Action, Alen) -> - yystate(9, Ics, Line, Tlen+1, Action, Alen); -yystate(43, [98|Ics], Line, Tlen, Action, Alen) -> - yystate(14, Ics, Line, Tlen+1, Action, Alen); -yystate(43, [97|Ics], Line, Tlen, Action, Alen) -> - yystate(70, Ics, Line, Tlen+1, Action, Alen); -yystate(43, [87|Ics], Line, Tlen, Action, Alen) -> - yystate(47, Ics, Line, Tlen+1, Action, Alen); -yystate(43, [84|Ics], Line, Tlen, Action, Alen) -> - yystate(67, Ics, Line, Tlen+1, Action, Alen); -yystate(43, [83|Ics], Line, Tlen, Action, Alen) -> - yystate(81, Ics, Line, Tlen+1, Action, Alen); -yystate(43, [71|Ics], Line, Tlen, Action, Alen) -> - yystate(9, Ics, Line, Tlen+1, Action, Alen); -yystate(43, [66|Ics], Line, Tlen, Action, Alen) -> - yystate(14, Ics, Line, Tlen+1, Action, Alen); -yystate(43, [65|Ics], Line, Tlen, Action, Alen) -> - yystate(70, Ics, Line, Tlen+1, Action, Alen); -yystate(43, [32|Ics], Line, Tlen, Action, Alen) -> - yystate(43, Ics, Line, Tlen+1, Action, Alen); -yystate(43, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,43}; -yystate(42, [114|Ics], Line, Tlen, Action, Alen) -> - yystate(46, Ics, Line, Tlen+1, Action, Alen); -yystate(42, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,42}; -yystate(41, [117|Ics], Line, Tlen, Action, Alen) -> - yystate(37, Ics, Line, Tlen+1, Action, Alen); -yystate(41, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,41}; -yystate(40, [114|Ics], Line, Tlen, _, _) -> - yystate(36, Ics, Line, Tlen+1, 15, Tlen); -yystate(40, [C|Ics], Line, Tlen, _, _) when C >= 33, C =< 113 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(40, [C|Ics], Line, Tlen, _, _) when C >= 115, C =< 123 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(40, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(40, Ics, Line, Tlen, _, _) -> - {15,Tlen,Ics,Line,40}; -yystate(39, [32|Ics], Line, Tlen, _, _) -> - yystate(43, Ics, Line, Tlen+1, 17, Tlen); -yystate(39, Ics, Line, Tlen, _, _) -> - {17,Tlen,Ics,Line,39}; -yystate(38, [103|Ics], Line, Tlen, Action, Alen) -> - yystate(42, Ics, Line, Tlen+1, Action, Alen); -yystate(38, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,38}; -yystate(37, [116|Ics], Line, Tlen, Action, Alen) -> - yystate(33, Ics, Line, Tlen+1, Action, Alen); -yystate(37, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,37}; -yystate(36, [101|Ics], Line, Tlen, _, _) -> - yystate(32, Ics, Line, Tlen+1, 15, Tlen); -yystate(36, [C|Ics], Line, Tlen, _, _) when C >= 33, C =< 100 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(36, [C|Ics], Line, Tlen, _, _) when C >= 102, C =< 123 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(36, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(36, Ics, Line, Tlen, _, _) -> - {15,Tlen,Ics,Line,36}; -yystate(35, Ics, Line, Tlen, _, _) -> - {17,Tlen,Ics,Line}; -yystate(34, [107|Ics], Line, Tlen, Action, Alen) -> - yystate(38, Ics, Line, Tlen+1, Action, Alen); -yystate(34, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,34}; -yystate(33, [108|Ics], Line, Tlen, Action, Alen) -> - yystate(29, Ics, Line, Tlen+1, Action, Alen); -yystate(33, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,33}; -yystate(32, [58|Ics], Line, Tlen, _, _) -> - yystate(28, Ics, Line, Tlen+1, 15, Tlen); -yystate(32, [C|Ics], Line, Tlen, _, _) when C >= 33, C =< 57 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(32, [C|Ics], Line, Tlen, _, _) when C >= 59, C =< 123 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(32, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(32, Ics, Line, Tlen, _, _) -> - {15,Tlen,Ics,Line,32}; -yystate(31, [10|Ics], Line, Tlen, _, _) -> - yystate(35, Ics, Line+1, Tlen+1, 17, Tlen); -yystate(31, Ics, Line, Tlen, _, _) -> - {17,Tlen,Ics,Line,31}; -yystate(30, [99|Ics], Line, Tlen, Action, Alen) -> - yystate(34, Ics, Line, Tlen+1, Action, Alen); -yystate(30, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,30}; -yystate(29, [105|Ics], Line, Tlen, Action, Alen) -> - yystate(25, Ics, Line, Tlen+1, Action, Alen); -yystate(29, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,29}; -yystate(28, [C|Ics], Line, Tlen, _, _) when C >= 33, C =< 123 -> - yystate(23, Ics, Line, Tlen+1, 0, Tlen); -yystate(28, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(23, Ics, Line, Tlen+1, 0, Tlen); -yystate(28, Ics, Line, Tlen, _, _) -> - {0,Tlen,Ics,Line,28}; -yystate(27, [32|Ics], Line, Tlen, _, _) -> - yystate(27, Ics, Line, Tlen+1, 16, Tlen); -yystate(27, Ics, Line, Tlen, _, _) -> - {16,Tlen,Ics,Line,27}; -yystate(26, Ics, Line, Tlen, _, _) -> - {8,Tlen,Ics,Line}; -yystate(25, [110|Ics], Line, Tlen, Action, Alen) -> - yystate(21, Ics, Line, Tlen+1, Action, Alen); -yystate(25, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,25}; -yystate(24, [C|Ics], Line, Tlen, _, _) when C >= 33, C =< 123 -> - yystate(20, Ics, Line, Tlen+1, 15, Tlen); -yystate(24, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(20, Ics, Line, Tlen+1, 15, Tlen); -yystate(24, Ics, Line, Tlen, _, _) -> - {15,Tlen,Ics,Line,24}; -yystate(23, [C|Ics], Line, Tlen, _, _) when C >= 33, C =< 123 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(23, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(23, Ics, Line, Tlen, _, _) -> - {15,Tlen,Ics,Line,23}; -yystate(22, [32|Ics], Line, Tlen, Action, Alen) -> - yystate(26, Ics, Line, Tlen+1, Action, Alen); -yystate(22, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,22}; -yystate(21, [101|Ics], Line, Tlen, Action, Alen) -> - yystate(17, Ics, Line, Tlen+1, Action, Alen); -yystate(21, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,21}; -yystate(20, [C|Ics], Line, Tlen, _, _) when C >= 33, C =< 123 -> - yystate(20, Ics, Line, Tlen+1, 14, Tlen); -yystate(20, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(20, Ics, Line, Tlen+1, 14, Tlen); -yystate(20, Ics, Line, Tlen, _, _) -> - {14,Tlen,Ics,Line,20}; -yystate(19, [34|Ics], Line, Tlen, _, _) -> - yystate(19, Ics, Line, Tlen+1, 13, Tlen); -yystate(19, [33|Ics], Line, Tlen, _, _) -> - yystate(15, Ics, Line, Tlen+1, 13, Tlen); -yystate(19, [32|Ics], Line, Tlen, _, _) -> - yystate(15, Ics, Line, Tlen+1, 13, Tlen); -yystate(19, [C|Ics], Line, Tlen, _, _) when C >= 35, C =< 123 -> - yystate(15, Ics, Line, Tlen+1, 13, Tlen); -yystate(19, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(15, Ics, Line, Tlen+1, 13, Tlen); -yystate(19, Ics, Line, Tlen, _, _) -> - {13,Tlen,Ics,Line,19}; -yystate(18, [116|Ics], Line, Tlen, Action, Alen) -> - yystate(22, Ics, Line, Tlen+1, Action, Alen); -yystate(18, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,18}; -yystate(17, [58|Ics], Line, Tlen, Action, Alen) -> - yystate(13, Ics, Line, Tlen+1, Action, Alen); -yystate(17, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,17}; -yystate(16, [123|Ics], Line, Tlen, _, _) -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(16, [96|Ics], Line, Tlen, _, _) -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(16, [95|Ics], Line, Tlen, _, _) -> - yystate(12, Ics, Line, Tlen+1, 15, Tlen); -yystate(16, [C|Ics], Line, Tlen, _, _) when C >= 33, C =< 47 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(16, [C|Ics], Line, Tlen, _, _) when C >= 48, C =< 57 -> - yystate(12, Ics, Line, Tlen+1, 15, Tlen); -yystate(16, [C|Ics], Line, Tlen, _, _) when C >= 58, C =< 64 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(16, [C|Ics], Line, Tlen, _, _) when C >= 65, C =< 90 -> - yystate(12, Ics, Line, Tlen+1, 15, Tlen); -yystate(16, [C|Ics], Line, Tlen, _, _) when C >= 91, C =< 94 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(16, [C|Ics], Line, Tlen, _, _) when C >= 97, C =< 122 -> - yystate(12, Ics, Line, Tlen+1, 15, Tlen); -yystate(16, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(16, Ics, Line, Tlen, _, _) -> - {15,Tlen,Ics,Line,16}; -yystate(15, [34|Ics], Line, Tlen, Action, Alen) -> - yystate(19, Ics, Line, Tlen+1, Action, Alen); -yystate(15, [33|Ics], Line, Tlen, Action, Alen) -> - yystate(15, Ics, Line, Tlen+1, Action, Alen); -yystate(15, [32|Ics], Line, Tlen, Action, Alen) -> - yystate(15, Ics, Line, Tlen+1, Action, Alen); -yystate(15, [C|Ics], Line, Tlen, Action, Alen) when C >= 35, C =< 123 -> - yystate(15, Ics, Line, Tlen+1, Action, Alen); -yystate(15, [C|Ics], Line, Tlen, Action, Alen) when C >= 125, C =< 65535 -> - yystate(15, Ics, Line, Tlen+1, Action, Alen); -yystate(15, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,15}; -yystate(14, [117|Ics], Line, Tlen, Action, Alen) -> - yystate(18, Ics, Line, Tlen+1, Action, Alen); -yystate(14, [97|Ics], Line, Tlen, Action, Alen) -> - yystate(30, Ics, Line, Tlen+1, Action, Alen); -yystate(14, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,14}; -yystate(13, Ics, Line, Tlen, _, _) -> - {3,Tlen,Ics,Line}; -yystate(12, [123|Ics], Line, Tlen, _, _) -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(12, [96|Ics], Line, Tlen, _, _) -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(12, [95|Ics], Line, Tlen, _, _) -> - yystate(12, Ics, Line, Tlen+1, 15, Tlen); -yystate(12, [63|Ics], Line, Tlen, _, _) -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(12, [64|Ics], Line, Tlen, _, _) -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(12, [62|Ics], Line, Tlen, _, _) -> - yystate(8, Ics, Line, Tlen+1, 15, Tlen); -yystate(12, [C|Ics], Line, Tlen, _, _) when C >= 33, C =< 47 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(12, [C|Ics], Line, Tlen, _, _) when C >= 48, C =< 57 -> - yystate(12, Ics, Line, Tlen+1, 15, Tlen); -yystate(12, [C|Ics], Line, Tlen, _, _) when C >= 58, C =< 61 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(12, [C|Ics], Line, Tlen, _, _) when C >= 65, C =< 90 -> - yystate(12, Ics, Line, Tlen+1, 15, Tlen); -yystate(12, [C|Ics], Line, Tlen, _, _) when C >= 91, C =< 94 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(12, [C|Ics], Line, Tlen, _, _) when C >= 97, C =< 122 -> - yystate(12, Ics, Line, Tlen+1, 15, Tlen); -yystate(12, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(23, Ics, Line, Tlen+1, 15, Tlen); -yystate(12, Ics, Line, Tlen, _, _) -> - {15,Tlen,Ics,Line,12}; -yystate(11, [34|Ics], Line, Tlen, _, _) -> - yystate(7, Ics, Line, Tlen+1, 15, Tlen); -yystate(11, [33|Ics], Line, Tlen, _, _) -> - yystate(11, Ics, Line, Tlen+1, 15, Tlen); -yystate(11, [32|Ics], Line, Tlen, _, _) -> - yystate(15, Ics, Line, Tlen+1, 15, Tlen); -yystate(11, [C|Ics], Line, Tlen, _, _) when C >= 35, C =< 123 -> - yystate(11, Ics, Line, Tlen+1, 15, Tlen); -yystate(11, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(11, Ics, Line, Tlen+1, 15, Tlen); -yystate(11, Ics, Line, Tlen, _, _) -> - {15,Tlen,Ics,Line,11}; -yystate(10, Ics, Line, Tlen, _, _) -> - {4,Tlen,Ics,Line}; -yystate(9, [105|Ics], Line, Tlen, Action, Alen) -> - yystate(5, Ics, Line, Tlen+1, Action, Alen); -yystate(9, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,9}; -yystate(8, [C|Ics], Line, Tlen, _, _) when C >= 33, C =< 123 -> - yystate(23, Ics, Line, Tlen+1, 9, Tlen); -yystate(8, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(23, Ics, Line, Tlen+1, 9, Tlen); -yystate(8, Ics, Line, Tlen, _, _) -> - {9,Tlen,Ics,Line,8}; -yystate(7, [34|Ics], Line, Tlen, _, _) -> - yystate(7, Ics, Line, Tlen+1, 13, Tlen); -yystate(7, [33|Ics], Line, Tlen, _, _) -> - yystate(11, Ics, Line, Tlen+1, 13, Tlen); -yystate(7, [32|Ics], Line, Tlen, _, _) -> - yystate(15, Ics, Line, Tlen+1, 13, Tlen); -yystate(7, [C|Ics], Line, Tlen, _, _) when C >= 35, C =< 123 -> - yystate(11, Ics, Line, Tlen+1, 13, Tlen); -yystate(7, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(11, Ics, Line, Tlen+1, 13, Tlen); -yystate(7, Ics, Line, Tlen, _, _) -> - {13,Tlen,Ics,Line,7}; -yystate(6, [32|Ics], Line, Tlen, Action, Alen) -> - yystate(10, Ics, Line, Tlen+1, Action, Alen); -yystate(6, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,6}; -yystate(5, [118|Ics], Line, Tlen, Action, Alen) -> - yystate(1, Ics, Line, Tlen+1, Action, Alen); -yystate(5, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,5}; -yystate(4, [34|Ics], Line, Tlen, _, _) -> - yystate(0, Ics, Line, Tlen+1, 15, Tlen); -yystate(4, [33|Ics], Line, Tlen, _, _) -> - yystate(11, Ics, Line, Tlen+1, 15, Tlen); -yystate(4, [32|Ics], Line, Tlen, _, _) -> - yystate(15, Ics, Line, Tlen+1, 15, Tlen); -yystate(4, [C|Ics], Line, Tlen, _, _) when C >= 35, C =< 123 -> - yystate(11, Ics, Line, Tlen+1, 15, Tlen); -yystate(4, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(11, Ics, Line, Tlen+1, 15, Tlen); -yystate(4, Ics, Line, Tlen, _, _) -> - {15,Tlen,Ics,Line,4}; -yystate(3, [34|Ics], Line, Tlen, _, _) -> - yystate(7, Ics, Line, Tlen+1, 10, Tlen); -yystate(3, [33|Ics], Line, Tlen, _, _) -> - yystate(11, Ics, Line, Tlen+1, 10, Tlen); -yystate(3, [32|Ics], Line, Tlen, _, _) -> - yystate(15, Ics, Line, Tlen+1, 10, Tlen); -yystate(3, [C|Ics], Line, Tlen, _, _) when C >= 35, C =< 123 -> - yystate(11, Ics, Line, Tlen+1, 10, Tlen); -yystate(3, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(11, Ics, Line, Tlen+1, 10, Tlen); -yystate(3, Ics, Line, Tlen, _, _) -> - {10,Tlen,Ics,Line,3}; -yystate(2, [110|Ics], Line, Tlen, Action, Alen) -> - yystate(6, Ics, Line, Tlen+1, Action, Alen); -yystate(2, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,2}; -yystate(1, [101|Ics], Line, Tlen, Action, Alen) -> - yystate(2, Ics, Line, Tlen+1, Action, Alen); -yystate(1, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,1}; -yystate(0, [34|Ics], Line, Tlen, _, _) -> - yystate(3, Ics, Line, Tlen+1, 15, Tlen); -yystate(0, [33|Ics], Line, Tlen, _, _) -> - yystate(11, Ics, Line, Tlen+1, 15, Tlen); -yystate(0, [32|Ics], Line, Tlen, _, _) -> - yystate(15, Ics, Line, Tlen+1, 15, Tlen); -yystate(0, [C|Ics], Line, Tlen, _, _) when C >= 35, C =< 123 -> - yystate(11, Ics, Line, Tlen+1, 15, Tlen); -yystate(0, [C|Ics], Line, Tlen, _, _) when C >= 125, C =< 65535 -> - yystate(11, Ics, Line, Tlen+1, 15, Tlen); -yystate(0, Ics, Line, Tlen, _, _) -> - {15,Tlen,Ics,Line,0}; -yystate(S, Ics, Line, Tlen, Action, Alen) -> - {Action,Alen,Tlen,Ics,Line,S}. - -%% yyaction(Action, TokenLength, TokenChars, TokenLine) -> -%% {token,Token} | {end_token, Token} | skip_token | {error,String}. -%% Generated action function. - -yyaction(0, _, _, TokenLine) -> - yyaction_0(TokenLine); -yyaction(1, _, _, TokenLine) -> - yyaction_1(TokenLine); -yyaction(2, _, _, TokenLine) -> - yyaction_2(TokenLine); -yyaction(3, _, _, TokenLine) -> - yyaction_3(TokenLine); -yyaction(4, _, _, TokenLine) -> - yyaction_4(TokenLine); -yyaction(5, _, _, TokenLine) -> - yyaction_5(TokenLine); -yyaction(6, _, _, TokenLine) -> - yyaction_6(TokenLine); -yyaction(7, _, _, TokenLine) -> - yyaction_7(TokenLine); -yyaction(8, _, _, TokenLine) -> - yyaction_8(TokenLine); -yyaction(9, TokenLen, YYtcs, TokenLine) -> - TokenChars = yypre(YYtcs, TokenLen), - yyaction_9(TokenChars, TokenLine); -yyaction(10, _, _, TokenLine) -> - yyaction_10(TokenLine); -yyaction(11, TokenLen, YYtcs, TokenLine) -> - TokenChars = yypre(YYtcs, TokenLen), - yyaction_11(TokenChars, TokenLine); -yyaction(12, _, _, TokenLine) -> - yyaction_12(TokenLine); -yyaction(13, TokenLen, YYtcs, TokenLine) -> - TokenChars = yypre(YYtcs, TokenLen), - yyaction_13(TokenChars, TokenLine); -yyaction(14, TokenLen, YYtcs, TokenLine) -> - TokenChars = yypre(YYtcs, TokenLen), - yyaction_14(TokenChars, TokenLine); -yyaction(15, TokenLen, YYtcs, TokenLine) -> - TokenChars = yypre(YYtcs, TokenLen), - yyaction_15(TokenChars, TokenLine); -yyaction(16, TokenLen, YYtcs, TokenLine) -> - TokenChars = yypre(YYtcs, TokenLen), - yyaction_16(TokenChars, TokenLine); -yyaction(17, _, _, TokenLine) -> - yyaction_17(TokenLine); -yyaction(_, _, _, _) -> error. - --compile({inline,yyaction_0/1}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 16). -yyaction_0(TokenLine) -> - { token, { feature, TokenLine } } . - --compile({inline,yyaction_1/1}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 17). -yyaction_1(TokenLine) -> - { token, { background, TokenLine } } . - --compile({inline,yyaction_2/1}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 18). -yyaction_2(TokenLine) -> - { token, { scenario, TokenLine } } . - --compile({inline,yyaction_3/1}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 19). -yyaction_3(TokenLine) -> - { token, { scenario_outline, TokenLine } } . - --compile({inline,yyaction_4/1}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 20). -yyaction_4(TokenLine) -> - { token, { given, TokenLine } } . - --compile({inline,yyaction_5/1}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 21). -yyaction_5(TokenLine) -> - { token, { 'when', TokenLine } } . - --compile({inline,yyaction_6/1}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 22). -yyaction_6(TokenLine) -> - { token, { then, TokenLine } } . - --compile({inline,yyaction_7/1}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 23). -yyaction_7(TokenLine) -> - { token, { 'and', TokenLine } } . - --compile({inline,yyaction_8/1}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 24). -yyaction_8(TokenLine) -> - { token, { but, TokenLine } } . - --compile({inline,yyaction_9/2}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 25). -yyaction_9(TokenChars, TokenLine) -> - { token, { var, TokenLine, TokenChars } } . - --compile({inline,yyaction_10/1}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 26). -yyaction_10(TokenLine) -> - { token, { docstring, TokenLine } } . - --compile({inline,yyaction_11/2}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 27). -yyaction_11(TokenChars, TokenLine) -> - { token, { cell, TokenLine, string : strip (string : strip (TokenChars, both, 124), both, 32) }, "|" } . - --compile({inline,yyaction_12/1}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 28). -yyaction_12(TokenLine) -> - { token, { newline, TokenLine } } . - --compile({inline,yyaction_13/2}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 29). -yyaction_13(TokenChars, TokenLine) -> - { token, { word, TokenLine, TokenChars } } . - --compile({inline,yyaction_14/2}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 30). -yyaction_14(TokenChars, TokenLine) -> - { token, { tag, TokenLine, TokenChars } } . - --compile({inline,yyaction_15/2}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 31). -yyaction_15(TokenChars, TokenLine) -> - { token, { word, TokenLine, TokenChars } } . - --compile({inline,yyaction_16/2}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 32). -yyaction_16(TokenChars, TokenLine) -> - { token, { space, TokenLine, TokenChars } } . - --compile({inline,yyaction_17/1}). --file("/Users/erikh/GitLab/erlang-ninja/gurka/_build/test/lib/gurka/src/gherkin_lexer.xrl", 33). -yyaction_17(TokenLine) -> - { token, { newline, TokenLine } } . - --file("/usr/local/Cellar/erlang/18.3/lib/erlang/lib/parsetools-2.1.1/include/leexinc.hrl", 290). diff --git a/src/gherkin_lexer.xrl b/src/gherkin_lexer.xrl index 9882f1dbd15ac84e619b3ff0bb6b68ac1c16bb98..86f2683597fefa494edc7584ea350044e7087923 100644 --- a/src/gherkin_lexer.xrl +++ b/src/gherkin_lexer.xrl @@ -4,6 +4,7 @@ FEATURE = [Ff]eature: BACKGROUND = \n\s+[Bb]ackground: SCENARIO = \n\s+[Ss]cenario: SCENARIO_OUTLINE = \n\s+[Ss]cenario\s[Oo]utline: +EXAMPLES = \n\s+[Ee]xamples: GIVEN = \n\s+[Gg]iven\s WHEN = \n\s+[Ww]hen\s THEN = \n\s+[Tt]hen\s @@ -15,23 +16,27 @@ W = [\x{21}-\x{7b}\x{7d}-\x{ffff}] Rules. -{FEATURE} : {token, {feature, TokenLine}}. -{BACKGROUND} : {token, {background, TokenLine}}. -{SCENARIO} : {token, {scenario, TokenLine}}. -{SCENARIO_OUTLINE} : {token, {scenario_outline, TokenLine}}. -{GIVEN} : {token, {given, TokenLine}}. -{WHEN} : {token, {'when', TokenLine}}. -{THEN} : {token, {then, TokenLine}}. -{AND} : {token, {'and', TokenLine}}. -{BUT} : {token, {but, TokenLine}}. -{VAR} : {token, {var, TokenLine, TokenChars}}. +{FEATURE} : {token, {feature_keyword, TokenLine}}. +{BACKGROUND} : {token, {background_keyword, TokenLine}}. +{SCENARIO} : {token, {scenario_keyword, TokenLine}}. +{SCENARIO_OUTLINE} : {token, {scenario_outline_keyword, TokenLine}}. +{EXAMPLES} : {token, {examples_keyword, TokenLine}}. +{GIVEN} : {token, {given_keyword, TokenLine}}. +{WHEN} : {token, {when_keyword, TokenLine}}. +{THEN} : {token, {then_keyword, TokenLine}}. +{AND} : {token, {and_keyword, TokenLine}}. +{BUT} : {token, {but_keyword, TokenLine}}. +{VAR} : {token, {variable, TokenLine, TokenChars}}. """ : {token, {docstring, TokenLine}}. -\x{7c}({W}|\s)+\x{7c} : {token, {cell, TokenLine, string:strip(string:strip(TokenChars, both, $|), both, 32)}, "|"}. -\x{7c}{N} : {token, {newline, TokenLine}}. +\x{7c}({W}|\s)+\x{7c} : {token, {cell, TokenLine, strip_cell(TokenChars)}, "|"}. +\x{7c}{N} : {skip_token, "\n"}. "({W}|\s)+" : {token, {word, TokenLine, TokenChars}}. +#({W}|\s)+ : skip_token. @{W}+ : {token, {tag, TokenLine, TokenChars}}. {W}+ : {token, {word, TokenLine, TokenChars}}. -\s+ : {token, {space, TokenLine, TokenChars}}. {N} : {token, {newline, TokenLine}}. +\s+ : skip_token. Erlang code. +strip_cell(Chars) -> + string:strip(string:strip(Chars, both, $|), both, 32). diff --git a/src/gherkin_parser.yrl b/src/gherkin_parser.yrl new file mode 100644 index 0000000000000000000000000000000000000000..12451655576bdc405aeb3508e5c2903bab307558 --- /dev/null +++ b/src/gherkin_parser.yrl @@ -0,0 +1,99 @@ +Nonterminals +feature +background +scenarios +scenario_keywords +scenario +scenario_outline +examples +tags +steps +step +table +cells +text +words +newlines. + +Terminals +feature_keyword +background_keyword +scenario_keyword +scenario_outline_keyword +examples_keyword +given_keyword +when_keyword +then_keyword +and_keyword +but_keyword +tag +word +newline +cell +docstring +variable. + +Rootsymbol +feature. + +feature -> feature_keyword words background scenarios: #{background => '$3', scenarios => '$4'}. +feature -> feature_keyword background scenarios: #{background => '$2', scenarios => '$3'}. +feature -> feature_keyword scenarios: #{scenarios => '$2'}. + +background -> tags background_keyword steps : #{tags => '$1', steps => '$3'}. +background -> background_keyword steps : #{steps => '$2'}. + +scenarios -> scenario : ['$1']. +scenarios -> scenario_outline : ['$1']. +scenarios -> scenario scenarios: ['$1'|'$2']. +scenarios -> scenario_outline scenarios: ['$1'|'$2']. + +scenario -> tags scenario_keywords words steps : #{tags => '$1', steps => '$4'}. +scenario -> tags scenario_keywords steps : #{tags => '$1', steps => '$3'}. +scenario -> scenario_keywords words steps : #{steps => '$3'}. +scenario -> scenario_keywords steps : #{steps => '$2'}. + +scenario_outline -> scenario examples : maps:merge('$1','$2'). + +examples -> examples_keyword words table : #{examples => '$3'}. + +scenario_keywords -> scenario_keyword : scenario. +scenario_keywords -> scenario_outline_keyword : scenario_outline. + +tags -> tag : [value_of('$1')]. +tags -> tag tags : [value_of('$1')|'$2']. + +step -> given_keyword : given. +step -> when_keyword : 'when'. +step -> then_keyword : then. +step -> and_keyword : 'and'. +step -> but_keyword : but. +steps -> step words : [{'$1','$2',undefined,undefined}]. +steps -> step words table: [{'$1','$2','$3',undefined}]. +steps -> step words text: [{'$1','$2',undefined,'$3'}]. +steps -> step words steps : [{'$1','$2',undefined,undefined}|'$3']. +steps -> step words table steps : [{'$1','$2','$3',undefined}|'$4']. +steps -> step words text steps : [{'$1','$2',undefined,'$3'}|'$4']. + +table -> cells : ['$1']. +table -> cells newline : ['$1']. +table -> cells newline table : ['$1'|'$3']. + +cells -> cell : [value_of('$1')]. +cells -> cell cells : [value_of('$1')|'$2']. + +text -> docstring words docstring : tl('$2'). +text -> docstring words docstring newlines : tl('$2'). + +words -> word : [value_of('$1')]. +words -> variable : [value_of('$1')]. +words -> newline : ["\n"]. +words -> word words : [value_of('$1')|'$2']. +words -> variable words : [value_of('$1')|'$2']. +words -> newline words : ["\n"|'$2']. + +newlines -> newline : ["\n"]. +newlines -> newline newlines : ["\n"|'$2']. + +Erlang code. +value_of(Token) -> unicode:characters_to_binary(element(3, Token)). diff --git a/test/gherkin_test.erl b/test/gherkin_test.erl index 9b2b37bedbe7a1bc37cc2adf3942c6dfe8642eda..ee011bad321c136f43b7511e7e215227dd16d89b 100644 --- a/test/gherkin_test.erl +++ b/test/gherkin_test.erl @@ -5,7 +5,8 @@ lexer_test() -> {ok, Binary} = file:read_file("samples/sample1.feature"), Text = unicode:characters_to_list(Binary, utf8), - ?debugFmt("~p", [Binary]), {ok, Tokens, _EndLine} = gherkin_lexer:string(Text), ?debugFmt("~p", [Tokens]), + Data = gherkin_parser:parse(Tokens), + ?debugFmt("~p", [Data]), ?assert(true).