Core: Fixed column info in CParser

git-svn-id: svn://ultimatepp.org/upp/trunk@13661 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2019-10-30 07:39:28 +00:00
parent 33f68b1d32
commit fb8115698b
3 changed files with 19 additions and 9 deletions

View file

@ -93,7 +93,7 @@ public:
operator bool() const { return *term; }
int GetLine() const { return line; }
int GetColumn(int tabsize) const;
int GetColumn(int tabsize = 4) const;
String GetFileName() const { return fn; }
static String LineInfoComment(const String& filename, int line = 1, int column = 1);

View file

@ -83,7 +83,10 @@ bool CParser::Spaces0() {
else if(term[0] == '/' && term[1] == '*')
count++;
if(*term++ == '\n') line++;
if(*term++ == '\n') {
line++;
lineptr = term;
}
}
}
else {
@ -93,7 +96,10 @@ bool CParser::Spaces0() {
term += 2;
break;
}
if(*term++ == '\n') line++;
if(*term++ == '\n') {
line++;
lineptr = term;
}
}
}
}
@ -481,8 +487,10 @@ String CParser::ReadString(bool chkend)
char CParser::GetChar()
{
char c = *term++;
if(c == '\n')
if(c == '\n') {
line++;
lineptr = term;
}
return c;
}
@ -504,8 +512,10 @@ void CParser::SkipTerm()
ReadString('\'', false);
else
if(*term) {
if(*term == '\n')
if(*term == '\n') {
line++;
lineptr = term + 1;
}
term++;
}
DoSpaces();

View file

@ -1,5 +1,4 @@
topic "CParser";
[2 $$0,0#00000000000000000000000000000000:Default]
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
[l288;2 $$2,0#27521748481378242620020725143825:desc]
[0 $$3,0#96390100711032703541132217272105:end]
@ -9,6 +8,7 @@ topic "CParser";
[l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param]
[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam]
[b42;2 $$9,9#13035079074754324216151401829390:normal]
[2 $$0,0#00000000000000000000000000000000:Default]
[{_}
[ {{10000@(113.42.0) [s0;%% [*@7;4 CParser]]}}&]
[s3; &]
@ -392,7 +392,7 @@ a different [* CParser].&]
[s3; &]
[s4; &]
[s5;:CParser`:`:GetColumn`(int`)const: [@(0.0.255) int]_[* GetColumn]([@(0.0.255) int]_[*@3 t
absize])_[@(0.0.255) const]&]
absize]_`=_[@3 4])_[@(0.0.255) const]&]
[s2;%% Returns the current column, with given [%-*@3 tabsize].&]
[s3;%% &]
[s4; &]
@ -410,8 +410,8 @@ t]&]
CParser, switches filename and line number. This is supposed
to help in situations when parsed text is actually a result of
e.g. include operations of some original files, to improve error
reporting. Not that such comment is lexically treated as comment.
Comment is created using LINEINFO`_ESC characters begin/end delimiter
reporting. Such comment is lexically treated as comment. Comment
is created using LINEINFO`_ESC characters begin/end delimiter
(current value is `'`\2`').&]
[s3;%% &]
[s4; &]