Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
496 lines (452 sloc) 20.6 KB
%% 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(json_lex2).
-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.
% "
-define(LOG(Name, Value),
io:format("{~p:~p}: ~p -> ~s~n", [?MODULE, ?LINE, Name, Value])).
-define(PLOG(Name, Value),
io:format("{~p:~p}: ~p -> ~p~n", [?MODULE, ?LINE, Name, Value])).
strip(TokenChars,TokenLen) -> lists:sublist(TokenChars, 2, TokenLen - 2).
whole_float(Token_Chars) ->
list_to_float(insert_point_zero(Token_Chars)).
insert_point_zero([$e|Cs]) -> ".0e" ++ Cs;
insert_point_zero([$E|Cs]) -> ".0e" ++ Cs;
insert_point_zero([C |Cs]) -> [C | insert_point_zero(Cs)].
unescape([$\\,$\"|Cs]) -> [$\"|unescape(Cs)];
unescape([$\\,$\\|Cs]) -> [$\\|unescape(Cs)];
unescape([$\\,$/|Cs]) -> [$/|unescape(Cs)];
unescape([$\\,$b|Cs]) -> [$\b|unescape(Cs)];
unescape([$\\,$f|Cs]) -> [$\f|unescape(Cs)];
unescape([$\\,$n|Cs]) -> [$\n|unescape(Cs)];
unescape([$\\,$r|Cs]) -> [$\r|unescape(Cs)];
unescape([$\\,$t|Cs]) -> [$\t|unescape(Cs)];
unescape([$\\,$u,C0,C1,C2,C3|Cs]) ->
C = dehex(C3) bor
(dehex(C2) bsl 4) bor
(dehex(C1) bsl 8) bor
(dehex(C0) bsl 12),
[C|unescape(Cs)];
unescape([C|Cs]) -> [C|unescape(Cs)];
unescape([]) -> [].
dehex(C) when C >= $0, C =< $9 -> C - $0;
dehex(C) when C >= $a, C =< $f -> C - $a + 10;
dehex(C) when C >= $A, C =< $F -> C - $A + 10.
parse_string(StringChars) ->
unescape(StringChars).
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}.
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, L1), Ts);
{A,Alen,Ics1,L1,_S1} -> %After an accepting state
string_cont(Ics1, L1, yyaction(A, Alen, Tcs, L1), Ts);
{reject,_Alen,Clen,_Ics1,L1,_S1} -> %After a non-accepting state
{error,{L1,?MODULE,{illegal,yypre(Tcs, Clen+1)}},L1};
{A,Alen,_Clen,_Ics1,L1,_S1} ->
string_cont(yysuf(Tcs, Alen), L1, yyaction(A, Alen, Tcs, L1), Ts)
end.
%% string_cont(RestChars, Line, Token, Tokens)
%% Test for and remove the end token wrapper.
string_cont(Rest, Line, {token,T}, Ts) ->
string(Rest, Line, Rest, [T|Ts]);
string_cont(Rest, Line, {end_token,T}, Ts) ->
string(Rest, Line, Rest, [T|Ts]);
string_cont(Rest, Line, skip_token, Ts) ->
string(Rest, Line, Rest, Ts);
string_cont(_Rest, Line, {error,S}, _Ts) ->
{error,{Line,?MODULE,{user,S}},Line}.
%% 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.
token(Cont, Chars) -> token(Cont, Chars, 1).
token([], Chars, Line) ->
token(Chars, Line, yystate(), Chars, 0, reject, 0);
token({token,Line,State,Tcs,Clen,Action,Alen}, Chars, _) ->
token(Chars, Line, State, Tcs ++ Chars, Clen, Action, Alen).
%% token(InChars, Line, State, TokenChars, CurrTokLen,
%% AcceptAction, AcceptLen) ->
%% {more,Continuation} | {done,ReturnVal,RestChars}.
token(Ics0, L0, S0, Tcs, Clen0, A0, Alen0) ->
case yystate(S0, Ics0, L0, Clen0, A0, Alen0) of
{A1,Alen1,Ics1,L1} -> %Accepting end state
token_cont(Ics1, L1, yyaction(A1, Alen1, Tcs, L1));
{A1,Alen1,[],L1,S1} -> %After an accepting state
{more,{token,L1,S1,Tcs,Alen1,A1,Alen1}};
{A1,Alen1,Ics1,L1,_S1} ->
token_cont(Ics1, L1, yyaction(A1, Alen1, Tcs, L1));
{A1,Alen1,Clen1,[],L1,S1} -> %After a non-accepting state
{more,{token,L1,S1,Tcs,Clen1,A1,Alen1}};
{reject,_Alen1,_Clen1,eof,L1,_S1} ->
{done,{eof,L1},[]};
{reject,_Alen1,Clen1,Ics1,L1,_S1} ->
{done,{error,{L1,?MODULE,{illegal,yypre(Tcs, Clen1+1)}},L1},Ics1};
{A1,Alen1,_Clen1,_Ics1,L1,_S1} ->
token_cont(yysuf(Tcs, Alen1), L1, yyaction(A1, Alen1, Tcs, L1))
end.
%% tokens_cont(RestChars, Line, Token)
%% If we have a token or error then return done, else if we have a
%% skip_token then continue.
token_cont(Rest, Line, {token,T}) ->
{done,{ok,T,Line},Rest};
token_cont(Rest, Line, {end_token,T}) ->
{done,{ok,T,Line},Rest};
token_cont(Rest, Line, skip_token) ->
token(Rest, Line, yystate(), Rest, 0, 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.
tokens(Cont, Chars) -> tokens(Cont, Chars, 1).
tokens([], Chars, Line) ->
tokens(Chars, Line, yystate(), Chars, 0, [], reject, 0);
tokens({tokens,Line,State,Tcs,Clen,Ts,Action,Alen}, Chars, _) ->
tokens(Chars, Line, State, Tcs ++ Chars, Clen, Ts, Action, Alen);
tokens({skip_tokens,Line,State,Tcs,Clen,Error,Action,Alen}, Chars, _) ->
skip_tokens(Chars, Line, State, Tcs ++ Chars, Clen, Error, Action, Alen).
%% tokens(InChars, Line, State, TokenChars, CurrTokLen, Tokens,
%% AcceptAction, AcceptLen) ->
%% {more,Continuation} | {done,ReturnVal,RestChars}.
tokens(Ics0, L0, S0, Tcs, Clen0, Ts, A0, Alen0) ->
case yystate(S0, Ics0, L0, Clen0, A0, Alen0) of
{A1,Alen1,Ics1,L1} -> %Accepting end state
tokens_cont(Ics1, L1, yyaction(A1, Alen1, Tcs, L1), Ts);
{A1,Alen1,[],L1,S1} -> %After an accepting state
{more,{tokens,L1,S1,Tcs,Alen1,Ts,A1,Alen1}};
{A1,Alen1,Ics1,L1,_S1} ->
tokens_cont(Ics1, L1, yyaction(A1, Alen1, Tcs, L1), Ts);
{A1,Alen1,Clen1,[],L1,S1} -> %After a non-accepting state
{more,{tokens,L1,S1,Tcs,Clen1,Ts,A1,Alen1}};
{reject,_Alen1,_Clen1,eof,L1,_S1} ->
{done,if Ts == [] -> {eof,L1};
true -> {ok,yyrev(Ts),L1} end,[]};
{reject,_Alen1,Clen1,_Ics1,L1,_S1} ->
%% Skip rest of tokens.
skip_tokens(yysuf(Tcs, Clen1+1), L1,
{L1,?MODULE,{illegal,yypre(Tcs, Clen1+1)}});
{A1,Alen1,_Clen1,_Ics1,L1,_S1} ->
tokens_cont(yysuf(Tcs, Alen1), L1, yyaction(A1, Alen1, Tcs, L1), Ts)
end.
%% tokens_cont(RestChars, Line, Token, Tokens)
%% If we have a 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.
tokens_cont(Rest, Line, {token,T}, Ts) ->
tokens(Rest, Line, yystate(), Rest, 0, [T|Ts], reject, 0);
tokens_cont(Rest, Line, {end_token,T}, Ts) ->
{done,{ok,yyrev(Ts, [T]),Line},Rest};
tokens_cont(Rest, Line, skip_token, Ts) ->
tokens(Rest, Line, yystate(), Rest, 0, 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(Ics, Line, yystate(), Ics, 0, Error, reject, 0).
%% skip_tokens(InChars, Line, State, TokenChars, CurrTokLen, Tokens,
%% AcceptAction, AcceptLen) ->
%% {more,Continuation} | {done,ReturnVal,RestChars}.
skip_tokens(Ics0, L0, S0, Tcs, Clen0, Error, A0, Alen0) ->
case yystate(S0, Ics0, L0, Clen0, A0, Alen0) of
{A1,Alen1,Ics1,L1} -> %Accepting end state
skip_cont(Ics1, L1, yyaction(A1, Alen1, Tcs, L1), Error);
{A1,Alen1,[],L1,S1} -> %After an accepting state
{more,{skip_tokens,L1,S1,Tcs,Alen1,Error,A1,Alen1}};
{A1,Alen1,Ics1,L1,_S1} ->
skip_cont(Ics1, L1, yyaction(A1, Alen1, Tcs, L1), Error);
{A1,Alen1,Clen1,[],L1,S1} -> %After a non-accepting state
{more,{skip_tokens,L1,S1,Tcs,Clen1,Error,A1,Alen1}};
{reject,_Alen1,_Clen1,eof,L1,_S1} ->
{done,{error,Error,L1},[]};
{reject,_Alen1,Clen1,_Ics1,L1,_S1} ->
skip_tokens(yysuf(Tcs, Clen1+1), L1, Error);
{A1,Alen1,_Clen1,_Ics1,L1,_S1} ->
skip_cont(yysuf(Tcs, Alen1), L1, yyaction(A1, Alen1, Tcs, L1), 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.
skip_cont(Rest, Line, {token,_T}, Error) ->
skip_tokens(Rest, Line, yystate(), Rest, 0, Error, reject, 0);
skip_cont(Rest, Line, {end_token,_T}, Error) ->
{done,{error,Error,Line},Rest};
skip_cont(Rest, Line, {error,_S}, Error) ->
skip_tokens(Rest, Line, yystate(), Rest, 0, Error, reject, 0);
skip_cont(Rest, Line, skip_token, Error) ->
skip_tokens(Rest, Line, yystate(), Rest, 0, 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.
yystate() -> 32.
yystate(35, [C|Ics], Line, Tlen, _, _) when C >= $0, C =< $9 ->
yystate(35, Ics, Line, Tlen+1, 5, Tlen);
yystate(35, Ics, Line, Tlen, _, _) ->
{5,Tlen,Ics,Line,35};
yystate(34, Ics, Line, Tlen, _, _) ->
{1,Tlen,Ics,Line};
yystate(33, Ics, Line, Tlen, _, _) ->
{11,Tlen,Ics,Line};
yystate(32, [$\n|Ics], Line, Tlen, Action, Alen) ->
yystate(28, Ics, Line+1, Tlen+1, Action, Alen);
yystate(32, [$"|Ics], Line, Tlen, Action, Alen) ->
yystate(24, Ics, Line, Tlen+1, Action, Alen);
yystate(32, [$%|Ics], Line, Tlen, Action, Alen) ->
yystate(8, Ics, Line, Tlen+1, Action, Alen);
yystate(32, [$,|Ics], Line, Tlen, Action, Alen) ->
yystate(4, Ics, Line, Tlen+1, Action, Alen);
yystate(32, [$-|Ics], Line, Tlen, Action, Alen) ->
yystate(0, Ics, Line, Tlen+1, Action, Alen);
yystate(32, [$:|Ics], Line, Tlen, Action, Alen) ->
yystate(33, Ics, Line, Tlen+1, Action, Alen);
yystate(32, [$[|Ics], Line, Tlen, Action, Alen) ->
yystate(29, Ics, Line, Tlen+1, Action, Alen);
yystate(32, [$]|Ics], Line, Tlen, Action, Alen) ->
yystate(25, Ics, Line, Tlen+1, Action, Alen);
yystate(32, [$f|Ics], Line, Tlen, Action, Alen) ->
yystate(21, Ics, Line, Tlen+1, Action, Alen);
yystate(32, [$n|Ics], Line, Tlen, Action, Alen) ->
yystate(1, Ics, Line, Tlen+1, Action, Alen);
yystate(32, [$t|Ics], Line, Tlen, Action, Alen) ->
yystate(14, Ics, Line, Tlen+1, Action, Alen);
yystate(32, [${|Ics], Line, Tlen, Action, Alen) ->
yystate(30, Ics, Line, Tlen+1, Action, Alen);
yystate(32, [$}|Ics], Line, Tlen, Action, Alen) ->
yystate(34, Ics, Line, Tlen+1, Action, Alen);
yystate(32, [C|Ics], Line, Tlen, Action, Alen) when C >= $\000, C =< $\t ->
yystate(28, Ics, Line, Tlen+1, Action, Alen);
yystate(32, [C|Ics], Line, Tlen, Action, Alen) when C >= $\v, C =< $\s ->
yystate(28, Ics, Line, Tlen+1, Action, Alen);
yystate(32, [C|Ics], Line, Tlen, Action, Alen) when C >= $0, C =< $9 ->
yystate(3, Ics, Line, Tlen+1, Action, Alen);
yystate(32, Ics, Line, Tlen, Action, Alen) ->
{Action,Alen,Tlen,Ics,Line,32};
yystate(31, [C|Ics], Line, Tlen, Action, Alen) when C >= $0, C =< $9 ->
yystate(35, Ics, Line, Tlen+1, Action, Alen);
yystate(31, Ics, Line, Tlen, Action, Alen) ->
{Action,Alen,Tlen,Ics,Line,31};
yystate(30, Ics, Line, Tlen, _, _) ->
{0,Tlen,Ics,Line};
yystate(29, Ics, Line, Tlen, _, _) ->
{2,Tlen,Ics,Line};
yystate(28, [$\n|Ics], Line, Tlen, _, _) ->
yystate(28, Ics, Line+1, Tlen+1, 13, Tlen);
yystate(28, [$%|Ics], Line, Tlen, _, _) ->
yystate(8, Ics, Line, Tlen+1, 13, Tlen);
yystate(28, [C|Ics], Line, Tlen, _, _) when C >= $\000, C =< $\t ->
yystate(28, Ics, Line, Tlen+1, 13, Tlen);
yystate(28, [C|Ics], Line, Tlen, _, _) when C >= $\v, C =< $\s ->
yystate(28, Ics, Line, Tlen+1, 13, Tlen);
yystate(28, Ics, Line, Tlen, _, _) ->
{13,Tlen,Ics,Line,28};
yystate(27, [$+|Ics], Line, Tlen, Action, Alen) ->
yystate(31, Ics, Line, Tlen+1, Action, Alen);
yystate(27, [$-|Ics], Line, Tlen, Action, Alen) ->
yystate(31, Ics, Line, Tlen+1, Action, Alen);
yystate(27, [C|Ics], Line, Tlen, Action, Alen) when C >= $0, C =< $9 ->
yystate(35, Ics, Line, Tlen+1, Action, Alen);
yystate(27, Ics, Line, Tlen, Action, Alen) ->
{Action,Alen,Tlen,Ics,Line,27};
yystate(26, Ics, Line, Tlen, _, _) ->
{8,Tlen,Ics,Line};
yystate(25, Ics, Line, Tlen, _, _) ->
{3,Tlen,Ics,Line};
yystate(24, [$\n|Ics], Line, Tlen, Action, Alen) ->
yystate(24, Ics, Line+1, Tlen+1, Action, Alen);
yystate(24, [$"|Ics], Line, Tlen, Action, Alen) ->
yystate(20, Ics, Line, Tlen+1, Action, Alen);
yystate(24, [$\\|Ics], Line, Tlen, Action, Alen) ->
yystate(16, Ics, Line, Tlen+1, Action, Alen);
yystate(24, [C|Ics], Line, Tlen, Action, Alen) when C >= $\000, C =< $\t ->
yystate(24, Ics, Line, Tlen+1, Action, Alen);
yystate(24, [C|Ics], Line, Tlen, Action, Alen) when C >= $\v, C =< $! ->
yystate(24, Ics, Line, Tlen+1, Action, Alen);
yystate(24, [C|Ics], Line, Tlen, Action, Alen) when C >= $#, C =< $[ ->
yystate(24, Ics, Line, Tlen+1, Action, Alen);
yystate(24, [C|Ics], Line, Tlen, Action, Alen) when C >= $], C =< $ÿ ->
yystate(24, Ics, Line, Tlen+1, Action, Alen);
yystate(24, Ics, Line, Tlen, Action, Alen) ->
{Action,Alen,Tlen,Ics,Line,24};
yystate(23, [C|Ics], Line, Tlen, _, _) when C >= $0, C =< $9 ->
yystate(23, Ics, Line, Tlen+1, 4, Tlen);
yystate(23, Ics, Line, Tlen, _, _) ->
{4,Tlen,Ics,Line,23};
yystate(22, [$e|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, [$a|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, Ics, Line, Tlen, _, _) ->
{7,Tlen,Ics,Line};
yystate(19, [C|Ics], Line, Tlen, Action, Alen) when C >= $0, C =< $9 ->
yystate(23, Ics, Line, Tlen+1, Action, Alen);
yystate(19, Ics, Line, Tlen, Action, Alen) ->
{Action,Alen,Tlen,Ics,Line,19};
yystate(18, [$u|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, [$l|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, [C|Ics], Line, Tlen, Action, Alen) when C >= $\000, C =< $\t ->
yystate(12, Ics, Line, Tlen+1, Action, Alen);
yystate(16, [C|Ics], Line, Tlen, Action, Alen) when C >= $\v, C =< $ÿ ->
yystate(12, Ics, Line, Tlen+1, Action, Alen);
yystate(16, Ics, Line, Tlen, Action, Alen) ->
{Action,Alen,Tlen,Ics,Line,16};
yystate(15, [$+|Ics], Line, Tlen, Action, Alen) ->
yystate(19, Ics, Line, Tlen+1, Action, Alen);
yystate(15, [$-|Ics], Line, Tlen, Action, Alen) ->
yystate(19, Ics, Line, Tlen+1, Action, Alen);
yystate(15, [C|Ics], Line, Tlen, Action, Alen) when C >= $0, C =< $9 ->
yystate(23, Ics, Line, Tlen+1, Action, Alen);
yystate(15, Ics, Line, Tlen, Action, Alen) ->
{Action,Alen,Tlen,Ics,Line,15};
yystate(14, [$r|Ics], Line, Tlen, Action, Alen) ->
yystate(18, Ics, Line, Tlen+1, Action, Alen);
yystate(14, Ics, Line, Tlen, Action, Alen) ->
{Action,Alen,Tlen,Ics,Line,14};
yystate(13, [$s|Ics], Line, Tlen, Action, Alen) ->
yystate(9, Ics, Line, Tlen+1, Action, Alen);
yystate(13, Ics, Line, Tlen, Action, Alen) ->
{Action,Alen,Tlen,Ics,Line,13};
yystate(12, [$\n|Ics], Line, Tlen, Action, Alen) ->
yystate(12, Ics, Line+1, Tlen+1, Action, Alen);
yystate(12, [$"|Ics], Line, Tlen, Action, Alen) ->
yystate(20, Ics, Line, Tlen+1, Action, Alen);
yystate(12, [$\\|Ics], Line, Tlen, Action, Alen) ->
yystate(16, Ics, Line, Tlen+1, Action, Alen);
yystate(12, [C|Ics], Line, Tlen, Action, Alen) when C >= $\000, C =< $\t ->
yystate(12, Ics, Line, Tlen+1, Action, Alen);
yystate(12, [C|Ics], Line, Tlen, Action, Alen) when C >= $\v, C =< $! ->
yystate(12, Ics, Line, Tlen+1, Action, Alen);
yystate(12, [C|Ics], Line, Tlen, Action, Alen) when C >= $#, C =< $[ ->
yystate(12, Ics, Line, Tlen+1, Action, Alen);
yystate(12, [C|Ics], Line, Tlen, Action, Alen) when C >= $], C =< $ÿ ->
yystate(12, Ics, Line, Tlen+1, Action, Alen);
yystate(12, Ics, Line, Tlen, Action, Alen) ->
{Action,Alen,Tlen,Ics,Line,12};
yystate(11, [$E|Ics], Line, Tlen, _, _) ->
yystate(15, Ics, Line, Tlen+1, 4, Tlen);
yystate(11, [$e|Ics], Line, Tlen, _, _) ->
yystate(15, Ics, Line, Tlen+1, 4, Tlen);
yystate(11, [C|Ics], Line, Tlen, _, _) when C >= $0, C =< $9 ->
yystate(11, Ics, Line, Tlen+1, 4, Tlen);
yystate(11, Ics, Line, Tlen, _, _) ->
{4,Tlen,Ics,Line,11};
yystate(10, Ics, Line, Tlen, _, _) ->
{10,Tlen,Ics,Line};
yystate(9, [$e|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, [$\n|Ics], Line, Tlen, _, _) ->
yystate(28, Ics, Line+1, Tlen+1, 13, Tlen);
yystate(8, [C|Ics], Line, Tlen, _, _) when C >= $\000, C =< $\t ->
yystate(8, Ics, Line, Tlen+1, 13, Tlen);
yystate(8, [C|Ics], Line, Tlen, _, _) when C >= $\v, C =< $ÿ ->
yystate(8, Ics, Line, Tlen+1, 13, Tlen);
yystate(8, Ics, Line, Tlen, _, _) ->
{13,Tlen,Ics,Line,8};
yystate(7, [C|Ics], Line, Tlen, Action, Alen) when C >= $0, C =< $9 ->
yystate(11, Ics, Line, Tlen+1, Action, Alen);
yystate(7, Ics, Line, Tlen, Action, Alen) ->
{Action,Alen,Tlen,Ics,Line,7};
yystate(6, [$l|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, Ics, Line, Tlen, _, _) ->
{9,Tlen,Ics,Line};
yystate(4, Ics, Line, Tlen, _, _) ->
{12,Tlen,Ics,Line};
yystate(3, [$.|Ics], Line, Tlen, _, _) ->
yystate(7, Ics, Line, Tlen+1, 6, Tlen);
yystate(3, [$E|Ics], Line, Tlen, _, _) ->
yystate(27, Ics, Line, Tlen+1, 6, Tlen);
yystate(3, [$e|Ics], Line, Tlen, _, _) ->
yystate(27, Ics, Line, Tlen+1, 6, Tlen);
yystate(3, [C|Ics], Line, Tlen, _, _) when C >= $0, C =< $9 ->
yystate(3, Ics, Line, Tlen+1, 6, Tlen);
yystate(3, Ics, Line, Tlen, _, _) ->
{6,Tlen,Ics,Line,3};
yystate(2, [$l|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, [$u|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, [C|Ics], Line, Tlen, Action, Alen) when C >= $0, C =< $9 ->
yystate(3, Ics, Line, Tlen+1, Action, Alen);
yystate(0, Ics, Line, Tlen, Action, Alen) ->
{Action,Alen,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) ->
{token,{'{',TokenLine}};
yyaction(1, _, _, TokenLine) ->
{token,{'}',TokenLine}};
yyaction(2, _, _, TokenLine) ->
{token,{'[',TokenLine}};
yyaction(3, _, _, TokenLine) ->
{token,{']',TokenLine}};
yyaction(4, TokenLen, YYtcs, TokenLine) ->
TokenChars = yypre(YYtcs, TokenLen),
{token,{float,TokenLine,list_to_float(TokenChars)}};
yyaction(5, TokenLen, YYtcs, TokenLine) ->
TokenChars = yypre(YYtcs, TokenLen),
{token,{float,TokenLine,whole_float(TokenChars)}};
yyaction(6, TokenLen, YYtcs, TokenLine) ->
TokenChars = yypre(YYtcs, TokenLen),
{token,{integer,TokenLine,list_to_integer(TokenChars)}};
yyaction(7, TokenLen, YYtcs, TokenLine) ->
TokenChars = yypre(YYtcs, TokenLen),
{token,{string,TokenLine,parse_string(strip(TokenChars, TokenLen))}};
yyaction(8, _, _, TokenLine) ->
{token,{true,TokenLine}};
yyaction(9, _, _, TokenLine) ->
{token,{false,TokenLine}};
yyaction(10, _, _, TokenLine) ->
{token,{null,TokenLine}};
yyaction(11, _, _, TokenLine) ->
{token,{':',TokenLine}};
yyaction(12, _, _, TokenLine) ->
{token,{',',TokenLine}};
yyaction(13, _, _, _) ->
skip_token;
yyaction(_, _, _, _) -> error.
Something went wrong with that request. Please try again.