summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-06-06Merge _strip_quotes() into load_config().Ulf Magnusson
Faster without sacrificing readability.
2015-06-06load_config() nit.Ulf Magnusson
Each expression in the loop is relatively expensive at this point too.
2015-06-06Make comment in load_config() more accurate.Ulf Magnusson
2015-06-06Test help text terminated by comment.Ulf Magnusson
2015-06-06Improve get_help() test coverage.Ulf Magnusson
In preparation for some changes.
2015-06-06Space nits.Ulf Magnusson
2015-06-06Create Symbol.dep in symbol.__init__().Ulf Magnusson
All symbols get a 'dep', so it's pointless to do it afterwards.
2015-06-06Explain why eval() might seem sloppy.Ulf Magnusson
2015-06-06s/value/val/ in string parsing.Ulf Magnusson
For consistency.
2015-06-06Test for exceptions in a cleaner way.Ulf Magnusson
2015-06-06Add some test cases for malformed expressions.Ulf Magnusson
Also fix a tokenizer nit: a '!' at the end of a line can be tokenized (though it's meaningless).
2015-06-06Use 'raise A(b)' instead of 'raise A, b'.Ulf Magnusson
Bit neater, and Python 3-friendly.
2015-06-06Reorder _Feed methods.Ulf Magnusson
2015-06-06Simplify _Feed.len().Ulf Magnusson
2015-06-06Simplify _Feed.check().Ulf Magnusson
2015-06-06Get rid of two 'filename' and 'linenr' variables.Ulf Magnusson
Semi-pointless in _parse_block(). Often not even used.
2015-06-06Remove _Feed.__getitem__().Ulf Magnusson
Also add named choices defined in multiple locations to the block at each location. Not sure why I only added them at the first location before, as symbols don't work that way. I still doubt named choices defined in multiple locations will ever be used.
2015-06-06Remove _Feed.is_empty().Ulf Magnusson
Redundant.
2015-06-05s/cached_value/cached_val/Ulf Magnusson
Consistent with 'user_val'.
2015-06-05Remove some vertical spam.Ulf Magnusson
2015-06-05Move some ANDs after ORs for consistency.Ulf Magnusson
2015-06-05Get rid of the _Block class -- use plain lists.Ulf Magnusson
_Block turned simple enough that it became pointless.
2015-06-05Remove _Block.add_depend_expr() -- unused.Ulf Magnusson
The entire _Block class is probably up next.
2015-06-05_parse_block() style nit, take two.Ulf Magnusson
The menu must be added to self.menus before parsing its contents, so that it comes before any contained menus. Make the comment and menu cases consistent by rearranging the comment case instead.
2015-06-05Revert "_parse_block() style nit."Ulf Magnusson
Ops... this breaks menu ordering.
2015-06-05_parse_block() style nit.Ulf Magnusson
2015-06-05Add warning re. tests overwiting .config.Ulf Magnusson
Sorry if this has bit anyone!
2015-06-05_internal_error() nit.Ulf Magnusson
2015-06-05Format some stuff consistently.Ulf Magnusson
2015-06-05Use the 'get' method of 'keyword' directly.Ulf Magnusson
Small tokenizer optimization, similar to the regex optimizations.
2015-06-05Improve tokenization performance by removing a single character.Ulf Magnusson
strip() instead of lstrip() makes the loop terminate earlier, saving lots of calls. Shaves a few % of parsing the x86 Kconfigs.
2015-06-05Restructure and simplify parts of the tokenizer.Ulf Magnusson
Pre-bump 'i' and let it be the index of the "next" character instead.
2015-06-05Fix hang when tokenizing some invalid expressions.Ulf Magnusson
c.eval("&") would cause a hang before for example.
2015-06-04Clean up parse error handling.Ulf Magnusson
strip() the faulty line (seeing that whitespace probably isn't helpful), remove an assert that probably isn't useful in practice, and simplify the code.
2015-06-04Clean up tokenization error handling.Ulf Magnusson
- The caret was always set to the end of the string in the current version, which is pointless. - Part of the error string was output manually, and part of it was part of the exception message. Ugly oversight.
2015-06-04Documentation nit.Ulf Magnusson
2015-06-04Refactor and optimize _indentation().Ulf Magnusson
I must have missed that expandtabs() already takes the context of tabs into account the first time around. Also remove error check that probably won't be useful.
2015-06-04Refactor and optimize _strip_quotes().Ulf Magnusson
Use the fact that startswith() can check multiple prefixes.
2015-06-04Replace _strip_trailing_slash() with rstrip().Ulf Magnusson
Will also strip many '/'s, which makes sense here.
2015-06-04Refactor _get_lines().Ulf Magnusson
Also improves performance. A yield-based implementation would be interesting to experiment with, to see if I/O + computation interleaving helps here.
2015-06-04Note that _FileFeed joins lines ending in \.Ulf Magnusson
2015-06-04Let _FileFeed fetch the lines from the file.Ulf Magnusson
This is how it's always used in practice.
2015-06-04Order _parse_block() cases by frequency.Ulf Magnusson
Probably not a noticeable win here, but might as well. The new ordering isn't any worse than the old one in other respects. Also remove a pointless assert. The condition would trigger an obvious error immediately when false anyway.
2015-06-04Order _parse_properties() cases by frequency.Ulf Magnusson
Shaves a few % off parsing the x86 Kconfigs.
2015-06-04Check for AND before OR in _eval_expr_2().Ulf Magnusson
Much more common, so make it the fast case.
2015-06-04Small regex-related optimization.Ulf Magnusson
Prefetch the SRE_Pattern.match() methods. Shaves a few % off Config._tokenize(). Do the same elsewhere for consistency, though I'm not sure if it's a meaningful win.
2015-06-04Warning formatting nit.Ulf Magnusson
2015-06-04Consistently use new-style classes.Ulf Magnusson
Ugly oversight. Gives a nice ~13% parsing performance increase with both CPython and PyPy on my system.
2015-06-03Fix typo.Ulf Magnusson
2015-06-03Add dubiousjim's kconfig-diff.py as an example.Ulf Magnusson