Pattern AST
  
     |    repeated changes
    P|        -*\n
   SP|        r{:int rev} \| { \S+ author } \| {:date date} {:time time} \S+ {#}
   SP|        \([^)]+\) \| {:int lines} lines\n
  
    P|        Changed paths:\n
     |        repeated paths
    P|            \s+ { \w action } \s+ { [^\n]+ path } \n
     |        end
    P|        \n
     |   
    #         TODO: like P4, need a "until next match" phase
    P|        { [^-]* desc }
     |    end
MatchRepeated    (name: changes)
    MatchRegex '-*\\n'
    MatchLiteral 'r'
    MatchSubpattern (anon)
    MatchRegex ' \\| '
    MatchValue    (name: author, scalar)
        MatchRegex '\\S+'
    MatchRegex ' \\| '
    MatchSubpattern (anon)
    MatchLiteral ' '
    MatchSubpattern (anon)
    MatchRegex ' \\S+ '
    MatchRegex '\\([^)]+\\) \\| '
    MatchSubpattern (anon)
    MatchRegex ' lines\\n'
    MatchRegex 'Changed paths:\\n'
    MatchRepeated    (name: paths)
        MatchRegex '\\s+'
        MatchValue    (name: action, scalar)
            MatchRegex '\\w'
        MatchRegex '\\s+'
        MatchValue    (name: path, scalar)
            MatchRegex '[^\\n]+'
        MatchRegex '\\n'
    MatchRegex '\\n'
    MatchValue    (name: desc, scalar)
        MatchRegex '[^-]*'
Input String Captured JSON
------------------------------------------------------------------------
r274 | andy@chubot.org | 2009-06-06 00:17:20 -0700 (Sat, 06 Jun 2009) | 5 lines
Changed paths:
   M /trunk/python/jsontemplate/formatters.py
   M /trunk/python/jsontemplate/formatters_test.py

Add a plural? formatter.

I don't expect this to be the complete solution to the plural problem, but it might help in small cases.


------------------------------------------------------------------------
r273 | andy@chubot.org | 2009-06-06 00:06:20 -0700 (Sat, 06 Jun 2009) | 2 lines
Changed paths:
   M /trunk/python/jsontemplate/_jsontemplate.py
   M /trunk/python/jsontemplate/jsontemplate_unittest.py

Allow more_formatters to be a dictionary.  This is more convenient and suffices for many cases (in particular when there are no formatters with arguments).

------------------------------------------------------------------------
r272 | andy@chubot.org | 2009-05-31 23:07:33 -0700 (Sun, 31 May 2009) | 2 lines
Changed paths:
   M /trunk/python/jsontemplate/_jsontemplate.py

Remove unused import.

------------------------------------------------------------------------
{
  "changes": [
    {
      "paths": [
        {
          "action": "M", 
          "path": "/trunk/python/jsontemplate/formatters.py"
        }, 
        {
          "action": "M", 
          "path": "/trunk/python/jsontemplate/formatters_test.py"
        }
      ], 
      "time": {
        "second": 20, 
        "minute": 17, 
        "hour": 0
      }, 
      "date": {
        "month": 6, 
        "day": 6, 
        "year": 2009
      }, 
      "rev": 274, 
      "author": "andy@chubot.org", 
      "lines": 5, 
      "desc": "Add a plural? formatter.\n\nI don't expect this to be the complete solution to the plural problem, but it might help in small cases.\n\n\n"
    }, 
    {
      "paths": [
        {
          "action": "M", 
          "path": "/trunk/python/jsontemplate/_jsontemplate.py"
        }, 
        {
          "action": "M", 
          "path": "/trunk/python/jsontemplate/jsontemplate_unittest.py"
        }
      ], 
      "time": {
        "second": 20, 
        "minute": 6, 
        "hour": 0
      }, 
      "date": {
        "month": 6, 
        "day": 6, 
        "year": 2009
      }, 
      "rev": 273, 
      "author": "andy@chubot.org", 
      "lines": 2, 
      "desc": "Allow more_formatters to be a dictionary.  This is more convenient and suffices for many cases (in particular when there are no formatters with arguments).\n\n"
    }, 
    {
      "paths": [
        {
          "action": "M", 
          "path": "/trunk/python/jsontemplate/_jsontemplate.py"
        }
      ], 
      "time": {
        "second": 33, 
        "minute": 7, 
        "hour": 23
      }, 
      "date": {
        "month": 5, 
        "day": 31, 
        "year": 2009
      }, 
      "rev": 272, 
      "author": "andy@chubot.org", 
      "lines": 2, 
      "desc": "Remove unused import.\n\n"
    }
  ]
}

This HTML fragment was automatically generated from the test cases for JSON Pattern.