Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

Commit

Permalink
Gumbo: Integrate from GitHub. This syncs up to 17d5f7b
Browse files Browse the repository at this point in the history
Commits included in this CL:

* Change naming convention for struct tags from _Gumbo to GumboInternal so it doesn't violate C reserved word conventions.
1e892b1

Also added the .gitmodules, CONTRIBUTING.md, autogen.sh, and gumbo_parser.gyp files, which have been contributed by outside authors but didn't make it into the last integration.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=51549719
  • Loading branch information
Jonathan Tang committed Aug 28, 2013
1 parent 17d5f7b commit 1fbc93b
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Patches and pull requests are also welcome, but before accepting patches, I need
https://developers.google.com/open-source/cla/individual
https://developers.google.com/open-source/cla/corporate

(Electronic signatures are fine or individual contributors.)
(Electronic signatures are fine for individual contributors.)

If you're unwilling to do this, it would be most helpful if you could file bug reports that include detailed prose about where in the code the error is and how to fix it, but leave out exact source code.
Empty file modified autogen.sh
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion src/char_ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -2530,7 +2530,7 @@ static bool consume_named_ref(
}

bool consume_char_ref(
struct GumboInternalParser* parser, struct _Utf8Iterator* input,
struct GumboInternalParser* parser, struct GumboInternalUtf8Iterator* input,
int additional_allowed_char, bool is_in_attribute,
OneOrTwoCodepoints* output) {
utf8iterator_mark(input);
Expand Down
4 changes: 2 additions & 2 deletions src/char_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extern "C" {
#endif

struct GumboInternalParser;
struct _Utf8Iterator;
struct GumboInternalUtf8Iterator;

// Value that indicates no character was produced.
extern const int kGumboNoChar;
Expand All @@ -50,7 +50,7 @@ typedef struct {
// space for the "additional allowed char" when the spec says "with no
// additional allowed char". Returns false on parse error, true otherwise.
bool consume_char_ref(
struct GumboInternalParser* parser, struct _Utf8Iterator* input,
struct GumboInternalParser* parser, struct GumboInternalUtf8Iterator* input,
int additional_allowed_char, bool is_in_attribute,
OneOrTwoCodepoints* output);

Expand Down
2 changes: 1 addition & 1 deletion src/tokenizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ bool gumbo_lex(struct GumboInternalParser* parser, GumboToken* output);

// Frees the internally-allocated pointers within an GumboToken. Note that this
// doesn't free the token itself, since oftentimes it will be allocated on the
// stack. A simple call to free() (or struct GumboInternalParser->deallocator, if
// stack. A simple call to free() (or GumboParser->deallocator, if
// appropriate) can handle that.
//
// Note that if you are handing over ownership of the internal strings to some
Expand Down
6 changes: 3 additions & 3 deletions src/utf8.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct GumboInternalParser;
// Unicode replacement char.
extern const int kUtf8ReplacementChar;

typedef struct _Utf8Iterator {
typedef struct GumboInternalUtf8Iterator {
// Points at the start of the code point most recently read into 'current'.
const char* _start;

Expand Down Expand Up @@ -82,8 +82,8 @@ bool utf8_is_invalid_code_point(int c);
// Initializes a new Utf8Iterator from the given byte buffer. The source does
// not have to be NUL-terminated, but the length must be passed in explicitly.
void utf8iterator_init(
struct GumboInternalParser* parser, const char* source, size_t source_length,
Utf8Iterator* iter);
struct GumboInternalParser* parser, const char* source,
size_t source_length, Utf8Iterator* iter);

// Advances the current position by one code point.
void utf8iterator_next(Utf8Iterator* iter);
Expand Down
3 changes: 2 additions & 1 deletion src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ char* gumbo_copy_stringz(struct GumboInternalParser* parser, const char* str);

// Allocate a chunk of memory, using the allocator specified in the Parser's
// config options.
void* gumbo_parser_allocate(struct GumboInternalParser* parser, size_t num_bytes);
void* gumbo_parser_allocate(
struct GumboInternalParser* parser, size_t num_bytes);

// Deallocate a chunk of memory, using the deallocator specified in the Parser's
// config options.
Expand Down
6 changes: 4 additions & 2 deletions src/vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ void gumbo_vector_add(
vector->data[vector->length++] = element;
}

void* gumbo_vector_pop(struct GumboInternalParser* parser, GumboVector* vector) {
void* gumbo_vector_pop(
struct GumboInternalParser* parser, GumboVector* vector) {
if (vector->length == 0) {
return NULL;
}
Expand All @@ -90,7 +91,8 @@ int gumbo_vector_index_of(GumboVector* vector, void* element) {
}

void gumbo_vector_insert_at(
struct GumboInternalParser* parser, void* element, int index, GumboVector* vector) {
struct GumboInternalParser* parser, void* element, int index,
GumboVector* vector) {
assert(index >= 0);
assert(index <= vector->length);
enlarge_vector_if_full(parser, vector);
Expand Down
9 changes: 6 additions & 3 deletions src/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ struct GumboInternalParser;

// Initializes a new GumboVector with the specified initial capacity.
void gumbo_vector_init(
struct GumboInternalParser* parser, size_t initial_capacity, GumboVector* vector);
struct GumboInternalParser* parser, size_t initial_capacity,
GumboVector* vector);

// Frees the memory used by an GumboVector. Does not free the contained
// pointers.
void gumbo_vector_destroy(struct GumboInternalParser* parser, GumboVector* vector);
void gumbo_vector_destroy(
struct GumboInternalParser* parser, GumboVector* vector);

// Adds a new element to an GumboVector.
void gumbo_vector_add(
Expand All @@ -47,7 +49,8 @@ void* gumbo_vector_pop(struct GumboInternalParser* parser, GumboVector* vector);
// Inserts an element at a specific index. This is potentially O(N) time, but
// is necessary for some of the spec's behavior.
void gumbo_vector_insert_at(
struct GumboInternalParser* parser, void* element, int index, GumboVector* vector);
struct GumboInternalParser* parser, void* element, int index,
GumboVector* vector);

// Removes an element from the vector, or does nothing if the element is not in
// the vector.
Expand Down

0 comments on commit 1fbc93b

Please sign in to comment.