diff options
Diffstat (limited to 'lib/parsetools/doc/src/leex.xml')
-rw-r--r-- | lib/parsetools/doc/src/leex.xml | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/lib/parsetools/doc/src/leex.xml b/lib/parsetools/doc/src/leex.xml index d802e46b59..56c44caadb 100644 --- a/lib/parsetools/doc/src/leex.xml +++ b/lib/parsetools/doc/src/leex.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>2009</year><year>2022</year> + <year>2009</year><year>2023</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -115,6 +115,22 @@ <p>Causes generated -file() attributes to only include the basename of the file path.</p> </item> + <tag><c>{error_location, line | column}</c></tag> + <item> + <p>If set to <c>column</c>, error location will be + <c>{Line,Column}</c> tuple instead of just <c>Line</c>. Also, <c>StartLoc</c> + and <c>EndLoc</c> in <c>string/2</c>, <c>token/3</c>, and <c>tokens/3</c> + functions will be <c>{Line,Column}</c> tuple instead of just <c>Line</c>. + Default is <c>line</c>. Note that you can use <c>TokenLoc</c> for token + location independently, even if the <c>error_location</c> is set to <c>line</c>.</p> + <p>Unicode characters are counted as many columns as they use bytes + to represent.</p> + </item> + <tag><c>{tab_size, pos_integer()}</c></tag> + <item> + <p>Sets the width of <c>\t</c> character (only relevant if <c>error_location</c> + is set to <c>column</c>). Default is <c>8</c>.</p> + </item> </taglist> <p>Any of the Boolean options can be set to <c>true</c> by stating the name of the option. For example, <c>verbose</c> @@ -147,17 +163,18 @@ </fsdescription> <func> <name since="">Module:string(String) -> StringRet</name> - <name since="">Module:string(String, StartLine) -> StringRet</name> + <name since="">Module:string(String, StartLoc) -> StringRet</name> <fsummary>Generated by Leex</fsummary> <type> <v>String = string()</v> - <v>StringRet = {ok,Tokens,EndLine} | ErrorInfo</v> + <v>StringRet = {ok,Tokens,EndLoc} | ErrorInfo</v> <v>Tokens = [Token]</v> - <v>EndLine = StartLine = erl_anno:line()</v> + <v>StartLoc = EndLoc = erl_anno:location()</v> </type> <desc> <p>Scans <c>String</c> and returns all the tokens in it, or an - error.</p> + error. <c>StartLoc</c> and <c>EndLoc</c> are either <c>erl_anno:line()</c> + or <c>erl_anno:location()</c>, depending on the <c>error_location</c> option.</p> <note><p>It is an error if not all of the characters in <c>String</c> are consumed.</p></note> </desc> @@ -166,7 +183,7 @@ <func> <name since="">Module:token(Cont, Chars) -> {more,Cont1} | {done,TokenRet,RestChars} </name> - <name since="">Module:token(Cont, Chars, StartLine) -> {more,Cont1} + <name since="">Module:token(Cont, Chars, StartLoc) -> {more,Cont1} | {done,TokenRet,RestChars} </name> <fsummary>Generated by Leex</fsummary> @@ -174,10 +191,10 @@ <v>Cont = [] | Cont1</v> <v>Cont1 = tuple()</v> <v>Chars = RestChars = string() | eof</v> - <v>TokenRet = {ok, Token, EndLine} - | {eof, EndLine} + <v>TokenRet = {ok, Token, EndLoc} + | {eof, EndLoc} | ErrorInfo</v> - <v>StartLine = EndLine = erl_anno:line()</v> + <v>StartLoc = EndLoc = erl_anno:location()</v> </type> <desc> <p>This is a re-entrant call to try and scan one token from @@ -193,7 +210,7 @@ but used through the i/o system where it can typically be called in an application by:</p> <code> -io:request(InFile, {get_until,unicode,Prompt,Module,token,[Line]}) +io:request(InFile, {get_until,unicode,Prompt,Module,token,[Loc]}) -> TokenRet</code> </desc> </func> @@ -201,7 +218,7 @@ io:request(InFile, {get_until,unicode,Prompt,Module,token,[Line]}) <func> <name since="">Module:tokens(Cont, Chars) -> {more,Cont1} | {done,TokensRet,RestChars} </name> - <name since="">Module:tokens(Cont, Chars, StartLine) -> + <name since="">Module:tokens(Cont, Chars, StartLoc) -> {more,Cont1} | {done,TokensRet,RestChars} </name> <fsummary>Generated by Leex</fsummary> @@ -209,11 +226,11 @@ io:request(InFile, {get_until,unicode,Prompt,Module,token,[Line]}) <v>Cont = [] | Cont1</v> <v>Cont1 = tuple()</v> <v>Chars = RestChars = string() | eof</v> - <v>TokensRet = {ok, Tokens, EndLine} - | {eof, EndLine} + <v>TokensRet = {ok, Tokens, EndLoc} + | {eof, EndLoc} | ErrorInfo</v> <v>Tokens = [Token]</v> - <v>StartLine = EndLine = erl_anno:line()</v> + <v>StartLoc = EndLoc = erl_anno:location()</v> </type> <desc> <p>This is a re-entrant call to try and scan tokens from @@ -240,7 +257,7 @@ io:request(InFile, {get_until,unicode,Prompt,Module,token,[Line]}) but used through the i/o system where it can typically be called in an application by:</p> <code> -io:request(InFile, {get_until,unicode,Prompt,Module,tokens,[Line]}) +io:request(InFile, {get_until,unicode,Prompt,Module,tokens,[Loc]}) -> TokensRet</code> </desc> </func> @@ -320,6 +337,14 @@ NAME = VALUE</code> <tag><c>TokenLine</c></tag> <item><p>The line number where the token occurred.</p> </item> + <tag><c>TokenCol</c></tag> + <item><p>The column number where the token occurred + (column of the first character included in the token).</p> + </item> + <tag><c>TokenLoc</c></tag> + <item><p>Token location. Expands to <c>{TokenLine,TokenCol}</c> (even + when <c>error_location</c> is set to <c>line</c>.</p> + </item> </taglist> <p>The code must return:</p> |