aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/compile.erl
diff options
context:
space:
mode:
authorAnthony Ramine <[email protected]>2012-06-02 18:37:53 +0200
committerAnthony Ramine <[email protected]>2012-06-02 18:41:18 +0200
commitf6dc9c00459cba32e06d5eb7a0b9f2c6785a4e4d (patch)
treec26924c4eea6ad42a95d0e39c340c3a45d046067 /lib/compiler/src/compile.erl
parent26ad68f8246e38c915721d6112e075db182ed27b (diff)
downloadotp-f6dc9c00459cba32e06d5eb7a0b9f2c6785a4e4d.tar.gz
otp-f6dc9c00459cba32e06d5eb7a0b9f2c6785a4e4d.tar.bz2
otp-f6dc9c00459cba32e06d5eb7a0b9f2c6785a4e4d.zip
Create a new "column" option in compile
If set, compile will call epp with a full location {1, 1} instead of 1, thus making it keep the column numbers in the parsed AST.
Diffstat (limited to 'lib/compiler/src/compile.erl')
-rw-r--r--lib/compiler/src/compile.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 9b505ad15c..c443f9f788 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -769,7 +769,8 @@ parse_module(St) ->
Opts = St#compile.options,
Cwd = ".",
IncludePath = [Cwd, St#compile.dir|inc_paths(Opts)],
- R = epp:parse_file(St#compile.ifile, IncludePath, pre_defs(Opts)),
+ AtPos = initial_position(Opts),
+ R = epp:parse_file(St#compile.ifile, AtPos, IncludePath, pre_defs(Opts)),
case R of
{ok,Forms} ->
{ok,St#compile{code=Forms}};
@@ -1475,6 +1476,12 @@ objfile(Base, St) ->
tmpfile(Ofile) ->
reverse([$#|tl(reverse(Ofile))]).
+initial_position(Opts) ->
+ case lists:member(column, Opts) of
+ true -> {1, 1};
+ false -> 1
+ end.
+
%% pre_defs(Options)
%% inc_paths(Options)
%% Extract the predefined macros and include paths from the option list.