cpp: C++11 completed

git-svn-id: svn://ultimatepp.org/upp/trunk@8750 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2015-07-26 08:18:04 +00:00
parent da0f20eb31
commit 27c0c297d5
2 changed files with 58 additions and 28 deletions

View file

@ -1102,6 +1102,18 @@ Array<Parser::Decl> Parser::Declaration(bool l0, bool more, const String& tname,
}
return r;
}
const char *b = lex.Pos();
if(Key(tk_using) && lex.IsId()) {
String name = lex.GetId();
Key('=');
Array<Decl> r;
Decl& d = r.Add();
ReadType(d, tname, tparam);
d.name = name;
d.natural = String(b, lex.Pos());
d.type_def = true;
return r;
}
return Declaration0(l0, more, tname, tparam);
}
@ -1420,7 +1432,8 @@ void Parser::Enum()
bool Parser::UsingNamespace()
{
if(Key(tk_using)) {
if(lex == tk_using && !(lex.IsId(1) && lex[2] == '=')) {
++lex;
if(Key(tk_namespace))
while(lex.IsId()) {
Vector<String> h = Split(context.namespace_using, ';');
@ -1530,6 +1543,22 @@ void Parser::Do()
else {
String tnames;
String tparam = TemplateParams(tnames);
if(lex == tk_using) { //C++11 template alias template <...> using ID =
Array<Decl> r = Declaration(true, true, tnames, tparam);
for(int i = 0; i < r.GetCount(); i++) {
Decla& d = r[i];
if(d.type_def) {
String scope = context.scope;
ScopeCat(scope, d.name);
CppItem& im = Item(scope, context.namespace_using, "typedef", d.name);
im.natural = Purify(d.natural);
im.type = d.type;
im.access = context.access;
im.kind = TYPEDEF;
}
}
}
else {
if(!Scope(tparam, tnames)) {
Array<Decl> r = Declaration(true, true, tnames, tparam);
CppItem *functionItem = 0;
@ -1556,6 +1585,7 @@ void Parser::Do()
EatBody();
}
}
}
else
if(lex == tk_enum && IsEnum(1)) {
++lex;

View file

@ -53,21 +53,21 @@ LAYOUT(CustomLayout, 608, 410)
ITEM(Button, exit, SetLabel(t_("Close")).RightPosZ(4, 80).BottomPosZ(4, 22))
END_LAYOUT
LAYOUT(RunLayout, 420, 172)
LAYOUT(RunLayout, 440, 172)
ITEM(Label, dv___0, SetLabel(t_("&Program arguments:")).LeftPosZ(4, 112).TopPosZ(4, 19))
ITEM(WithDropChoice<EditString>, arg, HSizePosZ(120, 4).TopPosZ(4, 19))
ITEM(WithDropChoice<EditString>, arg, HSizePosZ(120, 8).TopPosZ(4, 19))
ITEM(Label, dv___2, SetLabel(t_("&Working directory:")).LeftPosZ(4, 112).TopPosZ(28, 19))
ITEM(EditString, dir, HSizePosZ(120, 4).TopPosZ(28, 19))
ITEM(EditString, dir, HSizePosZ(120, 8).TopPosZ(28, 19))
ITEM(Label, stdout_file_lbl, SetLabel(t_("STDOUT file:")).LeftPosZ(4, 112).TopPosZ(52, 19))
ITEM(WithDropChoice<EditString>, stdout_file, HSizePosZ(120, 4).TopPosZ(52, 19))
ITEM(WithDropChoice<EditString>, stdout_file, HSizePosZ(120, 8).TopPosZ(52, 19))
ITEM(Label, dv___6, SetLabel(t_("Standard output:")).LeftPosZ(4, 112).TopPosZ(76, 19))
ITEM(Switch, runmode, SetLabel(t_("&Standalone\n&Console\n&File")).HSizePosZ(120, 104).TopPosZ(76, 19))
ITEM(Option, external, SetLabel(t_("&External application")).HSizePosZ(120, 168).TopPosZ(96, 15))
ITEM(Switch, consolemode, SetLabel(t_("Auto\nAlways\nNever")).HSizePosZ(120, 4).TopPosZ(116, 20))
ITEM(Button, ok, SetLabel(t_("OK")).RightPosZ(72, 64).BottomPosZ(8, 24))
ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(4, 64).BottomPosZ(8, 24))
ITEM(Switch, runmode, SetLabel(t_("&Standalone\n&Console\n&File")).HSizePosZ(120, 112).TopPosZ(76, 19))
ITEM(Option, external, SetLabel(t_("&External application")).HSizePosZ(120, 112).TopPosZ(96, 15))
ITEM(Switch, consolemode, SetLabel(t_("Auto\nAlways\nNever")).HSizePosZ(120, 24).TopPosZ(116, 20))
ITEM(Button, ok, SetLabel(t_("OK")).RightPosZ(76, 64).BottomPosZ(8, 24))
ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(8, 64).BottomPosZ(8, 24))
ITEM(Label, console_lable, SetLabel(t_("Open console:")).LeftPosZ(4, 112).TopPosZ(116, 20))
ITEM(Option, utf8, SetLabel(t_("Output is UTF-8")).LeftPosZ(316, 104).TopPosZ(76, 20))
ITEM(Option, utf8, SetLabel(t_("Output is UTF-8")).LeftPosZ(328, 112).TopPosZ(76, 20))
END_LAYOUT
LAYOUT(FindInFilesLayout, 568, 152)