ide: Assist++ now has correct line number information of .sch (thanks a alot SenderGhost!)

git-svn-id: svn://ultimatepp.org/upp/trunk@4118 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2011-11-04 09:47:10 +00:00
parent 455f920955
commit 0cecd9eff3
2 changed files with 24 additions and 17 deletions

View file

@ -11,7 +11,7 @@ String ReadId(CParser& p, String& rr)
if(p.IsNumber())
p.ReadNumber();
p.Char(')');
rr << "SqlId " << id << "(\"" << id << "\");\n";
rr << "SqlId " << id << "(\"" << id << "\");";
return id;
}
@ -20,57 +20,64 @@ void ScanSchFile(const char *fn)
String s = LoadFile(fn);
CParser p(s);
String r, rr;
int line;
while(!p.IsEof())
try {
line = p.GetLine();
if(p.Id("TABLE") || p.Id("TABLE_") || p.Id("TYPE") || p.Id("TYPE_"))
r << "struct S_" << ReadId(p, rr) << " {\n";
r << "struct S_" << ReadId(p, rr) << " {";
else
if(p.Id("END_TABLE") || p.Id("END_TYPE"))
r << "};\n";
r << "};";
else
if(p.Id("LONGRAW") || p.Id("LONGRAW_") || p.Id("BLOB") || p.Id("BLOB_") ||
p.Id("STRING_") || p.Id("STRING") || p.Id("CLOB") || p.Id("CLOB_"))
r << "\tString " << ReadId(p, rr) << ";\n";
r << "\tString " << ReadId(p, rr) << ";";
else
if(p.Id("INT") || p.Id("INT_") || p.Id("SERIAL") || p.Id("ISERIAL"))
r << "\tint " << ReadId(p, rr) << ";\n";
r << "\tint " << ReadId(p, rr) << ";";
else
if(p.Id("DOUBLE") || p.Id("DOUBLE_"))
r << "\tdouble " << ReadId(p, rr) << ";\n";
r << "\tdouble " << ReadId(p, rr) << ";";
else
if(p.Id("TIME") || p.Id("TIME_"))
r << "\tTime " << ReadId(p, rr) << ";\n";
r << "\tTime " << ReadId(p, rr) << ";";
else
if(p.Id("DATE") || p.Id("DATE_"))
r << "\tDate " << ReadId(p, rr) << ";\n";
r << "\tDate " << ReadId(p, rr) << ";";
else
if(p.Id("BIT") || p.Id("BIT_") || p.Id("BOOL") || p.Id("BOOL_"))
r << "\tbool " << ReadId(p, rr) << ";\n";
r << "\tbool " << ReadId(p, rr) << ";";
else
if(p.Id("INT_ARRAY") || p.Id("INT_ARRAY_"))
r << "\tint " << ReadId(p, rr) << "[1];\n";
r << "\tint " << ReadId(p, rr) << "[1];";
else
if(p.Id("DOUBLE_ARRAY") || p.Id("DOUBLE_ARRAY_"))
r << "\tdouble " << ReadId(p, rr) << "[1];\n";
r << "\tdouble " << ReadId(p, rr) << "[1];";
else
if(p.Id("TIME_ARRAY") || p.Id("TIME_ARRAY_"))
r << "\tTime " << ReadId(p, rr) << "[1];\n";
r << "\tTime " << ReadId(p, rr) << "[1];";
else
if(p.Id("DATE_ARRAY") || p.Id("DATE_ARRAY_"))
r << "\tDate " << ReadId(p, rr) << "[1];\n";
r << "\tDate " << ReadId(p, rr) << "[1];";
else
if(p.Id("BOOL_ARRAY") || p.Id("BOOL_ARRAY_") || p.Id("BIT_ARRAY") || p.Id("BIT_ARRAY_"))
r << "\tbool " << ReadId(p, rr) << "[1];\n";
r << "\tbool " << ReadId(p, rr) << "[1];";
else
if(p.Id("SEQUENCE") || p.Id("SEQUENCE_"))
ReadId(p, rr);
else
p.SkipTerm();
line = p.GetLine() - line;
for(int i = 0; i < line; ++i) {
r << '\n';
rr << '\n';
}
}
catch(CParser::Error)
{}
r << "\n" << rr;
StringStream ss(r);
StringStream ss(r), sr(rr);
CppBase& base = CodeBase();
Parse(sr, IgnoreList(), base, fn, CNULL);
Parse(ss, IgnoreList(), base, fn, CNULL);
}

View file

@ -494,7 +494,7 @@ void Ide::EditFile0(const String& path, byte charset, bool astext, const String&
editor.SetFocus();
MakeTitle();
SetBar();
editor.assist_active = IsProjectFile(editfile) && (IsCSourceFile(editfile) || IsCHeaderFile(editfile));
editor.assist_active = IsProjectFile(editfile) && IsCppBaseFile();
editor.CheckEdited(true);
editor.Annotate(editfile);
editor.SyncNavigator();