Commit 145834ffd115143724efe6ebdeabb6dbda57dcb4
1 parent
28d7348f
dodana obsługa #else
git-svn-id: svn://svn.nlp.ipipan.waw.pl/morfeusz/morfeusz@160 ff4e3ee1-f430-4e82-ade0-24591c43f1fd
Showing
1 changed file
with
2 additions
and
4 deletions
fsabuilder/morfeuszbuilder/segrules/preprocessor.py
@@ -94,14 +94,12 @@ def preprocess(inputLines, defs, filename): | @@ -94,14 +94,12 @@ def preprocess(inputLines, defs, filename): | ||
94 | elif line.startswith('#else'): | 94 | elif line.startswith('#else'): |
95 | name, isActive = ifdefsStack[-1] | 95 | name, isActive = ifdefsStack[-1] |
96 | assert isActive | 96 | assert isActive |
97 | - ifdefsStack[-1] = name, False | 97 | + ifdefsStack[-1] = (name, False) |
98 | # ifdefsStack.pop() | 98 | # ifdefsStack.pop() |
99 | elif line.startswith('#endif'): | 99 | elif line.startswith('#endif'): |
100 | ifdefsStack.pop() | 100 | ifdefsStack.pop() |
101 | elif line.startswith('#'): | 101 | elif line.startswith('#'): |
102 | yield lineNum, line | 102 | yield lineNum, line |
103 | - elif len(ifdefsStack) == 0 or \ | ||
104 | - (all(map(lambda (name, isActive): name in defs and isActive, ifdefsStack)) | ||
105 | - and not any(map(lambda (name, isActive): name in defs and not isActive, ifdefsStack))): | 103 | + elif len(ifdefsStack) == 0 or all(map(lambda (name, isActive): (name in defs and isActive) or (name not in defs and not isActive), ifdefsStack)): |
106 | yield lineNum, _processLine(lineNum, line, defines, filename) | 104 | yield lineNum, _processLine(lineNum, line, defines, filename) |
107 | 105 | ||
108 | \ No newline at end of file | 106 | \ No newline at end of file |