mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-23 12:29:27 +01:00
CGrammar: Support long long suffix on constants; add .0 to floating pointer constants when omitted
This commit is contained in:
parent
d7197b6bf6
commit
a501557d35
@ -13,7 +13,7 @@ use warnings;
|
|||||||
# These are set automatically by the build/commit script
|
# These are set automatically by the build/commit script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 659,
|
BUILD_REVISION => 660,
|
||||||
BUILD_DATE => "2014-06-20",
|
BUILD_DATE => "2014-06-20",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1382,24 +1382,25 @@ constant:
|
|||||||
} else {
|
} else {
|
||||||
$return = $item[1];
|
$return = $item[1];
|
||||||
}
|
}
|
||||||
|
$return .= '0' if $return =~ /\.$/;
|
||||||
}
|
}
|
||||||
| /0x[0-9a-f]+[lu]{0,2}/i
|
| /0x[0-9a-f]+[lu]{0,3}/i
|
||||||
{
|
{
|
||||||
$return .= 'unsigned ' if $item[1] =~ s/[Uu]//;
|
$return .= 'unsigned ' if $item[1] =~ s/[Uu]//;
|
||||||
$return .= 'long ' if $item[1] =~ s/[Ll]//;
|
$return .= 'long ' while $item[1] =~ s/[Ll]//;
|
||||||
$return = "the $return" . "hexadecimal number $item[1]";
|
$return = "the $return" . "hexadecimal number $item[1]";
|
||||||
}
|
}
|
||||||
| /0\d+[lu]{0,2}/i
|
| /0\d+[lu]{0,3}/i
|
||||||
{
|
{
|
||||||
$return .= 'unsigned ' if $item[1] =~ s/[Uu]//;
|
$return .= 'unsigned ' if $item[1] =~ s/[Uu]//;
|
||||||
$return .= 'long ' if $item[1] =~ s/[Ll]//;
|
$return .= 'long ' while $item[1] =~ s/[Ll]//;
|
||||||
$return = "the $return" . "octal number $item[1]";
|
$return = "the $return" . "octal number $item[1]";
|
||||||
}
|
}
|
||||||
|/-?[0-9]+[lu]{0,2}/i # integer constant
|
| /-?[0-9]+[lu]{0,3}/i # integer constant
|
||||||
{
|
{
|
||||||
$return = $item[-1];
|
$return .= "unsigned " if $item[-1] =~ s/[Uu]//;
|
||||||
$return = "long $return" if $return =~ s/[Ll]//;
|
$return .= "long " while $item[-1] =~ s/[Ll]//;
|
||||||
$return = "unsigned $return" if $return =~ s/[Uu]//;
|
$return .= $item[-1];
|
||||||
}
|
}
|
||||||
| /(?:\'((?:\\\'|(?!\').)*)\')/ # character constant
|
| /(?:\'((?:\\\'|(?!\').)*)\')/ # character constant
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user