Re: json api WIP patch

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2013-01-02T21:45:35Z
Lists: pgsql-hackers
On Wed, Dec 26, 2012 at 3:33 PM, Andrew Dunstan <andrew@dunslane.net> wrote:
> Here is a patch for the first part of the JSON API that was recently
> discussed. It includes the json  parser hook infrastructure and functions
> for json_get and friends, plus json_keys.
>
> As is, this exposes the json lexer fully for use by the hook functions. But
> I could easily be persuaded that this should be an opaque structure with
> some constructor and getter functions - I don't think the hook functions
> need or should be able to set anything in the lexer.
>
> Work is proceeding on some of the more advanced functionality discussed.

This seems to contain a large number of spurious whitespace changes.

And maybe some other spurious changes.  For example, I'm not sure why
this comment is truncated:

  		}
  	}

! 	/*
! 	 * Check for trailing garbage.  As in json_lex(), any alphanumeric stuff
! 	 * here should be considered part of the token for error-reporting
! 	 * purposes.
! 	 */
  	for (p = s; JSON_ALPHANUMERIC_CHAR(*p); p++)
  		error = true;
  	lex->token_terminator = p;
  	if (error)
  		report_invalid_token(lex);
--- 730,739 ----
  		}
  	}

! 	/* Check for trailing garbage. */
  	for (p = s; JSON_ALPHANUMERIC_CHAR(*p); p++)
  		error = true;
+ 	lex->prev_token_terminator = lex->token_terminator;
  	lex->token_terminator = p;
  	if (error)
  		report_invalid_token(lex);


-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company