aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Core&Utility: return non zero exit status on failureMu Qiao2011-05-1311-34/+165
| | | | | The public API, ast_printer and bash_ast are refactored to return non zero exit status on failure.
* Tests: fix cppunittestsMu Qiao2011-05-134-10/+73
| | | | | NULL is not allowed to initialize a string object. A common helper function is created to solve the problem.
* Build: silence javac warningsPetteri Räty2011-05-121-1/+1
| | | | | | The antlr generated sources are for 1.4 so add -source 1.4 to AM_JAVACFLAGS to suppress warnings about unchecked or unsafe operations.
* Walker: first support for extended pattern matchingMu Qiao2011-05-123-31/+108
| | | | | ?(pattern-list), *(pattern-list), +(pattern-list), @(pattern-list) are supported now.
* Walker: support character class in patternsMu Qiao2011-05-113-2/+32
|
* Walker: reimplement bracket patternMu Qiao2011-05-111-32/+4
| | | | | With the help of dynamic regular expressions, we can easily build bracket pattern with little manual parsing work.
* Merge remote-tracking branch 'mu/pattern_matching'Petteri Räty2011-05-1111-117/+268
|\ | | | | | | | | Conflicts: bashast/bashast.g
| * Walker: support patterns in variable expansionMu Qiao2011-05-115-84/+73
| |
| * Walker: support ranged patternMu Qiao2011-05-113-6/+60
| | | | | | | | Patterns like [a-z] and [!0-9] are supported.
| * Walker: support MATCH_ANY_EXCEPT and MATCH_PATTERNMu Qiao2011-05-113-10/+71
| | | | | | | | Patterns like [abc] and [!abc] are supported now.
| * Walker: fix a bug in word ruleMu Qiao2011-05-113-1/+3
| | | | | | | | | | | | Inside the word rule, we used arithmetic rule to do variable reference. But that requires the variable to be integer. Now it's fixed by adding a variable reference alternative.
| * Walker: first support for basic pattern matchingMu Qiao2011-05-112-29/+70
| |
| * Parser: Use virtual token for '*' and '?'Mu Qiao2011-05-095-12/+16
| | | | | | | | | | | | | | * and ? have different meanings in pattern matching. Now virtual tokens are used to get a clear AST. The order of extended and basic pattern matching is switched to make the '*' and '?' correctly parsed.
* | Parser: rename MATCH_PATTERN to MATCH_ANYPetteri Räty2011-05-103-18/+18
| | | | | | | | | | | | The token is used to describe bracket pattern matching expressions where any of the atoms inside the brackets can match to MATCH_ANY is a more descriptive name.
* | Parser: rename extended pattern matching tokensPetteri Räty2011-05-102-15/+15
| | | | | | | | | | | | Prefix tokens used in extended pattern matching with EXTENDED_ so it's clear what tokens are related to extended pattern matching and normal matching.
* | Parser: allow white space in replacement stringsPetteri Räty2011-05-102-2/+4
| | | | | | | | | | | | Now the parser doesn't swallow white spaces from the replacement string in variable expansion and they get reflected properly in the AST. Fixes bug #364119.
* | Merge remote-tracking branch 'mu/variable_setup'Petteri Räty2011-05-0814-91/+588
|\ \ | |/ |/| | | | | Conflicts: src/builtins/source_builtin.cpp
| * Builtin: cache AST inside source builtinMu Qiao2011-05-081-5/+13
| | | | | | | | | | | | | | AST can be reused in order to improve the performance. Now we use a static variable inside the source builtin to cache all the ASTs created by the builtin. In future we may define rules to change the internal behavior.
| * Utils: reimplement instruo with libbashMu Qiao2011-05-0811-85/+571
| | | | | | | | | | | | With the help of instruo from Paludis, we can setup variables to bash env needed for metadata generation. In the meanwhile, we can compare the original instruo utility with our implementation.
| * Core: return 0 if boost::lexical_cast<int> failsMu Qiao2011-05-072-1/+3
| | | | | | | | | | | | Instead of throw an exception, we should return 0 as bash does. The exact bash implementation is a bit different so we need to specialize boost::lexical_cast<int> in future.
* | Merge remote-tracking branch 'mu/local_variables'Petteri Räty2011-05-077-28/+88
|\ \ | | | | | | | | | | | | Conflicts: scripts/function_def.bash
| * | Walker: support defining local variablesMu Qiao2011-05-075-26/+84
| | |
| * | Parser: support defining local variablesMu Qiao2011-05-072-2/+4
| |/
* / Builtin: implement the return builtinMu Qiao2011-05-0712-10/+240
|/
* Core: refactor interpreter classMu Qiao2011-05-062-57/+80
| | | | Some large methods are moved into cpp source file.
* Walker: support logical command listMu Qiao2011-05-063-2/+17
| | | | && and || operators are supported for command list.
* Builtin: implement inherit builtinMu Qiao2011-04-289-17/+232
| | | | | metadata_generator is improved to make use of the information added by inherit builtin.
* Builtin: implement source builtinMu Qiao2011-04-287-0/+157
|
* Core: support unsetting variables, fix is_nullMu Qiao2011-04-287-25/+105
| | | | | Empty variable values are all treated as null value. This simplifies the previous code and fixes some logic errors.
* Core: use reference/pointer for the interpreter objectMu Qiao2011-04-289-137/+56
| | | | | | We don't share interpreter object and it's safer to use reference rather than shared_ptr. Raw pointer is used in the generated C source code.
* Builtin: add interpreter object as a protected memberMu Qiao2011-04-285-14/+31
| | | | | Many builtins use the internal interpreter class so we add it to the cppbash_builtin class.
* Merge remote-tracking branch 'mu/compound_expr'Petteri Räty2011-04-2719-72/+533
|\
| * Walker: support case statementMu Qiao2011-04-276-12/+86
| |
| * Walker: support if statementMu Qiao2011-04-277-8/+111
| |
| * Walker: support until loopMu Qiao2011-04-273-2/+19
| |
| * Walker: support while loopMu Qiao2011-04-273-2/+43
| |
| * Walker: implement test expressionMu Qiao2011-04-274-1/+54
| | | | | | | | | | Only a limited set of operation is supported for now: =, ==, !=, \>, \<.
| * Parser: support == and != in test built-inMu Qiao2011-04-272-2/+8
| | | | | | | | | | Virtual token is used instead of OP['..'] because the previous one can't be handled by tree grammar.
| * Parser: simplify and fix cond_part ruleMu Qiao2011-04-274-10/+6
| | | | | | | | | | | | We don't have to use so many alternatives in cond_part because fname will cover all that. Reserved word shouldn't be treated specially.
| * Walker: support special variables in var_refMu Qiao2011-04-265-1/+27
| | | | | | | | | | The syntax for special variables is now supported. Only $? has a runtime now.
| * Walker: support C style for loopMu Qiao2011-04-266-7/+70
| | | | | | | | Syntax like for((expr1; expr2; expr3)) is supported now.
| * Walker: support for each loopMu Qiao2011-04-257-17/+79
| | | | | | | | | | Syntax like "for x in blah" is supported now. Empty value used as $@ is not supported for now. Add support for $? variable.
| * Walker: change the implementation of index searchingMu Qiao2011-04-251-20/+20
| | | | | | | | | | | | | | We used recursive counting algorithm to find the index of LT(2). Now it's changed to recurrence algorithm that directly traverse the input stream. This can benefit function definition and compound command.
| * Core: fix bug in word splittingMu Qiao2011-04-222-1/+21
| | | | | | | | | | Word splitting wouldn't trim leading and trailing IFS characters. Now it's fixed.
* | Utility: write a script that generates ebuild metadataMu Qiao2011-04-262-0/+28
| |
* | Utility: improve the output format of metadata_generatorMu Qiao2011-04-262-6/+18
| | | | | | | | | | The metadata_generator now generates the same format as what Portage does.
* | Core: support DEFINED_PHASES for metadata generationMu Qiao2011-04-2611-12/+138
|/ | | | | | We need to retrieve names of defined functions in order to generate DEFINED_PHASES. The public API is modified a bit to support it. A custom test is added for metadata generation.
* Test: rename *ebuild* to *bash*Mu Qiao2011-04-2215-26/+26
| | | | | | The suffix is not proper when we want to distinguish normal shell scripts from ebuilds. So we rename these tests to make it possible to use metadata_generator as the compiler for *.ebuild.
* Parser: turn on memoizePetteri Räty2011-04-211-0/+1
| | | | | The massif and benchmark_parser make targets show that we benefit greatly from turning on memoization.
* Walker: first support for command substitutionMu Qiao2011-04-205-0/+35
| | | | | A simple command substitution is supported. Currently the commands are executed within the current process.