瀏覽代碼

Fix for Mantis #25215.

compiler/scanner.pas, tscannerfile.readtoken:
  * after trying to read a _INTCONST check whether a valid first character for an identifier follows and give a syntax error if that is not the case

+ added test

git-svn-id: trunk@25835 -
svenbarth 11 年之前
父節點
當前提交
d908dbeec1
共有 3 個文件被更改,包括 13 次插入0 次删除
  1. 1 0
      .gitattributes
  2. 3 0
      compiler/scanner.pas
  3. 9 0
      tests/webtbf/tw25215.pp

+ 1 - 0
.gitattributes

@@ -12486,6 +12486,7 @@ tests/webtbf/tw24495.pp svneol=native#text/pascal
 tests/webtbf/tw24588.pp svneol=native#text/pascal
 tests/webtbf/tw2478.pp svneol=native#text/plain
 tests/webtbf/tw25029.pp svneol=native#text/pascal
+tests/webtbf/tw25215.pp svneol=native#text/pascal
 tests/webtbf/tw2562.pp svneol=native#text/plain
 tests/webtbf/tw2657.pp svneol=native#text/plain
 tests/webtbf/tw2670.pp svneol=native#text/plain

+ 3 - 0
compiler/scanner.pas

@@ -4549,6 +4549,9 @@ type
                     readnumber;
                     if length(pattern)=1 then
                       begin
+                        { does really an identifier follow? }
+                        if not (c in ['_','A'..'Z','a'..'z']) then
+                          message2(scan_f_syn_expected,tokeninfo^[_ID].str,c);
                         readstring;
                         token:=_ID;
                         idtoken:=_ID;

+ 9 - 0
tests/webtbf/tw25215.pp

@@ -0,0 +1,9 @@
+{ %FAIL }
+
+program tw25215;
+var
+  &:integer;
+begin
+  writeln(&);
+  //readln;
+end.