Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix file-inclusion bugs

  • Loading branch information...
commit ee70b6241dc8aaf80e49242db6ddffb563ccb13e 1 parent 4d7970c
@evanmiller evanmiller authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/aleppo.erl
View
6 src/aleppo.erl
@@ -130,19 +130,21 @@ process_inclusion(FileName, Line, Context) ->
{NewTokens, _} = mark_keywords(Tokens),
case aleppo_parser:parse(NewTokens) of
{ok, ParseTree} ->
+ [{eof, _}|Rest] = lists:reverse(ParseTree),
+ ParseTreeNoEOF = lists:reverse(Rest),
ThisFile = case dict:find('FILE', Context#ale_context.macro_dict) of
{ok, Val} -> Val;
_ -> undefined
end,
Dict1 = dict:store('FILE', [{string, 1, FileName}], Context#ale_context.macro_dict),
TokenAcc = lists:reverse(file_attribute_tokens(FileName, 1)),
- {Dict2, IncludedTokens} = process_tree(ParseTree, TokenAcc,
+ {Dict2, IncludedTokens} = process_tree(ParseTreeNoEOF, TokenAcc,
Context#ale_context{
macro_dict = Dict1,
include_trail = [FileName|Context#ale_context.include_trail]}),
case ThisFile of
undefined -> {Dict2, IncludedTokens};
- {string, _Loc, ThisFileName} ->
+ [{string, _Loc, ThisFileName}] ->
{dict:store('FILE', ThisFile, Dict2),
lists:reverse(file_attribute_tokens(ThisFileName, Line)) ++ IncludedTokens}
end;
Please sign in to comment.
Something went wrong with that request. Please try again.