Skip to content

Instantly share code, notes, and snippets.

@ericbmerritt
Created November 27, 2011 00:45
Show Gist options
  • Save ericbmerritt/1396648 to your computer and use it in GitHub Desktop.
Save ericbmerritt/1396648 to your computer and use it in GitHub Desktop.
keyword_style_ident() ->
":" ++ string().
defvar_style_ident() ->
"*" ++ string() ++ "*".
split_ident() ->
string() ++ "-" ++ string().
normal_ident() ->
string().
ident() ->
{ident, 0, union([normal_ident(), split_ident(), defvar_style_ident(),
keyword_style_ident()])}.
character() ->
{char, 0, [$\\, char()]}.
syntax_quote() ->
{syntax_quote, 0, "`"}.
unquote_splicing() ->
{unquote_splicing, 0, "~@"}.
unquote() ->
{unquote, 0, "~"}.
quote() ->
{quote, 0, "'"}.
jxa_int() ->
{integer, 0, integer()}.
jxa_float() ->
{float, 0, float()}.
jxa_string() ->
{string, 0, string()}.
jxa_vector(0) ->
{vector, 0, []};
jxa_vector(Size) ->
{vector, 0, vector(Size, value(Size - 1))}.
jxa_list(0) ->
{vector, 0, []};
jxa_list(Size) ->
{list, 0, vector(Size, value(Size - 1))}.
value(Size) ->
union([jxa_vector(Size),
jxa_list(Size),
jxa_float(),
jxa_int(),
jxa_string(),
quote(),
unquote(),
unquote_splicing(),
syntax_quote(),
character(),
ident()]).
expression() ->
?SIZED(N, jxa_list(N)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment