Switch branches/tags
Nothing to show
Commits on Aug 28, 2008
  1. Fixed some tests

    mcmire committed Aug 28, 2008
  2. More fixes 'n stuff

    mcmire committed Aug 28, 2008
    Made Lexicon.parser public again
    Add vars argument to Parser.parse, and
    Add functional tests for all command outputs, specifically [unless]...[/unless]
    Test [one.two.three] when [one.two] returns nil
    Test inner subs, within quotes and without
    Raise error in handle_quoted_arg if char before quote is not whitespace
    handle_command if left bracket reached during gather_command_name_and_args
    handle_quoted_arg doesn't need an argument
    In handle_quoted_arg, add dummy command to stack, not last item on stack
Commits on Aug 27, 2008
  1. Brought documentation up to date

    mcmire committed Aug 27, 2008
    Only load command classes once
    Removed BlockCommand#closed_by?
    Simplified Context.construct_from, assumes hash is always just a Hash
    Simplified Filter.filter (don't run text through 'unescaped' filter, just return text)
    Renamed Parser.cached_path to .cached_file
    Renamed Papyrus.source_template_dirs to .source_template_paths
    Uncommented private keyword in Parser metaclass
Commits on Aug 25, 2008
  1. More misc fixes

    mcmire committed Aug 25, 2008
    - Ensure that Variable#output returns a string
    - ContextItem#get_primary_part should not cache values from objects
    - ContextItem#get_secondary_part should not cache values from multipart keys
    - Fix value of iter.is_odd in Loop
Commits on Aug 24, 2008
  1. Brought Variable back; fixed BlockCommand ancestry lookup. Acceptance…

    mcmire committed Aug 24, 2008
    … test finally works!
    Switched order of resolving variables/commands in Parser#lookup_var_or_command (treat commands as unoverridable keywords)
    When treating bracketed construct as variable, defer evaluation of variable until runtime by adding instance of Variable to stack instead of just a Text node
    Redefine BlockCommand#get to return active_block.get
    Added ContextItem#parent_get to use parent._get if BlockCommand, or parent.get otherwise (to prevent an infinite loop); modified #get_primary_part to call #parent_get
    Modified Variable to receive raw command so it can return that in #output if the variable doesn't exist
    Renamed TokenList @cmd_info to @stash
  2. Fixing various brokenness after running acceptance test

    mcmire committed Aug 24, 2008
    Removed call to modify_close_cmd in Parser#handle_command, and removed modify_close_cmd test in parser_test.rb
    Load command classes on instead of
    Added guarded lexicon reader in Papyrus
    Fixed Parser#modify_active_cmd to accept command name and args, not full command
    Parser#populate_template: only add command from handle_command if not nil (as handle_command_close will return nil)
    Changed BlockCommand#initialize and #add to return NotImplementedError
    Added BlockCommand#active_block to raise NotImplementedError
    Implemented active_block for BlockCommand subclasses
    Added BlockCommand#add, remove BlockCommand subclass #add's
    ContextItem#get should return key if key starts with a number
    Added Papyrus.cache_templates writer and .cache_templates? reader, modified Parser to only cache the template if this option is true
    Renamed 'recording' methods in TokenList to 'stashing', added #stash_curr to append the current token to the stash
  3. No longer need to pass context to output methods

    mcmire committed Aug 24, 2008
    A NodeList is a ContextItem
    Move parent attribute from ContextItem to Node (Text and Variable are only two classes that do not receive parent)
    Rename ContextItem#reset_vars to #reset_context, and have it set @object to nil too
    Remove Template#output (NodeList already provides that)
    Template is no longer a ContextItem (NodeList is one already)
    Added NodeTest, seems to have been missing
    When we look for a variable in Parser#lookup_var_or_command, if stack.last is a BlockCommand, look up within its active block, not the whole command
Commits on Aug 22, 2008
  1. Updated Filter so that filter methods are in a Filters module, update…

    mcmire committed Aug 22, 2008
    …d Filter.filter so it doesn't require a context, class name, or block
    Updated Commands::Filter to use Papyrus::Filter, renamed @text to @nodes, added test
    Updated Variable to use Papyrus::Filter, renamed 'processor' to 'filter'
    Removed tests for Compiler, DefaultPreprocessor, FileSource, Lexicon, Source, StringSource
  2. Added caching to Parser (don't need Compiler anymore)

    mcmire committed Aug 22, 2008
    Added Papyrus.source_template_dirs, .cached_template_dir
    Renamed ContextItem#values to #vars
    Added ContextItem#vars=, so now you can mass assign vars
    Renamed ContextItem#clear to #reset_vars (and removed #clear_cache)
    Commented out FileSource, StringSource, Compiler, Lexicon from being require'd
    Modified Parser to save content in instance variable
    Removed unnecessary methods in ruby_ext.rb and added some more
    Ensured that all tests work
Commits on Aug 20, 2008
Commits on Aug 19, 2008
  1. If block commands are open on stack at end of stack, autoclose them (…

    mcmire committed Aug 19, 2008
    Rename Parser#commandify to #make_template and split into #populate_template and #close_open_block_commands
  2. BlockCommand is now a ContextItem; when it's created in Parser, assig…

    mcmire committed Aug 19, 2008
    …n parent to last item on stack
    Parser is no longer a ContextItem; remove Parser.recent_parser and initialize options; set @template to Template
    Fix ContextItem#parser when self is a Template
    Reorder require's in papyrus.rb
    Fix Parser, Compiler, BlockCommand tests
Commits on Aug 18, 2008
  1. When parsing a nullary construct (e.g. [foo]), interpret as a variabl…

    mcmire committed Aug 18, 2008
    …e in the current context before interpreting as a command
    ContextItem#get should not catch exceptions that may occur; removed clean_rescue option
    Fix Template so parent is set to parser in constructor instead of when output is called
  2. Removed method_separator_regexp as an option to Compiler - we can ass…

    mcmire committed Aug 18, 2008
    …ume a dot separates methods
    Split off Token and TokenList from Parser into separate files
    Modified Parser#close_active_cmd to not use Command#closed_by? but check end of command manually
    Cleaned up storing of raw and full commands
    Renamed TokenList#next to #advance, #next is #peek
Commits on Aug 17, 2008
  1. Removed lexicon option from Compiler

    mcmire committed Aug 17, 2008
    Ensured that all tests pass so far (except for DefaultLexicon of course)
    Fixed Include command to refer to Command, not Command::Base
    Fixed wrong variable in Compiler#compile
  2. Added Papyrus.available_commands to control which commands get loaded…

    mcmire committed Aug 17, 2008
    … at runtime, and therefore which commands the parser can "see"
    Added Command.aka and @aliases to set alternate names for commands (such as If)
    Changed Command#modified_by? so it doesn't use Lexicon to check - it just goes on whether or not the method exists
    Fixed If, Include, and Loop so they're in the Commands module (not Command)
    Modified Parser#lookup_command so it goes by Papyrus.lexicon hash instead of Lexicon#lookup, and replaced references to Lexicon::CommandNotFoundError to just
    Template is now a NodeList, not a BlockCommand
Commits on Aug 16, 2008
  1. Update NodeList and NodeList test

    mcmire committed Aug 16, 2008
  2. Um, let's try that again

    mcmire committed Aug 16, 2008
  3. Rename CommandBlock to NodeList

    mcmire committed Aug 16, 2008
    Update tests as per reorganization
    Fix test for Variable node
  4. Reorganizing tests

    mcmire committed Aug 16, 2008
  5. Whoops, forgot to add Node class

    mcmire committed Aug 16, 2008
  6. Major reorganization of classes, somewhat to make things simpler / mo…

    mcmire committed Aug 16, 2008
    …re logical, but also since commands have to be in their own module/folder, so we can load specific ones at runtime. Tests are broken again.
  7. Add Command::Base.modifier macro to more clearly define a modifier me…

    mcmire committed Aug 16, 2008
    …thod. Modifiers get stored in a @modifiers class instance variable. A modifier method
    receives an array of args passed to that modifier.
    Update Command subclasses to use .modifier instead of defining the method as usual
    Replace instances of raw_command with full_command ("raw" command includes the left and right brackets)
    Remove #end method from Command subclasses
  8. All Command subclasses that correspond to subs (so Base, Case, Commen…

    mcmire committed Aug 16, 2008
    …t, Define, Filter, If, Include, Loop, and Stackable) now accept just two arguments: command
    name and command args (an array).
    Removed modifier and closer class variables from all Command subclasses
Commits on Aug 15, 2008
  1. Extracted three lines of parsing code from Compiler#compile into a #p…

    mcmire committed Aug 15, 2008
    …arse method, updated tests
    Modified to just accept lexicon and parent context
    Removed commented out parsing code from Compiler
  2. Totally revamped parser (now compiler + parser/tokenizer) to follow D…

    mcmire committed Aug 15, 2008
    …iary-X/Codexed 'sub' syntax - quotes around args, nested subs, standardized sub invocation
    syntax. Lots of stuff likely broken, more renovation on the way.
Commits on Aug 10, 2008
  1. Removed unnecessary files

    mcmire committed Aug 10, 2008
Commits on Aug 9, 2008
  1. Changes to Lexicon:

    mcmire committed Aug 9, 2008
    - Changed how commands are stored -- they're now keyed by class name, not by symbol
    - Added ability to define local modifiers on a command. Moved :else, :elsif, and :when modifiers in DefaultLexicon to local modifiers to simplify things.
    - Global modifier ability revamped as global_modifier.
    - A closer is now defined separately from a modifier. So far, you can only define a closer globally, and there can only be one closer ('end' in the DefaultLexicon).
    - Changed default to store a class name instead of a symbol. This makes it so a NameError is thrown right away if the user refers to a nonexistent command.
    - Revamped modifies? as modifier_on, and added closer_on
    - Renamed @lexicon to @commands
    - Replaced command_open and command_close in Lexicon with bra and ket, resp.
    - Renamed define_global_var to just global_var
    Changes to Parser:
    - Reduced temporary variables during compilation to just stack.
    - Also, stack is no longer stored in an instance variable, but just passed around to other methods.
    - Renamed command_modifies_top_command? to modify_active_cmd, and changed it to call Command::Base#modified_by? instead of Lexicon.modifies?
    - Renamed command_closes_top_command? to close_active_cmd, and changed it to call Command::Base#closed_by? instead of Lexicon.modifies?
    Changes to Commands:
    - Added #modified_by? as complement to Lexicon#modifier_on
    - Added #closed_by? just for a closer
    - Added lexicon to the list of arguments passed to each Command instance, so you can access it from any method, not just output, and you don't have to go through context
    - Took out Unknown#lookup, instead we can just say @lexicon.lookup
Commits on Aug 4, 2008
  1. Lexicon:

    mcmire committed Aug 4, 2008
     - revamped define to look nicer and be more automatic about certain things
     - added adv_define for a more manual definition
     - added command_open and command_close, modified command_regex (now command_regexp) to use these instead
     - default now accepts a symbol that will get camelized
     - updated documentation
    Modified DefaultLexicon to use new define notation, and set command_open and command_close as opposed to command_regexp
    Fixed command.rb to correctly require files
    Command::Base and all subclasses now require first argument to be called_as, for consistency; updated tests to reflect this
    Verified that all tests work
    Updated TODO
    Updated expectations to 1.2.0
Commits on Aug 3, 2008
  1. Added unit and acceptance tests for PageTemplate. This encompasses th…

    mcmire committed Aug 3, 2008
    …e very latest changes.
  2. Extensive changes in this revision.

    mcmire committed Aug 3, 2008
    Started to fix some of the documentation
    Changed remaining instances of 'namespace' with 'context'
    Changed PageTemplate to a module instead of a class, since we never create an instance of it and class methods work on modules
    Changed @@modifier and @@closer in Command::Base to metaclass instance variables, and added attr_accessors; modified subclasses to set self.modifier and self.closer instead
    - added #length, #size, #first, #last, #empty?, #[] to delegate to @command_block
    - changed #add to return self
    - added #<< as alias to #add
    - modified #add to reverse statements, make compact, return self
    - modified #output so that context is not optional
    - moved #output code to .filter, .get_processing_components, and .get_context_and_parser (since the same sort of code is used with Command::Text), modified #output to use .filter instead
    - Bulked up main documentation to describe how @true_commands and @false_commands are used
    - Modified #add to reverse statements
    - Fixed typo in #elsif (Argumentrror)
    - Cleaned up #to_s
    - Split #output up into #get_template_from_value, #get_compiled_or_uncompiled_template, #compile_template for testing
    - Renamed iterators to block_params for clarity
    - Renamed @else_command to @else_commands
    - Modified #add to reverse statements, make compact, return self
    - Bulked up documentation for #output
    - Split #output up into #create_subcontext, #set_block_params, #set_metavariables
    - Modified #add to return self
    - Added #<< as alias to #add
    - Added #lookup as shortcut for context.parser.lexicon.lookup, which is quite a mouthful
    - Modified #output to use #lookup, changed case to if/else
    - Renamed @command to @raw_command
    - Changed #output to use Filter.filter instead of repeating code
    - Modified #set to stringify key before setting value
    - Split off code in #get into #get_primary_part, #get_secondary_part, cleaned up #get
    - Added private accessors for @values, @parent, changed references to use method instead of variable
    - Compacted #parser
    - Changed #true? to reflect renaming of Parser#args to #options, keys as symbols
    - Renamed @sub_regex back to @command_regex
    - Renamed references to command to command_contents for clarity
    - Changed cmd in modifier's to modifiee for clarity
    - Renamed @args to @options, symbolize keys before setting @options
    - Cleaned up #initialize
    - #get, #cache: Renamed cmds to template
    - Cleaned up #cache
    - Renamed sub_regex back to command_regex
    - Renamed command to raw_command
    - Cleaned up #lookup
    - Modified #modifies? to symbolize given modifier
    - Renamed rx to regexp
    - Modified #modifier to symbolize given sym
    - Added accessors to @lexicon and @modifiers, modified code to reference method instead of variable
    - Removed #parser, changed #initialize to set @parser instead
    - Renamed args to options, changed option keys to symbols
    - Changed #initialize so options are symbolized, and deleted as they go along so the options passed to Source are just for the source
    - :method_separators option now gets converted to @method_separator_regexp
    - Moved most of code in #parse to #tokenize, split off code into #handle_command, #add_text_as_command_to_top, #command_modifies_top_command? #command_closed_top_command?, #add_command_to_stack
    - Added #new_template
    - Renamed clearCommands to clear_commands
    - stack, top, modifier, closer are now stored in instance variables during parsing, added private accessors
    - Renamed @args to @options
    - Renamed @args to @options
    - Changed options to be symbolized before being stored
    - Removed #parent, changed #initialize to set @parent instead, changed #output to set self.parent
    - Converted case in @output to if/then