summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2020-01-08 17:21:42 +0200
committerAdrian Thurston <thurston@colm.net>2020-01-08 17:21:42 +0200
commitf450375f87b7d7c26cd47ee5b9ed0567c068b1c2 (patch)
treec7d8888a54c67aa4c319cf3cb869b3b56e72e14b
parent1bf8df38ebf912b454c7db1fe2e2a38c91526900 (diff)
downloadcolm-f450375f87b7d7c26cd47ee5b9ed0567c068b1c2.tar.gz
colm: eliminated the range-crosses-zero hack needed when alphtype was signed
In 900189a4d23f0180970f22479f44377973a2d330 we added an option to hack the parsing of hex literals to allow ranges that cross zero. This was necessary when alphtype was signed. Moving to an unsigned type eliminates the need for this.
-rw-r--r--colm/main.cc6
-rw-r--r--colm/parsetree.cc27
2 files changed, 4 insertions, 29 deletions
diff --git a/colm/main.cc b/colm/main.cc
index e7cbd5e9..2febd774 100644
--- a/colm/main.cc
+++ b/colm/main.cc
@@ -90,7 +90,6 @@ bool run = false;
bool addUniqueEmptyProductions = false;
bool gblLibrary = false;
long gblActiveRealm = 0;
-bool rangeCrossesZero = false;
ArgsVector includePaths;
ArgsVector libraryPaths;
@@ -555,15 +554,12 @@ bool inSourceTree( const char *argv0, char *&location )
void processArgs( int argc, const char **argv )
{
- ParamCheck pc( "RcD:e:x:I:L:vdliro:S:M:vHh?-:sVa:m:b:E:", argc, argv );
+ ParamCheck pc( "cD:e:x:I:L:vdliro:S:M:vHh?-:sVa:m:b:E:", argc, argv );
while ( pc.check() ) {
switch ( pc.state ) {
case ParamCheck::match:
switch ( pc.parameter ) {
- case 'R':
- rangeCrossesZero = true;
- break;
case 'I':
includePaths.append( pc.parameterArg );
break;
diff --git a/colm/parsetree.cc b/colm/parsetree.cc
index cf97fa23..572f0610 100644
--- a/colm/parsetree.cc
+++ b/colm/parsetree.cc
@@ -1228,37 +1228,16 @@ FsmGraph *Range::walk( Compiler *pd )
delete lowerFsm;
delete upperFsm;
- bool span0 = false;
- if ( rangeCrossesZero && lowKey >= 0 && highKey < 0 )
- span0 = true;
-
/* Validate the range. */
- if ( !span0 && lowKey > highKey ) {
+ if ( lowKey > highKey ) {
/* Recover by setting upper to lower; */
error(lowerLit->loc) << "lower end of range is greater then upper end" << endl;
highKey = lowKey;
}
/* Return the range now that it is validated. */
- FsmGraph *retFsm = 0;
- if ( span0 ) {
- FsmGraph *first = new FsmGraph();
- FsmGraph *second = new FsmGraph();
- Key k128 = 127;
- Key kn127 = -128;
- first->rangeFsm( lowKey, k128 );
- second->rangeFsm( kn127, highKey );
-
- first->unionOp( second );
- first->minimizePartition2();
- retFsm = first;
- }
- else {
- /* Usual case. */
- retFsm = new FsmGraph();
- retFsm->rangeFsm( lowKey, highKey );
- }
-
+ FsmGraph *retFsm = new FsmGraph();
+ retFsm->rangeFsm( lowKey, highKey );
return retFsm;
}