diff options
author | Steve Vinoski <[email protected]> | 2014-03-01 14:08:02 -0500 |
---|---|---|
committer | Steve Vinoski <[email protected]> | 2014-03-04 09:22:46 -0500 |
commit | 818628634b2c8e871fa3cf524c6659b0bea05c14 (patch) | |
tree | fbb4e9e2b7cbea82a3d2b78d89764e3f8eed9797 /lib/tools/emacs/test.erl.indented | |
parent | 2fbbc2f0d7987d15aef7b3ece116926e1215d8a3 (diff) | |
download | otp-818628634b2c8e871fa3cf524c6659b0bea05c14.tar.gz otp-818628634b2c8e871fa3cf524c6659b0bea05c14.tar.bz2 otp-818628634b2c8e871fa3cf524c6659b0bea05c14.zip |
match erlang keywords more carefully
Use word boundaries in some regex matching to avoid recognizing words that
begin with keywords as keywords themselves, for example avoid recognizing a
function named catcher as the catch keyword. Add a regression test for this
problem.
Diffstat (limited to 'lib/tools/emacs/test.erl.indented')
-rw-r--r-- | lib/tools/emacs/test.erl.indented | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/tools/emacs/test.erl.indented b/lib/tools/emacs/test.erl.indented index 0dc1b47f0d..1c1086ca58 100644 --- a/lib/tools/emacs/test.erl.indented +++ b/lib/tools/emacs/test.erl.indented @@ -749,3 +749,14 @@ commas_first() -> %% this used to result in a scan-sexp error [{ }]. + +%% this used to result in 2x the correct indentation within the function +%% body, due to the function name being mistaken for a keyword +catcher(N) -> + try generate_exception(N) of + Val -> {N, normal, Val} + catch + throw:X -> {N, caught, thrown, X}; + exit:X -> {N, caught, exited, X}; + error:X -> {N, caught, error, X} + end. |