diff options
| author | Michael Forney <mforney@mforney.org> | 2016-12-23 15:32:20 -0800 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2016-12-29 23:29:18 -0800 |
| commit | e7181404bf50baf29e3a3d9f0e9ebe8a97566316 (patch) | |
| tree | 2ef48628d13ee934f9d43a37f1e4d58c6bb46ca1 /pkg/netsurf | |
| parent | 5084e84171fc00de2d65abd61e55577cd1fe1bff (diff) | |
Add netsurf 3.6
{nsgenbind,webidl}-{lexer,parser}.{c,h} were generated using flex and bison on
unmodified 0.4 sources.
Diffstat (limited to 'pkg/netsurf')
63 files changed, 14653 insertions, 0 deletions
diff --git a/pkg/netsurf/.gitignore b/pkg/netsurf/.gitignore new file mode 100644 index 00000000..012dc66e --- /dev/null +++ b/pkg/netsurf/.gitignore @@ -0,0 +1 @@ +/tools.ninja diff --git a/pkg/netsurf/config.h b/pkg/netsurf/config.h new file mode 100644 index 00000000..8f6a93ee --- /dev/null +++ b/pkg/netsurf/config.h @@ -0,0 +1,25 @@ +#define nsframebuffer +#define NETSURF_HOMEPAGE "https://google.com" +#define NETSURF_FB_RESPATH "${HOME}/.netsurf:${NETSURFRES}:/share/netsurf" +#define NETSURF_FB_FONTPATH "/share/fonts" + +#define FB_USE_FREETYPE +#define NETSURF_FB_FONT_SANS_SERIF "source-sans-pro/SourceSansPro-Regular.otf" +#define NETSURF_FB_FONT_SANS_SERIF_BOLD "source-sans-pro/SourceSansPro-Bold.otf" +#define NETSURF_FB_FONT_SANS_SERIF_ITALIC "source-sans-pro/SourceSansPro-It.otf" +#define NETSURF_FB_FONT_SANS_SERIF_ITALIC_BOLD "source-sans-pro/SourceSansPro-BoldIt.otf" +#define NETSURF_FB_FONT_SERIF "source-serif-pro/SourceSerifPro-Regular.otf" +#define NETSURF_FB_FONT_SERIF_BOLD "source-serif-pro/SourceSerifPro-Bold.otf" +#define NETSURF_FB_FONT_MONOSPACE "source-code-pro/SourceCodePro-Regular.otf" +#define NETSURF_FB_FONT_MONOSPACE_BOLD "source-code-pro/SourceCodePro-Bold.otf" +#define NETSURF_FB_FONT_CURSIVE "" +#define NETSURF_FB_FONT_FANTASY "" + +#define DUK_OPT_HAVE_CUSTOM_H 1 + +#define WITH_BMP 1 +#define WITH_CURL 1 +#define WITH_GIF 1 +#define WITH_JPEG 1 +#define WITH_OPENSSL 1 +#define WITH_PNG 1 diff --git a/pkg/netsurf/gen.rc b/pkg/netsurf/gen.rc new file mode 100644 index 00000000..bf409bdf --- /dev/null +++ b/pkg/netsurf/gen.rc @@ -0,0 +1,201 @@ +cflags -D NDEBUG + +subgen libcss +subgen libdom +subgen libhubbub +subgen libnsbmp +subgen libnsfb +subgen libnsgif +subgen libnsutils +subgen libparserutils +subgen libutf8proc +subgen libwapcaplet +subgen nsgenbind + +{ + toolchain host + exe convert_image -d pkg/libpng/headers frontends/framebuffer/convert_image.c ; with\ + ldlibs '-lpng -lz' +} >tools.ninja ; subninja tools.ninja + +# netsurf +cflags\ + -include '$dir'/config.h\ + -isystem '$builddir'/pkg/curl/include\ + -isystem '$builddir'/pkg/libjpeg-turbo/include\ + -isystem '$builddir'/pkg/libpng/include\ + -isystem '$dir'/libcss/src/include\ + -isystem '$dir'/libdom/src/include\ + -isystem '$dir'/libhubbub/src/include\ + -isystem '$dir'/libnsbmp/src/include\ + -isystem '$dir'/libnsfb/src/include\ + -isystem '$dir'/libnsgif/src/include\ + -isystem '$dir'/libnsutils/src/include\ + -isystem '$dir'/libparserutils/src/include\ + -isystem '$dir'/libutf8proc/src/include\ + -isystem '$dir'/libwapcaplet/src/include\ + -isystem pkg/freetype/src/include\ + -isystem pkg/libxkbcommon/src\ + -I '$dir' \ + -I '$srcdir' \ + -I '$srcdir'/include\ + -I '$srcdir'/frontends\ + -I '$srcdir'/content/handlers\ + -I '$outdir' \ + -I '$outdir'/libdom/include + +gen_inputs=($gen_inputs '$dir'/nsgenbind.txt) ; checkstatus +rule nsgenbind '$outdir/nsgenbind/nsgenbind -v -I $srcdir/content/handlers/javascript/WebIDL $in $outdir/duktape' ; with\ + restat 1 + +nsgenbind_srcs='$outdir'/duktape/`{cat nsgenbind.txt} +build $"nsgenbind_srcs nsgenbind '$srcdir'/content/handlers/javascript/duktape/netsurf.bnd '|' '$outdir'/nsgenbind/nsgenbind + +rule convert_image '$outdir/convert_image $in $out $var' +fn convert_image { + build '$outdir'/$1.c convert_image '$srcdir'/frontends/$2 '|' '$outdir'/convert_image ; with\ + var $1 +} + +convert_image left_arrow framebuffer/res/icons/back.png +convert_image right_arrow framebuffer/res/icons/forward.png +convert_image reload framebuffer/res/icons/reload.png +convert_image stop_image framebuffer/res/icons/stop.png +convert_image history_image framebuffer/res/icons/history.png + +convert_image left_arrow_g framebuffer/res/icons/back_g.png +convert_image right_arrow_g framebuffer/res/icons/forward_g.png +convert_image reload_g framebuffer/res/icons/reload_g.png +convert_image stop_image_g framebuffer/res/icons/stop_g.png +convert_image history_image_g framebuffer/res/icons/history_g.png + +convert_image osk_image framebuffer/res/icons/osk.png + +convert_image pointer_image framebuffer/res/pointers/default.png +convert_image hand_image framebuffer/res/pointers/point.png +convert_image caret_image framebuffer/res/pointers/caret.png +convert_image menu_image framebuffer/res/pointers/menu.png +convert_image progress_image framebuffer/res/pointers/progress.png +convert_image move_image framebuffer/res/pointers/move.png + +for(d in l r u d) + convert_image scroll$d framebuffer/res/icons/scroll$d.png +for(n in 0 1 2 3 4 5 6 7 8) + convert_image throbber$n gtk/res/throbber/throbber$n.png + +phony deps '$outdir'/duktape/binding.c\ + '$outdir'/^(\ + libcss libdom libhubbub libnsbmp libnsfb libnsgif\ + libparserutils libutf8proc libwapcaplet libnsutils\ + )^/fetch.stamp\ + '$builddir'/pkg/^(freetype libxkbcommon)^/fetch.stamp\ + ('$dir'/libdom pkg/^(curl libjpeg-turbo libpng))^/headers + +exe netsurf -d '$dir'/deps\ + desktop/^(\ + cookie_manager.c knockout.c hotlist.c mouse.c\ + plot_style.c print.c search.c searchweb.c scrollbar.c\ + sslcert_viewer.c textarea.c tree.c version.c\ + system_colour.c global_history.c treeview.c\ + \ + browser.c browser_history.c download.c frames.c netsurf.c\ + save_complete.c save_text.c selection.c textinput.c gui_factory.c\ + save_pdf.c font_haru.c\ + )\ + frontends/framebuffer/^(\ + gui.c framebuffer.c schedule.c bitmap.c fetch.c\ + findfile.c localhistory.c clipboard.c\ + font_freetype.c\ + fbtk/^(\ + fbtk.c event.c fill.c bitmap.c user.c window.c\ + text.c scroll.c osk.c\ + )\ + )\ + content/^(\ + content.c content_factory.c dirlist.c fetch.c hlcache.c\ + llcache.c mimesniff.c urldb.c no_backing_store.c\ + fetchers/^(curl.c data.c file.c about.c resource.c)\ + handlers/^(\ + javascript/^(fetcher.c content.c duktape/^(dukky.c duktape.c))\ + css/^(css.c dump.c internal.c hints.c select.c utils.c)\ + image/^(image.c image_cache.c bmp.c ico.c gif.c jpeg.c png.c)\ + )\ + )\ + utils/^(\ + base64.c\ + bloom.c\ + corestrings.c\ + file.c\ + filename.c\ + filepath.c\ + hashtable.c\ + idna.c\ + libdom.c\ + log.c\ + messages.c\ + nsoption.c\ + nsurl.c\ + punycode.c\ + talloc.c\ + time.c\ + url.c\ + useragent.c\ + utf8.c\ + utils.c\ + http/^(\ + challenge.c generics.c primitives.c parameter.c\ + content-disposition.c content-type.c www-authenticate.c\ + )\ + )\ + render/^(\ + box.c box_construct.c box_normalise.c box_textarea.c\ + font.c form.c imagemap.c layout.c search.c table.c textplain.c\ + html.c html_css.c html_css_fetcher.c html_script.c\ + html_interaction.c html_redraw.c html_forms.c html_object.c\ + )\ + '$outdir'/^(\ + duktape/`{grep '\.c$' nsgenbind.txt}\ + left_arrow.c right_arrow.c reload.c stop_image.c history_image.c\ + left_arrow_g.c right_arrow_g.c reload_g.c stop_image_g.c history_image_g.c\ + scroll^(l r u d)^.c\ + osk_image.c\ + (pointer hand caret menu progress move)^_image.c\ + throbber^(0 1 2 3 4 5 6 7 8)^.c\ + \ + libcss/libcss.a.d\ + libdom/libdom.a.d\ + libnsbmp/libnsbmp.a\ + libnsfb/^(libnsfb.a.d src/surface/ram.c.o wl.c.o)\ + libnsgif/libnsgif.a\ + libnsutils/libnsutils.a\ + libutf8proc/libutf8proc.a\ + )\ + '$builddir'/pkg/^(\ + curl/libcurl.a.d\ + freetype/libfreetype.a.d\ + libjpeg-turbo/libjpeg-turbo.a\ + libpng/libpng.a\ + zlib/libz.a\ + ) +file bin/netsurf '$outdir'/netsurf 755 + +build '$outdir'/netsurf.1 sed '$srcdir'/Docs/netsurf-fb.1 ; with\ + expr 's,netsurf-fb,netsurf,g' +man -d '$outdir' 1 netsurf.1 + +build '$outdir'/Messages awk '$srcdir'/resources/FatMessages '|' '$dir'/messages.awk ; with\ + expr '-f $dir/messages.awk -v lang=en -v filter=any' +file share/netsurf/Messages '$outdir'/Messages 644 + +file share/netsurf/adblock.css '$srcdir'/!NetSurf/Resources/AdBlock,f79 644 +file share/netsurf/credits.html '$srcdir'/!NetSurf/Resources/en/credits.html,faf 644 +file share/netsurf/default.css '$srcdir'/!NetSurf/Resources/CSS,f79 644 +file share/netsurf/favicon.png '$srcdir'/resources/favicon.png 644 +file share/netsurf/internal.css '$srcdir'/!NetSurf/Resources/internal.css,f79 644 +file share/netsurf/licence.html '$srcdir'/!NetSurf/Resources/en/licence.html,faf 644 +sym share/netsurf/maps.html welcome.html +file share/netsurf/netsurf.png '$srcdir'/!NetSurf/Resources/netsurf.png,b60 644 +file share/netsurf/quirks.css '$srcdir'/!NetSurf/Resources/Quirks,f79 644 +file share/netsurf/welcome.html '$srcdir'/!NetSurf/Resources/en/welcome.html,faf 644 + +fetch git diff --git a/pkg/netsurf/libcss/.gitignore b/pkg/netsurf/libcss/.gitignore new file mode 100644 index 00000000..012dc66e --- /dev/null +++ b/pkg/netsurf/libcss/.gitignore @@ -0,0 +1 @@ +/tools.ninja diff --git a/pkg/netsurf/libcss/gen.rc b/pkg/netsurf/libcss/gen.rc new file mode 100644 index 00000000..037e7eac --- /dev/null +++ b/pkg/netsurf/libcss/gen.rc @@ -0,0 +1,98 @@ +cflags\ + -isystem pkg/netsurf/libparserutils/src/include\ + -isystem pkg/netsurf/libwapcaplet/src/include\ + -I '$srcdir'/include\ + -I '$srcdir'/src + +{ + toolchain host + exe gen_prop_parser src/parse/properties/css_property_parser_gen.c +} >tools.ninja ; subninja tools.ninja + +build '$outdir'/prop_parsers.c awk '$srcdir'/src/parse/properties/properties.gen '|' '$dir'/prop_parsers.awk '$outdir'/gen_prop_parser ; with\ + expr '-f $dir/prop_parsers.awk gen_prop_parser=$outdir/gen_prop_parser' + +properties=(\ + helpers.c azimuth.c background_attachment.c background_color.c\ + background_image.c background_position.c background_repeat.c\ + border_bottom_color.c border_bottom_style.c border_bottom_width.c\ + border_collapse.c border_left_color.c border_left_style.c\ + border_left_width.c border_right_color.c border_right_style.c\ + border_right_width.c border_spacing.c border_top_color.c\ + border_top_style.c border_top_width.c bottom.c break_after.c\ + break_before.c break_inside.c caption_side.c clear.c clip.c color.c\ + column_count.c column_fill.c column_gap.c column_rule_color.c\ + column_rule_style.c column_rule_width.c column_span.c column_width.c\ + content.c counter_increment.c counter_reset.c cue_after.c cue_before.c\ + cursor.c direction.c display.c elevation.c empty_cells.c float.c\ + font_family.c font_size.c font_style.c font_variant.c font_weight.c\ + height.c left.c letter_spacing.c line_height.c list_style_image.c\ + list_style_position.c list_style_type.c margin_bottom.c margin_left.c\ + margin_right.c margin_top.c max_height.c max_width.c min_height.c\ + min_width.c opacity.c orphans.c outline_color.c outline_style.c\ + outline_width.c overflow_x.c overflow_y.c padding_bottom.c\ + padding_left.c padding_right.c padding_top.c page_break_after.c\ + page_break_before.c page_break_inside.c pause_after.c pause_before.c\ + pitch.c pitch_range.c play_during.c position.c quotes.c richness.c\ + right.c speech_rate.c speak.c speak_header.c speak_numeral.c\ + speak_punctuation.c stress.c table_layout.c text_align.c\ + text_decoration.c text_indent.c text_transform.c top.c unicode_bidi.c\ + vertical_align.c visibility.c voice_family.c volume.c white_space.c\ + widows.c width.c word_spacing.c writing_mode.c z_index.c\ +) + +phony deps '$builddir'/pkg/netsurf/^(libparserutils libwapcaplet)^/fetch.stamp + +lib libcss.a -d '$dir'/deps src/^(\ + stylesheet.c\ + charset/detect.c\ + lex/lex.c\ + parse/^(\ + parse.c language.c important.c propstrings.c font_face.c\ + properties/^(\ + azimuth.c\ + background.c\ + background_position.c\ + border.c\ + border_color.c\ + border_spacing.c\ + border_style.c\ + border_width.c\ + clip.c\ + columns.c\ + column_rule.c\ + content.c\ + cue.c\ + cursor.c\ + elevation.c\ + font.c\ + font_family.c\ + font_weight.c\ + list_style.c\ + list_style_type.c\ + margin.c\ + opacity.c\ + outline.c\ + overflow.c\ + padding.c\ + pause.c\ + play_during.c\ + properties.c\ + quotes.c\ + text_decoration.c\ + utils.c\ + voice_family.c\ + )\ + )\ + select/^(\ + computed.c dispatch.c hash.c select.c font_face.c\ + properties/$properties\ + )\ + utils/^(errors.c utils.c)\ +) '$builddir'/pkg/netsurf/^(\ + libcss/prop_parsers.c\ + libparserutils/libparserutils.a\ + libwapcaplet/libwapcaplet.a\ +) + +fetch git diff --git a/pkg/netsurf/libcss/prop_parsers.awk b/pkg/netsurf/libcss/prop_parsers.awk new file mode 100644 index 00000000..68a596af --- /dev/null +++ b/pkg/netsurf/libcss/prop_parsers.awk @@ -0,0 +1,10 @@ +BEGIN { + FS=":" +} + +/^#/ { next } +/^$/ { next } + +{ + system(gen_prop_parser " '" $0 "'") +} diff --git a/pkg/netsurf/libcss/rev b/pkg/netsurf/libcss/rev new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/pkg/netsurf/libcss/rev @@ -0,0 +1 @@ +1 diff --git a/pkg/netsurf/libcss/src b/pkg/netsurf/libcss/src new file mode 160000 +Subproject 2786e780f20eb45f3ee3f18585d23555a06a143 diff --git a/pkg/netsurf/libdom/gen.rc b/pkg/netsurf/libdom/gen.rc new file mode 100644 index 00000000..48645de7 --- /dev/null +++ b/pkg/netsurf/libdom/gen.rc @@ -0,0 +1,60 @@ +cflags\ + -isystem pkg/netsurf/libhubbub/src/include\ + -isystem pkg/netsurf/libparserutils/src/include\ + -isystem pkg/netsurf/libwapcaplet/src/include\ + -I '$srcdir'/include\ + -I '$srcdir'/src + +hdrs=bindings/hubbub/^(errors.h parser.h) +for(hdr in $hdrs) + build '$outdir'/include/dom/$hdr copy '$srcdir'/$hdr +phony headers '$outdir'/include/dom/$hdrs +phony deps '$builddir'/pkg/netsurf/^(libhubbub libparserutils libwapcaplet)^/fetch.stamp + +lib libdom.a -d '$dir'/deps\ + src/^(\ + core/^(\ + string.c node.c\ + attr.c characterdata.c element.c\ + implementation.c\ + text.c typeinfo.c comment.c\ + namednodemap.c nodelist.c\ + cdatasection.c document_type.c entity_ref.c pi.c\ + doc_fragment.c document.c\ + )\ + events/^(\ + event.c dispatch.c event_target.c document_event.c\ + custom_event.c keyboard_event.c mouse_wheel_event.c\ + text_event.c event_listener.c mouse_event.c mutation_event.c\ + ui_event.c mouse_multi_wheel_event.c mutation_name_event.c\ + )\ + html/^(\ + html_document.c html_collection.c html_options_collection.c\ + html_element.c html_html_element.c html_head_element.c\ + html_link_element.c html_title_element.c html_meta_element.c\ + html_base_element.c html_style_element.c\ + html_body_element.c html_form_element.c html_select_element.c\ + html_button_element.c html_input_element.c html_text_area_element.c\ + html_opt_group_element.c html_option_element.c html_hr_element.c\ + html_dlist_element.c html_directory_element.c html_menu_element.c\ + html_fieldset_element.c html_legend_element.c html_div_element.c\ + html_paragraph_element.c html_heading_element.c html_quote_element.c\ + html_pre_element.c html_br_element.c html_label_element.c\ + html_ulist_element.c html_olist_element.c html_li_element.c\ + html_font_element.c html_mod_element.c html_anchor_element.c\ + html_basefont_element.c html_image_element.c html_object_element.c\ + html_param_element.c html_applet_element.c html_area_element.c\ + html_map_element.c html_script_element.c html_tablecaption_element.c\ + html_tablecell_element.c html_tablecol_element.c html_tablesection_element.c\ + html_table_element.c html_tablerow_element.c html_frameset_element.c\ + html_frame_element.c html_iframe_element.c html_isindex_element.c\ + )\ + utils/^(namespace.c hashtable.c character_valid.c validate.c)\ + )\ + bindings/hubbub/parser.c\ + '$builddir'/pkg/netsurf/^(\ + libhubbub/libhubbub.a.d\ + libwapcaplet/libwapcaplet.a\ + ) + +fetch git diff --git a/pkg/netsurf/libdom/rev b/pkg/netsurf/libdom/rev new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/pkg/netsurf/libdom/rev @@ -0,0 +1 @@ +1 diff --git a/pkg/netsurf/libdom/src b/pkg/netsurf/libdom/src new file mode 160000 +Subproject 56bc77504bd6e45b52cedd5a293d57c076ad9c9 diff --git a/pkg/netsurf/libhubbub/entities.awk b/pkg/netsurf/libhubbub/entities.awk new file mode 100644 index 00000000..43ccc89b --- /dev/null +++ b/pkg/netsurf/libhubbub/entities.awk @@ -0,0 +1,55 @@ +BEGIN { + for (i = 32; i <= 126; ++i) + ord[sprintf("%c", i)] = i + n = -1 +} + +function makenode(c) { + ++n + splits[n] = c + left[n] = -1 + equal[n] = -1 + right[n] = -1 + values[n] = 0 +} + +function insert(nodes, id, c) { + nextid = nodes[id] + if (nextid != -1) + return nextid + makenode(c) + nodes[id] = n + return n +} + +/^(#|$)/ {next} + +{ + id = 0 + c = ord[substr($1, 1, 1)] + if (n < 0) + makenode(c) + for (i = 1; i <= length($1) + 1;) { + if (c < splits[id]) { + id = insert(left, id, c) + } else if (c == splits[id]) { + if (i >= length($1)) + values[id] = $2 + if (c == 0) + break + ++i + c = i <= length($1) ? ord[substr($1, i, 1)] : 0 + id = insert(equal, id, c) + } else { + id = insert(right, id, c) + } + } +} + +END { + print "static hubbub_entity_node dict[] = {" + for (i = 0; i <= n; ++i) + print "\t{ "splits[i]", "left[i]", "equal[i]", "right[i]", "values[i]" }," + print "};" + print "static int32_t dict_root = 0;" +} diff --git a/pkg/netsurf/libhubbub/gen.rc b/pkg/netsurf/libhubbub/gen.rc new file mode 100644 index 00000000..63cef77b --- /dev/null +++ b/pkg/netsurf/libhubbub/gen.rc @@ -0,0 +1,33 @@ +cflags\ + -isystem pkg/netsurf/libdom/src/include\ + -isystem pkg/netsurf/libparserutils/src/include\ + -isystem pkg/netsurf/libwapcaplet/src/include\ + -I '$outdir' \ + -I '$srcdir'/src\ + -I '$srcdir'/include + +build '$outdir'/entities.inc awk '$srcdir'/build/Entities '|' '$dir'/entities.awk ; with\ + expr '-f $dir/entities.awk' + +phony deps\ + '$outdir'/entities.inc\ + '$builddir'/pkg/netsurf/^(libdom libparserutils libwapcaplet)^/fetch.stamp + +lib libhubbub.a -d '$dir'/deps src/^(\ + parser.c\ + charset/detect.c\ + tokeniser/^(entities.c tokeniser.c)\ + treebuilder/^(\ + treebuilder.c\ + initial.c before_html.c before_head.c in_head.c\ + in_head_noscript.c after_head.c in_body.c in_table.c\ + in_caption.c in_column_group.c in_table_body.c in_row.c\ + in_cell.c in_select.c in_select_in_table.c\ + in_foreign_content.c after_body.c in_frameset.c\ + after_frameset.c after_after_body.c after_after_frameset.c\ + generic_rcdata.c\ + )\ + utils/^(errors.c string.c)\ +) '$builddir'/pkg/netsurf/libparserutils/libparserutils.a + +fetch git diff --git a/pkg/netsurf/libhubbub/rev b/pkg/netsurf/libhubbub/rev new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/pkg/netsurf/libhubbub/rev @@ -0,0 +1 @@ +1 diff --git a/pkg/netsurf/libhubbub/src b/pkg/netsurf/libhubbub/src new file mode 160000 +Subproject 73071c0dea1e4bcfd094810d051aebc74e6c648 diff --git a/pkg/netsurf/libnsbmp/gen.rc b/pkg/netsurf/libnsbmp/gen.rc new file mode 100644 index 00000000..ca9158a0 --- /dev/null +++ b/pkg/netsurf/libnsbmp/gen.rc @@ -0,0 +1,2 @@ +lib libnsbmp.a src/libnsbmp.c +fetch git diff --git a/pkg/netsurf/libnsbmp/rev b/pkg/netsurf/libnsbmp/rev new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/pkg/netsurf/libnsbmp/rev @@ -0,0 +1 @@ +1 diff --git a/pkg/netsurf/libnsbmp/src b/pkg/netsurf/libnsbmp/src new file mode 160000 +Subproject 451cd990477dfcf50058370a7f8c67dba0d612b diff --git a/pkg/netsurf/libnsfb/gen.rc b/pkg/netsurf/libnsfb/gen.rc new file mode 100644 index 00000000..3d63e893 --- /dev/null +++ b/pkg/netsurf/libnsfb/gen.rc @@ -0,0 +1,26 @@ +cflags\ + -isystem '$builddir'/pkg/wayland/include\ + -isystem '$builddir'/pkg/wayland-protocols/include\ + -isystem pkg/libxkbcommon/src\ + -I '$srcdir'/include\ + -I '$srcdir'/src + +deps=(\ + pkg/^(wayland wayland-protocols)^/headers\ + '$builddir'/pkg/libxkbcommon/fetch.stamp\ + '$outdir'/fetch.stamp\ +) +build '$outdir'/wl.c.o cc '$dir'/wl.c '||' $deps +cc src/surface/ram.c + +lib libnsfb.a src/^(\ + libnsfb.c dump.c cursor.c palette.c\ + plot/^(api.c util.c generic.c 32bpp-xrgb8888.c 32bpp-xbgr8888.c 16bpp.c 8bpp.c)\ + surface/surface.c\ +) '$builddir'/pkg/^(\ + wayland/libwayland-client.a.d\ + wayland-protocols/xdg-shell-unstable-v5-protocol.c.o\ + libxkbcommon/libxkbcommon.a\ +) + +fetch git diff --git a/pkg/netsurf/libnsfb/patch/0001-Add-XKB-key-events.patch b/pkg/netsurf/libnsfb/patch/0001-Add-XKB-key-events.patch new file mode 100644 index 00000000..f51a891a --- /dev/null +++ b/pkg/netsurf/libnsfb/patch/0001-Add-XKB-key-events.patch @@ -0,0 +1,55 @@ +From 4fd4359563e38ee0b4cd70fcaba6d935f4d2afdf Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Sun, 25 Dec 2016 14:50:47 -0800 +Subject: [PATCH] Add XKB key events + +--- + include/libnsfb_event.h | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/include/libnsfb_event.h b/include/libnsfb_event.h +index f98b5ba..006b51c 100644 +--- a/include/libnsfb_event.h ++++ b/include/libnsfb_event.h +@@ -11,11 +11,15 @@ + #ifndef _LIBNSFB_EVENT_H + #define _LIBNSFB_EVENT_H 1 + ++#include <xkbcommon/xkbcommon.h> ++ + enum nsfb_event_type_e { + NSFB_EVENT_NONE, + NSFB_EVENT_CONTROL, + NSFB_EVENT_KEY_DOWN, + NSFB_EVENT_KEY_UP, ++ NSFB_EVENT_XKB_KEY_DOWN, ++ NSFB_EVENT_XKB_KEY_UP, + NSFB_EVENT_MOVE_RELATIVE, + NSFB_EVENT_MOVE_ABSOLUTE, + NSFB_EVENT_RESIZE +@@ -179,6 +183,11 @@ enum nsfb_key_code_e { + + }; + ++enum nsfb_mod_e { ++ NSFB_MOD_CTRL = 1 << 0, ++ NSFB_MOD_SHIFT = 1 << 1, ++}; ++ + enum nsfb_control_e { + NSFB_CONTROL_NONE, + NSFB_CONTROL_TIMEOUT, /* timeout event */ +@@ -199,6 +208,10 @@ struct nsfb_event_s { + int w; /**< Width in pixels */ + int h; /**< Height in pixels */ + } resize; /**< Window resize event: NSFB_EVENT_RESIZE */ ++ struct { ++ xkb_keysym_t sym; ++ enum nsfb_mod_e mod; ++ } xkb; + } value; + }; + +-- +2.11.0 + diff --git a/pkg/netsurf/libnsfb/rev b/pkg/netsurf/libnsfb/rev new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/pkg/netsurf/libnsfb/rev @@ -0,0 +1 @@ +1 diff --git a/pkg/netsurf/libnsfb/src b/pkg/netsurf/libnsfb/src new file mode 160000 +Subproject 167205c109291aa1957ba64667efa12ce53bba5 diff --git a/pkg/netsurf/libnsfb/wl.c b/pkg/netsurf/libnsfb/wl.c new file mode 100644 index 00000000..f443e829 --- /dev/null +++ b/pkg/netsurf/libnsfb/wl.c @@ -0,0 +1,789 @@ +#include <fcntl.h> +#include <linux/input.h> +#include <linux/memfd.h> +#include <poll.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/mman.h> +#include <sys/param.h> +#include <sys/syscall.h> +#include <time.h> +#include <unistd.h> +#include <wayland-client.h> +#include <xdg-shell-unstable-v5-client-protocol.h> +#include <xkbcommon/xkbcommon.h> + +#include "libnsfb.h" +#include "libnsfb_event.h" + +#include "nsfb.h" +#include "surface.h" +#include "plot.h" + +struct wlevent { + struct wlevent *next; + nsfb_event_t event; +}; + +struct format { + uint32_t wl; + enum nsfb_format_e ns; +}; + +struct wlimage { + void *data; + int width, height, stride, size; + enum nsfb_format_e format; + struct wl_shm_pool *pool; + struct wl_buffer *buffer; +}; + +struct wlstate { + struct wl_display *display; + struct wl_registry *registry; + struct wl_compositor *compositor; + struct wl_seat *seat; + struct wl_shm *shm; + struct wl_keyboard *keyboard; + struct wl_pointer *pointer; + + struct wl_surface *surface; + struct wlimage *image; + + struct xdg_shell *shell; + struct xdg_surface *xdg_surface; + + struct wlevent *events, **events_end; + + struct format *formats; + int num_formats; + + int nextwidth, nextheight; + + struct { + struct xkb_context *ctx; + struct xkb_state *state; + struct xkb_keymap *map; + xkb_mod_index_t ctrl, shift; + } xkb; + enum nsfb_mod_e mods; + int buttons; + + struct { + int delay, interval, last; + bool started; + xkb_keysym_t sym; + } repeat; +}; + +static nsfb_event_t * +queue_event(struct wlstate *wl) +{ + struct wlevent *event; + + event = calloc(1, sizeof(*event)); + if (!event) + return NULL; + *wl->events_end = event; + wl->events_end = &event->next; + return &event->event; +} + +static int +clocknow(void) +{ + struct timespec ts; + + if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0) + return -1; + return ts.tv_sec * 1000 + ts.tv_nsec / 1e6; +} + +static void +registry_global(void *data, struct wl_registry *reg, uint32_t name, const char *interface, uint32_t version) +{ + struct wlstate *wl = data; + + if (strcmp(interface, "wl_compositor") == 0) { + wl->compositor = wl_registry_bind(reg, name, &wl_compositor_interface, MIN(version, 4)); + } else if (strcmp(interface, "wl_seat") == 0) { + wl->seat = wl_registry_bind(reg, name, &wl_seat_interface, MIN(version, 4)); + } else if (strcmp(interface, "wl_shm") == 0) { + wl->shm = wl_registry_bind(reg, name, &wl_shm_interface, MIN(version, 1)); + } else if (strcmp(interface, "xdg_shell") == 0) { + wl->shell = wl_registry_bind(reg, name, &xdg_shell_interface, MIN(version, 1)); + } +} + +static void +registry_global_remove(void *data, struct wl_registry *reg, uint32_t name) +{ +} + +static struct wl_registry_listener registry_listener = { + .global = registry_global, + .global_remove = registry_global_remove, +}; + +static void +shm_format(void *data, struct wl_shm *shm, uint32_t wlformat) +{ + struct wlstate *wl = data; + enum nsfb_format_e nsformat; + struct format *formats; + + switch (wlformat) { + case WL_SHM_FORMAT_XBGR8888: + nsformat = NSFB_FMT_XBGR8888; + break; + case WL_SHM_FORMAT_XRGB8888: + nsformat = NSFB_FMT_XRGB8888; + break; + case WL_SHM_FORMAT_ABGR8888: + nsformat = NSFB_FMT_ABGR8888; + break; + case WL_SHM_FORMAT_ARGB8888: + nsformat = NSFB_FMT_ARGB8888; + break; + case WL_SHM_FORMAT_RGB888: + nsformat = NSFB_FMT_RGB888; + break; + case WL_SHM_FORMAT_ARGB1555: + nsformat = NSFB_FMT_ARGB1555; + break; + case WL_SHM_FORMAT_RGB565: + nsformat = NSFB_FMT_RGB565; + break; + case WL_SHM_FORMAT_C8: + nsformat = NSFB_FMT_I8; + break; + default: + return; + } + + formats = realloc(wl->formats, (wl->num_formats + 1) * sizeof(*wl->formats)); + if (formats == NULL) + return; + wl->formats = formats; + wl->formats[wl->num_formats++] = (struct format){wlformat, nsformat}; +} + +static struct wl_shm_listener shm_listener = { + .format = shm_format, +}; + +static void +keyboard_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format, int32_t fd, uint32_t size) +{ + struct wlstate *wl = data; + char *str; + + str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); + if (str == MAP_FAILED) + return; + + xkb_keymap_unref(wl->xkb.map); + wl->xkb.map = xkb_keymap_new_from_buffer(wl->xkb.ctx, str, size, XKB_KEYMAP_FORMAT_TEXT_V1, 0); + if (wl->xkb.map == NULL) + return; + + xkb_state_unref(wl->xkb.state); + wl->xkb.state = xkb_state_new(wl->xkb.map); + wl->xkb.ctrl = xkb_keymap_mod_get_index(wl->xkb.map, XKB_MOD_NAME_CTRL); + wl->xkb.shift = xkb_keymap_mod_get_index(wl->xkb.map, XKB_MOD_NAME_SHIFT); +} + +static void +keyboard_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial , struct wl_surface *surface, struct wl_array *keys) +{ +} + +static void +keyboard_leave(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface) +{ + struct wlstate *wl = data; + + wl->repeat.sym = XKB_KEY_NoSymbol; +} + +static void +keyboard_key(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t time, uint32_t key, uint32_t state) +{ + struct wlstate *wl = data; + xkb_keysym_t sym; + nsfb_event_t *event; + int now; + + if (!wl->xkb.state) + return; + + sym = xkb_state_key_get_one_sym(wl->xkb.state, key + 8); + + event = queue_event(wl); + if (!event) + return; + + event->value.xkb.sym = sym; + event->value.xkb.mod = wl->mods; + if (state == WL_KEYBOARD_KEY_STATE_PRESSED) { + event->type = NSFB_EVENT_XKB_KEY_DOWN; + if (xkb_keymap_key_repeats(wl->xkb.map, key) && (now = clocknow()) >= 0) { + wl->repeat.sym = sym; + wl->repeat.started = false; + wl->repeat.last = now; + } + } else { + event->type = NSFB_EVENT_XKB_KEY_UP; + if (sym == wl->repeat.sym) + wl->repeat.sym = XKB_KEY_NoSymbol; + } +} + +static void +keyboard_modifiers(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t depressed, uint32_t latched, uint32_t locked, uint32_t group) +{ + struct wlstate *wl = data; + + xkb_state_update_mask(wl->xkb.state, depressed, latched, locked, group, 0, 0); + + wl->mods = 0; + if (wl->xkb.ctrl != XKB_MOD_INVALID && xkb_state_mod_index_is_active(wl->xkb.state, wl->xkb.ctrl, XKB_STATE_MODS_EFFECTIVE)) + wl->mods |= NSFB_MOD_CTRL; + if (wl->xkb.shift != XKB_MOD_INVALID && xkb_state_mod_index_is_active(wl->xkb.state, wl->xkb.shift, XKB_STATE_MODS_EFFECTIVE)) + wl->mods |= NSFB_MOD_SHIFT; +} + +static void +keyboard_repeat_info(void *data, struct wl_keyboard *keyboard, int32_t rate, int32_t delay) +{ + struct wlstate *wl = data; + + wl->repeat.delay = delay; + wl->repeat.interval = 1000 / rate; +} + +static struct wl_keyboard_listener keyboard_listener = { + .keymap = keyboard_keymap, + .enter = keyboard_enter, + .leave = keyboard_leave, + .key = keyboard_key, + .modifiers = keyboard_modifiers, + .repeat_info = keyboard_repeat_info, +}; + +static void +pointer_enter(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y) +{ + struct wlstate *wl = data; + nsfb_event_t *event; + + event = queue_event(wl); + if (!event) + return; + + event->type = NSFB_EVENT_MOVE_ABSOLUTE; + event->value.vector.x = wl_fixed_to_int(x); + event->value.vector.y = wl_fixed_to_int(y); +} + +static void +pointer_leave(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface) +{ + struct wlstate *wl = data; + int i; + nsfb_event_t *event; + + for (i = 0; i < 3; ++i) { + if (!(wl->buttons & (1 << i))) + continue; + event = queue_event(wl); + if (!event) + break; + event->type = NSFB_EVENT_KEY_UP; + switch (i) { + case 0: + event->value.keycode = NSFB_KEY_MOUSE_1; + break; + case 1: + event->value.keycode = NSFB_KEY_MOUSE_2; + break; + case 2: + event->value.keycode = NSFB_KEY_MOUSE_3; + break; + } + } + wl->buttons = 0; +} + +static void +pointer_motion(void *data, struct wl_pointer *pointer, uint32_t time, wl_fixed_t x, wl_fixed_t y) +{ + struct wlstate *wl = data; + nsfb_event_t *event; + + event = queue_event(wl); + if (!event) + return; + + event->type = NSFB_EVENT_MOVE_ABSOLUTE; + event->value.vector.x = wl_fixed_to_int(x); + event->value.vector.y = wl_fixed_to_int(y); +} + +static void +pointer_button(void *data, struct wl_pointer *pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state) +{ + struct wlstate *wl = data; + enum nsfb_key_code_e code; + nsfb_event_t *event; + int num; + + switch (button) { + case BTN_LEFT: + code = NSFB_KEY_MOUSE_1; + num = 0; + break; + case BTN_MIDDLE: + code = NSFB_KEY_MOUSE_2; + num = 1; + break; + case BTN_RIGHT: + code = NSFB_KEY_MOUSE_3; + num = 2; + break; + default: + return; + } + if (state == WL_POINTER_BUTTON_STATE_PRESSED) + wl->buttons |= 1 << num; + else + wl->buttons &= ~(1 << num); + + event = queue_event(wl); + if (!event) + return; + if (state == WL_POINTER_BUTTON_STATE_PRESSED) + event->type = NSFB_EVENT_KEY_DOWN; + else + event->type = NSFB_EVENT_KEY_UP; + event->value.keycode = code; +} + +static void +pointer_axis(void *data, struct wl_pointer *pointer, uint32_t time, uint32_t axis, wl_fixed_t value) +{ + struct wlstate *wl = data; + nsfb_event_t *event; + enum nsfb_key_code_e code; + int n = wl_fixed_to_int(value) / 10; + + if (axis != WL_POINTER_AXIS_VERTICAL_SCROLL) + return; + + if (n > 0) { + code = NSFB_KEY_MOUSE_5; + } else { + code = NSFB_KEY_MOUSE_4; + n = -n; + } + + for (; n; --n) { + event = queue_event(wl); + if (!event) + return; + event->type = NSFB_EVENT_KEY_DOWN; + event->value.keycode = code; + } +} + +static struct wl_pointer_listener pointer_listener = { + .enter = pointer_enter, + .leave = pointer_leave, + .motion = pointer_motion, + .button = pointer_button, + .axis = pointer_axis, +}; + +static void +seat_capabilities(void *data, struct wl_seat *seat, uint32_t capabilities) +{ + struct wlstate *wl = data; + + if (capabilities & WL_SEAT_CAPABILITY_KEYBOARD && !wl->keyboard) { + wl->keyboard = wl_seat_get_keyboard(wl->seat); + if (wl->keyboard != NULL) + wl_keyboard_add_listener(wl->keyboard, &keyboard_listener, wl); + } + if (capabilities & WL_SEAT_CAPABILITY_POINTER && !wl->pointer) { + wl->pointer = wl_seat_get_pointer(wl->seat); + if (wl->pointer != NULL) + wl_pointer_add_listener(wl->pointer, &pointer_listener, wl); + } +} + +static void +seat_name(void *data, struct wl_seat *seat, const char *name) +{ +} + +static struct wl_seat_listener seat_listener = { + .capabilities = seat_capabilities, + .name = seat_name, +}; + +static void +shell_ping(void *data, struct xdg_shell *shell, uint32_t serial) +{ + xdg_shell_pong(shell, serial); +} + +static struct xdg_shell_listener shell_listener = { + .ping = shell_ping, +}; + +static void +xdg_surface_configure(void *data, struct xdg_surface *xdg_surface, int32_t width, int32_t height, struct wl_array *states, uint32_t serial) +{ + struct wlstate *wl = data; + + if (width) + wl->nextwidth = width; + if (height) + wl->nextheight = height; + xdg_surface_ack_configure(xdg_surface, serial); +} + +static void +xdg_surface_close(void *data, struct xdg_surface *xdg_surface) +{ + struct wlstate *wl = data; + nsfb_event_t *event; + + event = queue_event(wl); + if (!event) + return; + event->type = NSFB_EVENT_CONTROL; + event->value.controlcode = NSFB_CONTROL_QUIT; +} + +static struct xdg_surface_listener xdg_surface_listener = { + .configure = xdg_surface_configure, + .close = xdg_surface_close, +}; + +static int +format_index(struct wlstate *wl, enum nsfb_format_e format) +{ + int i; + + for (i = 0; i < wl->num_formats; ++i) { + if (wl->formats[i].ns == format) + return i; + } + return -1; +} + +static struct wlimage * +create_image(struct wlstate *wl, int w, int h, uint32_t format, int bpp) +{ + struct wlimage *i; + int fd; + + i = calloc(1, sizeof(*i)); + if (i == NULL) + goto err0; + i->width = w; + i->height = h; + i->stride = w * bpp; + i->size = h * i->stride; + fd = syscall(SYS_memfd_create, "nsfb", 0); + if (fd < 0) + goto err1; + if (posix_fallocate(fd, 0, i->size) < 0) + goto err2; + i->data = mmap(NULL, i->size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); + if (i->data == MAP_FAILED) + goto err2; + i->pool = wl_shm_create_pool(wl->shm, fd, i->size); + if (i->pool == NULL) + goto err3; + i->buffer = wl_shm_pool_create_buffer(i->pool, 0, w, h, i->stride, format); + if (i->buffer == NULL) + goto err4; + + close(fd); + return i; + +err4: + wl_shm_pool_destroy(i->pool); +err3: + munmap(i->data, i->size); +err2: + close(fd); +err1: + free(i); +err0: + return NULL; +} + +static void +destroy_image(struct wlimage *i) +{ + wl_buffer_destroy(i->buffer); + wl_shm_pool_destroy(i->pool); + munmap(i->data, i->size); + free(i); +} + +static int +wayland_geometry(nsfb_t *nsfb, int width, int height, enum nsfb_format_e nsformat) +{ + struct wlstate *wl = nsfb->surface_priv; + uint32_t wlformat; + int i; + + if (!wl) + return 0; + + if (width) + nsfb->width = width; + if (height) + nsfb->height = height; + if (nsformat != NSFB_FMT_ANY) + nsfb->format = nsformat; + + select_plotters(nsfb); + + for (i = 0; i < wl->num_formats; ++i) { + if (wl->formats[i].ns == nsfb->format) { + wlformat = wl->formats[i].wl; + break; + } + } + if (i == wl->num_formats) + return -1; + + if (wl->image) + destroy_image(wl->image); + wl->image = create_image(wl, width, height, wlformat, nsfb->bpp); + if (wl->image == NULL) + return -1; + nsfb->ptr = wl->image->data; + nsfb->linelen = wl->image->stride; + wl_surface_attach(wl->surface, wl->image->buffer, 0, 0); + + return 0; +} + +static int +wayland_initialise(nsfb_t *nsfb) +{ + struct wlstate *wl = nsfb->surface_priv; + + if (wl != NULL) + return -1; + + wl = calloc(1, sizeof(*wl)); + if (wl == NULL) + return -1; + wl->xkb.ctx = xkb_context_new(0); + if (!wl->xkb.ctx) + return -1; + + wl->events_end = &wl->events; + wl->nextwidth = nsfb->width; + wl->nextheight = nsfb->height; + wl->repeat.delay = 500; + wl->repeat.interval = 25; + + wl->display = wl_display_connect(NULL); + if (!wl->display) { + free(wl); + return -1; + } + + wl->registry = wl_display_get_registry(wl->display); + if (!wl->registry) { + wl_display_disconnect(wl->display); + free(wl); + return -1; + } + wl_registry_add_listener(wl->registry, ®istry_listener, wl); + + wl_display_roundtrip(wl->display); + + if (!wl->compositor || !wl->seat || !wl->shm || !wl->shell) { + fprintf(stderr, "display is missing required globals\n"); + wl_display_disconnect(wl->display); + free(wl); + return -1; + } + + wl_seat_add_listener(wl->seat, &seat_listener, wl); + wl_shm_add_listener(wl->shm, &shm_listener, wl); + xdg_shell_use_unstable_version(wl->shell, XDG_SHELL_VERSION_CURRENT); + xdg_shell_add_listener(wl->shell, &shell_listener, NULL); + + wl->surface = wl_compositor_create_surface(wl->compositor); + if (!wl->surface) + return -1; + + wl->xdg_surface = xdg_shell_get_xdg_surface(wl->shell, wl->surface); + if (!wl->xdg_surface) + return -1; + xdg_surface_add_listener(wl->xdg_surface, &xdg_surface_listener, wl); + wl_display_roundtrip(wl->display); + + nsfb->surface_priv = wl; + if (wayland_geometry(nsfb, wl->nextwidth, wl->nextheight, nsfb->format) < 0) + return -1; + + return 0; +} + +static int +wayland_finalise(nsfb_t *nsfb) +{ + struct wlstate *wl = nsfb->surface_priv; + struct wlevent *event; + + if (wl == NULL) + return 0; + + xdg_surface_destroy(wl->xdg_surface); + xdg_shell_destroy(wl->shell); + wl_surface_destroy(wl->surface); + if (wl->keyboard) { + if (wl_keyboard_get_version(wl->keyboard) >= WL_KEYBOARD_RELEASE_SINCE_VERSION) + wl_keyboard_release(wl->keyboard); + else + wl_keyboard_destroy(wl->keyboard); + } + if (wl->pointer) { + if (wl_pointer_get_version(wl->pointer) >= WL_POINTER_RELEASE_SINCE_VERSION) + wl_pointer_release(wl->pointer); + else + wl_pointer_destroy(wl->pointer); + } + wl_seat_destroy(wl->seat); + wl_shm_destroy(wl->shm); + wl_compositor_destroy(wl->compositor); + wl_registry_destroy(wl->registry); + + xkb_state_unref(wl->xkb.state); + xkb_keymap_unref(wl->xkb.map); + xkb_context_unref(wl->xkb.ctx); + + while (wl->events) { + event = wl->events; + wl->events = event->next; + free(event); + } + free(wl->formats); + free(wl); + + return 0; +} + +static bool +wayland_input(nsfb_t *nsfb, nsfb_event_t *event, int timeout) +{ + nsfb_event_t *resize; + struct wlstate *wl = nsfb->surface_priv; + struct pollfd fd; + int ret, now, delay, left; + bool dorepeat = false; + + if (wl == NULL) + return false; + + wl_display_dispatch_pending(wl->display); + wl_display_flush(wl->display); + + if (wl->events != NULL) + goto nextevent; + + if (wl->repeat.sym != XKB_KEY_NoSymbol) { + now = clocknow(); + if (now >= 0) { + delay = wl->repeat.started ? wl->repeat.interval : wl->repeat.delay; + left = delay - (now - wl->repeat.last); + if (left <= 0) + goto keyrepeat; + if (left <= timeout) { + timeout = left; + dorepeat = true; + } + } + } + + if (timeout >= 0) { + fd.fd = wl_display_get_fd(wl->display); + fd.events = POLLIN; + ret = poll(&fd, 1, timeout); + if (ret == 0) { + if (dorepeat) { +keyrepeat: + wl->repeat.last = now; + wl->repeat.started = true; + event->type = NSFB_EVENT_XKB_KEY_DOWN; + event->value.xkb.sym = wl->repeat.sym; + } else { + event->type = NSFB_EVENT_CONTROL; + event->value.controlcode = NSFB_CONTROL_TIMEOUT; + } + return true; + } + } + + if (wl_display_dispatch(wl->display) == -1) { + event->type = NSFB_EVENT_CONTROL; + event->value.controlcode = NSFB_CONTROL_QUIT; + return true; + } + + if (wl->nextwidth != nsfb->width || wl->nextheight != nsfb->height) { + resize = queue_event(wl); + if (resize) { + resize->type = NSFB_EVENT_RESIZE; + resize->value.resize.w = wl->nextwidth; + resize->value.resize.h = wl->nextheight; + } + } + + if (wl->events == NULL) + return false; + +nextevent: + *event = wl->events->event; + if (wl->events_end == &wl->events->next) + wl->events_end = &wl->events; + wl->events = wl->events->next; + + return true; +} + +static int +wayland_update(nsfb_t *nsfb, nsfb_bbox_t *box) +{ + struct wlstate *wl = nsfb->surface_priv; + + if (!wl) + return 0; + + wl_surface_damage(wl->surface, box->x0, box->y0, box->x1 - box->x0, box->y1 - box->y0); + wl_surface_commit(wl->surface); + return 0; +} + +const nsfb_surface_rtns_t wayland_rtns = { + .initialise = wayland_initialise, + .finalise = wayland_finalise, + .input = wayland_input, + .update = wayland_update, + .geometry = wayland_geometry, +}; + +NSFB_SURFACE_DEF(wayland, NSFB_SURFACE_WL, &wayland_rtns) diff --git a/pkg/netsurf/libnsgif/gen.rc b/pkg/netsurf/libnsgif/gen.rc new file mode 100644 index 00000000..472553a1 --- /dev/null +++ b/pkg/netsurf/libnsgif/gen.rc @@ -0,0 +1,2 @@ +lib libnsgif.a src/libnsgif.c +fetch git diff --git a/pkg/netsurf/libnsgif/rev b/pkg/netsurf/libnsgif/rev new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/pkg/netsurf/libnsgif/rev @@ -0,0 +1 @@ +1 diff --git a/pkg/netsurf/libnsgif/src b/pkg/netsurf/libnsgif/src new file mode 160000 +Subproject 944ea7acb8c8e894b84f4c9545cd93339c23c35 diff --git a/pkg/netsurf/libnsutils/gen.rc b/pkg/netsurf/libnsutils/gen.rc new file mode 100644 index 00000000..44f05f65 --- /dev/null +++ b/pkg/netsurf/libnsutils/gen.rc @@ -0,0 +1,2 @@ +lib libnsutils.a src/^(base64.c time.c unistd.c) +fetch git diff --git a/pkg/netsurf/libnsutils/rev b/pkg/netsurf/libnsutils/rev new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/pkg/netsurf/libnsutils/rev @@ -0,0 +1 @@ +1 diff --git a/pkg/netsurf/libnsutils/src b/pkg/netsurf/libnsutils/src new file mode 160000 +Subproject 00f66c004fc24e381151937d15f58ee30cabce7 diff --git a/pkg/netsurf/libparserutils/aliases.awk b/pkg/netsurf/libparserutils/aliases.awk new file mode 100644 index 00000000..911bcd06 --- /dev/null +++ b/pkg/netsurf/libparserutils/aliases.awk @@ -0,0 +1,46 @@ +BEGIN { + print "static parserutils_charset_aliases_canon canonical_charset_names[] = {" + n = 0 +} + +/^(#|$)/ {next} + +function addalias(s) { + s = tolower(s) + gsub("[^a-z0-9]", "", s) + if (!(s in aliases)) + ++num_aliases + aliases[s] = n +} + + +{ + print "\t{ "$2", "length($1)", \""$1"\" }," + addalias($1) + for (i = 3; i <= NF; ++i) + addalias($i) + if ($1 ~ /^ISO-10646-UCS-[24]$/ || $1 ~ /^UTF-(8$|16|32)/) + isunicode = (isunicode ? (isunicode" || ") : "") "((x) == "$2")" + ++n +} +END { + print "};" + + print "static const uint16_t charset_aliases_canon_count = "n";" + + print "typedef struct {" + print "\tuint16_t name_len;" + print "\tconst char *name;" + print "\tparserutils_charset_aliases_canon *canon;" + print "} parserutils_charset_aliases_alias;" + + print "static parserutils_charset_aliases_alias charset_aliases[] = {" + for (alias in aliases) { + i = aliases[alias] + print "\t{ "length(alias)", \""alias"\", &canonical_charset_names["i"] }," | "sort -t '\"' -k 2" + } + close("sort -t '\"' -k 2") + print "};" + print "static const uint16_t charset_aliases_count = "num_aliases";" + print "#define MIBENUM_IS_UNICODE(x) ("isunicode")" +} diff --git a/pkg/netsurf/libparserutils/gen.rc b/pkg/netsurf/libparserutils/gen.rc new file mode 100644 index 00000000..0bd628ae --- /dev/null +++ b/pkg/netsurf/libparserutils/gen.rc @@ -0,0 +1,18 @@ +cflags\ + -I '$srcdir'/include\ + -I '$srcdir'/src + +build '$outdir'/aliases.inc awk '$srcdir'/build/Aliases '|' '$dir'/aliases.awk ; with\ + expr '-f $dir/aliases.awk' + +cc src/charset/aliases.c '||' '$outdir'/aliases.inc ; with cflags '$cflags -I $outdir' +lib libparserutils.a src/^(\ + charset/^(\ + aliases.c.o codec.c\ + encodings/^(utf8.c utf16.c)\ + )\ + input/^(filter.c inputstream.c)\ + utils/^(buffer.c errors.c stack.c vector.c)\ +) + +fetch git diff --git a/pkg/netsurf/libparserutils/rev b/pkg/netsurf/libparserutils/rev new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/pkg/netsurf/libparserutils/rev @@ -0,0 +1 @@ +1 diff --git a/pkg/netsurf/libparserutils/src b/pkg/netsurf/libparserutils/src new file mode 160000 +Subproject a191c155f6d137cae222c19185123b0d4e898e5 diff --git a/pkg/netsurf/libutf8proc/gen.rc b/pkg/netsurf/libutf8proc/gen.rc new file mode 100644 index 00000000..12b83488 --- /dev/null +++ b/pkg/netsurf/libutf8proc/gen.rc @@ -0,0 +1,3 @@ +cflags -I '$srcdir'/include/libutf8proc +lib libutf8proc.a src/utf8proc.c +fetch git diff --git a/pkg/netsurf/libutf8proc/rev b/pkg/netsurf/libutf8proc/rev new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/pkg/netsurf/libutf8proc/rev @@ -0,0 +1 @@ +1 diff --git a/pkg/netsurf/libutf8proc/src b/pkg/netsurf/libutf8proc/src new file mode 160000 +Subproject 81ce69227bae528ac5f4ec78f3e78f511bf6cb6 diff --git a/pkg/netsurf/libwapcaplet/gen.rc b/pkg/netsurf/libwapcaplet/gen.rc new file mode 100644 index 00000000..5f75a028 --- /dev/null +++ b/pkg/netsurf/libwapcaplet/gen.rc @@ -0,0 +1,2 @@ +lib libwapcaplet.a src/libwapcaplet.c +fetch git diff --git a/pkg/netsurf/libwapcaplet/rev b/pkg/netsurf/libwapcaplet/rev new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/pkg/netsurf/libwapcaplet/rev @@ -0,0 +1 @@ +1 diff --git a/pkg/netsurf/libwapcaplet/src b/pkg/netsurf/libwapcaplet/src new file mode 160000 +Subproject 6ff678247eef5f5e8b2bbc20f39c73727afb354 diff --git a/pkg/netsurf/messages.awk b/pkg/netsurf/messages.awk new file mode 100644 index 00000000..06c500f7 --- /dev/null +++ b/pkg/netsurf/messages.awk @@ -0,0 +1,11 @@ +BEGIN { +} +/^(#|$)/ {next} +{ + i = index($0, ":") + if (!i) + next + split(substr($0, 1, i - 1), key, ".") + if (lang == key[1] && (filter == "any" || key[2] == "all" || key[3] == filter)) + print key[3] substr($0, i) +} diff --git a/pkg/netsurf/nsgenbind.txt b/pkg/netsurf/nsgenbind.txt new file mode 100644 index 00000000..5dc837f3 --- /dev/null +++ b/pkg/netsurf/nsgenbind.txt @@ -0,0 +1,226 @@ +application_cache.c +attr.c +audio_track.c +audio_track_list.c +autocomplete_error_event.c +autocomplete_error_event_init.c +bar_prop.c +before_unload_event.c +binding.c +binding.h +broadcast_channel.c +canvas_gradient.c +canvas_pattern.c +canvas_proxy.c +canvas_rendering_context2d.c +canvas_rendering_context2d_settings.c +character_data.c +close_event.c +close_event_init.c +comment.c +composition_event.c +composition_event_init.c +console.c +css.c +css_grouping_rule.c +css_import_rule.c +css_margin_rule.c +css_media_rule.c +css_namespace_rule.c +css_page_rule.c +css_rule.c +css_rule_list.c +css_style_declaration.c +css_style_rule.c +css_style_sheet.c +custom_event.c +custom_event_init.c +data_transfer.c +data_transfer_item.c +data_transfer_item_list.c +dedicated_worker_global_scope.c +document.c +document_fragment.c +document_type.c +dom_element_map.c +dom_implementation.c +dom_parser.c +dom_settable_token_list.c +dom_string_map.c +dom_token_list.c +drag_event.c +drag_event_init.c +drawing_style.c +element.c +error_event.c +error_event_init.c +event.c +event_init.c +event_listener.c +event_modifier_init.c +event_source.c +event_source_init.c +event_target.c +external.c +focus_event.c +focus_event_init.c +hash_change_event.c +hash_change_event_init.c +history.c +hit_region_options.c +html_all_collection.c +html_anchor_element.c +html_applet_element.c +html_area_element.c +html_audio_element.c +html_base_element.c +html_body_element.c +html_br_element.c +html_button_element.c +html_canvas_element.c +html_collection.c +html_data_element.c +html_data_list_element.c +html_details_element.c +html_dialog_element.c +html_directory_element.c +html_div_element.c +html_dlist_element.c +html_element.c +html_embed_element.c +html_field_set_element.c +html_font_element.c +html_form_controls_collection.c +html_form_element.c +html_frame_element.c +html_frame_set_element.c +html_head_element.c +html_heading_element.c +html_hr_element.c +html_html_element.c +html_iframe_element.c +html_image_element.c +html_input_element.c +html_keygen_element.c +html_label_element.c +html_legend_element.c +html_li_element.c +html_link_element.c +html_map_element.c +html_marquee_element.c +html_media_element.c +html_menu_element.c +html_menu_item_element.c +html_meta_element.c +html_meter_element.c +html_mod_element.c +html_object_element.c +html_olist_element.c +html_opt_group_element.c +html_option_element.c +html_options_collection.c +html_output_element.c +html_paragraph_element.c +html_param_element.c +html_picture_element.c +html_pre_element.c +html_progress_element.c +html_quote_element.c +html_script_element.c +html_select_element.c +html_source_element.c +html_span_element.c +html_style_element.c +html_table_caption_element.c +html_table_cell_element.c +html_table_col_element.c +html_table_data_cell_element.c +html_table_element.c +html_table_header_cell_element.c +html_table_row_element.c +html_table_section_element.c +html_template_element.c +html_text_area_element.c +html_time_element.c +html_title_element.c +html_track_element.c +html_ulist_element.c +html_unknown_element.c +html_video_element.c +image_bitmap.c +image_data.c +keyboard_event.c +keyboard_event_init.c +location.c +media_controller.c +media_error.c +media_list.c +message_channel.c +message_event.c +message_event_init.c +message_port.c +mime_type.c +mime_type_array.c +mouse_event.c +mouse_event_init.c +mutation_event.c +mutation_observer.c +mutation_observer_init.c +mutation_record.c +named_node_map.c +navigator.c +node.c +node_filter.c +node_iterator.c +node_list.c +page_transition_event.c +page_transition_event_init.c +path2d.c +plugin.c +plugin_array.c +pop_state_event.c +pop_state_event_init.c +private.h +processing_instruction.c +prototype.h +pseudo_element.c +radio_node_list.c +range.c +related_event.c +related_event_init.c +shared_worker.c +shared_worker_global_scope.c +storage.c +storage_event.c +storage_event_init.c +style_sheet.c +style_sheet_list.c +svg_element.c +text.c +text_metrics.c +text_track.c +text_track_cue.c +text_track_cue_list.c +text_track_list.c +time_ranges.c +touch.c +track_event.c +track_event_init.c +tree_walker.c +ui_event.c +ui_event_init.c +url.c +url_search_params.c +validity_state.c +video_track.c +video_track_list.c +web_socket.c +wheel_event.c +wheel_event_init.c +window.c +worker.c +worker_global_scope.c +worker_location.c +worker_navigator.c +xml_document.c +xml_serializer.c diff --git a/pkg/netsurf/nsgenbind/gen.rc b/pkg/netsurf/nsgenbind/gen.rc new file mode 100644 index 00000000..67213927 --- /dev/null +++ b/pkg/netsurf/nsgenbind/gen.rc @@ -0,0 +1,15 @@ +cflags -I '$srcdir'/src + +for(src in nsgenbind-^(lexer parser)^.c webidl-^(lexer parser)^.c) + build '$outdir'/src/$src.o cc '$dir'/$src '||' '$outdir'/fetch.stamp + +exe nsgenbind src/^(\ + nsgenbind.c utils.c webidl-ast.c nsgenbind-ast.c ir.c\ + duk-libdom.c duk-libdom-interface.c duk-libdom-dictionary.c\ + duk-libdom-common.c duk-libdom-generated.c\ + \ + nsgenbind-lexer.c.o nsgenbind-parser.c.o\ + webidl-lexer.c.o webidl-parser.c.o\ +) + +fetch git diff --git a/pkg/netsurf/nsgenbind/nsgenbind-lexer.c b/pkg/netsurf/nsgenbind/nsgenbind-lexer.c new file mode 100644 index 00000000..0b724f58 --- /dev/null +++ b/pkg/netsurf/nsgenbind/nsgenbind-lexer.c @@ -0,0 +1,2261 @@ +#line 2 "nsgenbind-lexer.c" + +#line 4 "nsgenbind-lexer.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define yy_create_buffer nsgenbind__create_buffer +#define yy_delete_buffer nsgenbind__delete_buffer +#define yy_flex_debug nsgenbind__flex_debug +#define yy_init_buffer nsgenbind__init_buffer +#define yy_flush_buffer nsgenbind__flush_buffer +#define yy_load_buffer_state nsgenbind__load_buffer_state +#define yy_switch_to_buffer nsgenbind__switch_to_buffer +#define yyin nsgenbind_in +#define yyleng nsgenbind_leng +#define yylex nsgenbind_lex +#define yylineno nsgenbind_lineno +#define yyout nsgenbind_out +#define yyrestart nsgenbind_restart +#define yytext nsgenbind_text +#define yywrap nsgenbind_wrap +#define yyalloc nsgenbind_alloc +#define yyrealloc nsgenbind_realloc +#define yyfree nsgenbind_free + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 2 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. + */ +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE nsgenbind_restart(nsgenbind_in ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern int nsgenbind_leng; + +extern FILE *nsgenbind_in, *nsgenbind_out; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires + * access to the local variable yy_act. Since yyless() is a macro, it would break + * existing scanners that call yyless() from OUTSIDE nsgenbind_lex. + * One obvious solution it to make yy_act a global. I tried that, and saw + * a 5% performance hit in a non-nsgenbind_lineno scanner, because yy_act is + * normally declared as a register variable-- so it is not worth it. + */ + #define YY_LESS_LINENO(n) \ + do { \ + int yyl;\ + for ( yyl = n; yyl < nsgenbind_leng; ++yyl )\ + if ( nsgenbind_text[yyl] == '\n' )\ + --nsgenbind_lineno;\ + }while(0) + #define YY_LINENO_REWIND_TO(dst) \ + do {\ + const char *p;\ + for ( p = yy_cp-1; p >= (dst); --p)\ + if ( *p == '\n' )\ + --nsgenbind_lineno;\ + }while(0) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up nsgenbind_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up nsgenbind_text again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via nsgenbind_restart()), so that the user can continue scanning by + * just pointing nsgenbind_in at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when nsgenbind_text is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int nsgenbind_leng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = NULL; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow nsgenbind_wrap()'s to do buffer switches + * instead of setting up a fresh nsgenbind_in. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void nsgenbind_restart (FILE *input_file ); +void nsgenbind__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE nsgenbind__create_buffer (FILE *file,int size ); +void nsgenbind__delete_buffer (YY_BUFFER_STATE b ); +void nsgenbind__flush_buffer (YY_BUFFER_STATE b ); +void nsgenbind_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void nsgenbind_pop_buffer_state (void ); + +static void nsgenbind_ensure_buffer_stack (void ); +static void nsgenbind__load_buffer_state (void ); +static void nsgenbind__init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER nsgenbind__flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE nsgenbind__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE nsgenbind__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE nsgenbind__scan_bytes (yyconst char *bytes,int len ); + +void *nsgenbind_alloc (yy_size_t ); +void *nsgenbind_realloc (void *,yy_size_t ); +void nsgenbind_free (void * ); + +#define yy_new_buffer nsgenbind__create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + nsgenbind_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + nsgenbind__create_buffer(nsgenbind_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + nsgenbind_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + nsgenbind__create_buffer(nsgenbind_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define nsgenbind_wrap() (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP + +typedef flex_uint8_t YY_CHAR; + +FILE *nsgenbind_in = NULL, *nsgenbind_out = NULL; + +typedef int yy_state_type; + +extern int nsgenbind_lineno; + +int nsgenbind_lineno = 1; + +extern char *nsgenbind_text; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr nsgenbind_text + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yynoreturn yy_fatal_error (yyconst char* msg ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up nsgenbind_text. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + nsgenbind_leng = (int) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 41 +#define YY_END_OF_BUFFER 42 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[215] = + { 0, + 0, 0, 34, 34, 0, 0, 42, 32, 1, 2, + 1, 2, 32, 32, 32, 33, 32, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 32, 32, 32, 32, 1, 1, 32, 32, 32, 32, + 32, 34, 36, 38, 40, 39, 38, 37, 0, 29, + 27, 0, 26, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 0, 0, 34, + 35, 38, 0, 37, 38, 0, 0, 28, 28, 28, + + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 1, 2, 0, + 0, 0, 0, 0, 0, 1, 30, 28, 28, 28, + 18, 28, 28, 17, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 13, 28, 28, 28, 28, + 0, 0, 28, 9, 28, 12, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 24, 28, + 28, 28, 0, 28, 28, 20, 28, 19, 28, 28, + 28, 28, 28, 28, 21, 15, 23, 28, 28, 4, + 0, 3, 28, 28, 28, 5, 10, 28, 28, 28, + + 28, 28, 0, 7, 11, 8, 6, 16, 28, 14, + 25, 31, 22, 0 + } ; + +static yyconst YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 4, 4, 5, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 6, 1, 7, 8, 1, 9, 1, 1, 1, + 1, 10, 1, 1, 1, 1, 11, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 13, 1, 1, + 1, 1, 1, 1, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 1, 15, 1, 1, 14, 1, 16, 17, 18, 19, + + 20, 21, 22, 23, 24, 14, 14, 25, 26, 27, + 28, 29, 14, 30, 31, 32, 33, 34, 35, 14, + 36, 14, 37, 1, 38, 1, 1, 39, 40, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 1, 1, + 1, 42, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 43, 1, 1, 1, 1, 44, 45, + 1, 1, 1, 1, 1, 1, 1, 46, 47, 1, + 1, 1, 1, 1, 48, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 49, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 50, 51, 52, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst YY_CHAR yy_meta[53] = + { 0, + 1, 2, 3, 1, 4, 1, 2, 1, 5, 1, + 1, 6, 1, 6, 4, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1 + } ; + +static yyconst flex_int16_t yy_base[222] = + { 0, + 0, 51, 293, 292, 58, 60, 300, 303, 303, 303, + 303, 303, 292, 261, 287, 303, 283, 0, 271, 269, + 264, 44, 272, 264, 270, 26, 50, 253, 261, 267, + 241, 29, 36, 246, 102, 0, 260, 238, 34, 41, + 243, 0, 243, 0, 81, 303, 83, 303, 273, 303, + 303, 269, 303, 0, 251, 261, 252, 248, 258, 241, + 54, 240, 240, 71, 238, 253, 238, 238, 74, 249, + 303, 226, 222, 72, 219, 223, 0, 237, 215, 49, + 57, 220, 231, 0, 218, 214, 75, 211, 215, 0, + 303, 0, 122, 303, 124, 243, 241, 232, 219, 224, + + 224, 225, 214, 213, 224, 220, 210, 220, 206, 107, + 207, 208, 204, 216, 207, 110, 210, 303, 303, 194, + 190, 101, 187, 191, 211, 0, 303, 204, 196, 198, + 0, 194, 204, 0, 193, 194, 200, 204, 203, 190, + 197, 188, 195, 194, 195, 0, 185, 195, 188, 190, + 0, 183, 180, 0, 184, 0, 175, 177, 184, 186, + 183, 168, 177, 168, 165, 166, 176, 162, 0, 163, + 165, 166, 148, 158, 144, 0, 154, 0, 151, 130, + 128, 114, 114, 109, 0, 0, 0, 124, 123, 0, + 119, 0, 117, 110, 107, 0, 0, 105, 81, 80, + + 88, 74, 64, 0, 0, 0, 0, 0, 51, 0, + 0, 303, 0, 303, 154, 160, 166, 52, 172, 178, + 184 + } ; + +static yyconst flex_int16_t yy_def[222] = + { 0, + 214, 1, 215, 215, 216, 216, 214, 214, 214, 214, + 214, 214, 217, 214, 214, 214, 214, 218, 218, 218, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 214, 214, 214, 214, 214, 35, 214, 214, 214, 214, + 214, 219, 214, 220, 214, 214, 220, 214, 217, 214, + 214, 221, 214, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 214, 214, 214, 214, 214, 214, 35, 214, 214, 214, + 214, 214, 214, 35, 214, 214, 214, 214, 214, 219, + 214, 220, 214, 214, 220, 221, 221, 218, 218, 218, + + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 218, 218, 218, 214, 214, 214, + 214, 214, 214, 214, 214, 35, 214, 218, 218, 218, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 35, 214, 218, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 214, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 214, 218, 218, 218, 218, 218, 218, 218, 218, 218, + + 218, 218, 214, 218, 218, 218, 218, 218, 218, 218, + 218, 214, 218, 0, 214, 214, 214, 214, 214, 214, + 214 + } ; + +static yyconst flex_int16_t yy_nxt[356] = + { 0, + 8, 9, 10, 11, 12, 9, 13, 8, 14, 8, + 15, 16, 17, 18, 8, 18, 19, 20, 18, 21, + 22, 23, 18, 24, 18, 25, 18, 18, 26, 18, + 27, 28, 29, 18, 30, 18, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 31, 32, + 33, 34, 35, 63, 36, 64, 35, 54, 37, 45, + 46, 45, 46, 47, 48, 47, 48, 58, 59, 65, + 213, 72, 66, 73, 74, 75, 85, 104, 86, 87, + 88, 67, 93, 212, 93, 105, 93, 94, 95, 94, + 108, 120, 211, 121, 109, 122, 123, 115, 110, 38, + + 39, 40, 41, 77, 116, 77, 210, 77, 209, 78, + 118, 118, 118, 126, 126, 126, 208, 119, 119, 118, + 119, 119, 126, 93, 207, 93, 206, 93, 94, 95, + 94, 140, 148, 149, 205, 141, 204, 203, 142, 151, + 151, 151, 202, 201, 200, 199, 198, 197, 151, 196, + 79, 80, 81, 82, 42, 42, 42, 42, 42, 42, + 44, 44, 44, 44, 44, 44, 49, 49, 195, 194, + 49, 49, 90, 90, 90, 90, 193, 90, 92, 192, + 191, 92, 92, 92, 96, 96, 96, 96, 96, 96, + 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, + + 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, + 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, + 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, + 151, 151, 151, 150, 147, 146, 145, 144, 143, 139, + 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, + 128, 127, 97, 126, 126, 126, 126, 125, 124, 77, + 83, 118, 118, 118, 118, 117, 114, 113, 112, 111, + 107, 106, 103, 102, 101, 100, 99, 98, 97, 50, + 91, 89, 84, 83, 76, 71, 70, 69, 68, 62, + 61, 60, 57, 56, 55, 53, 52, 51, 50, 214, + + 43, 43, 7, 214, 214, 214, 214, 214, 214, 214, + 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, + 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, + 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, + 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, + 214, 214, 214, 214, 214 + } ; + +static yyconst flex_int16_t yy_chk[356] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 26, 2, 26, 2, 218, 2, 5, + 5, 6, 6, 5, 5, 6, 6, 22, 22, 27, + 209, 32, 27, 32, 33, 33, 39, 61, 39, 40, + 40, 27, 45, 203, 47, 61, 45, 45, 47, 47, + 64, 80, 202, 80, 64, 81, 81, 69, 64, 2, + + 2, 2, 2, 35, 69, 35, 201, 35, 200, 35, + 74, 74, 74, 87, 87, 87, 199, 74, 74, 74, + 87, 87, 87, 93, 198, 95, 195, 93, 93, 95, + 95, 110, 116, 116, 194, 110, 193, 191, 110, 122, + 122, 122, 189, 188, 184, 183, 182, 181, 122, 180, + 35, 35, 35, 35, 215, 215, 215, 215, 215, 215, + 216, 216, 216, 216, 216, 216, 217, 217, 179, 177, + 217, 217, 219, 219, 219, 219, 175, 219, 220, 174, + 173, 220, 220, 220, 221, 221, 221, 221, 221, 221, + 172, 171, 170, 168, 167, 166, 165, 164, 163, 162, + + 161, 160, 159, 158, 157, 155, 153, 152, 150, 149, + 148, 147, 145, 144, 143, 142, 141, 140, 139, 138, + 137, 136, 135, 133, 132, 130, 129, 128, 125, 124, + 123, 121, 120, 117, 115, 114, 113, 112, 111, 109, + 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, + 98, 97, 96, 89, 88, 86, 85, 83, 82, 79, + 78, 76, 75, 73, 72, 70, 68, 67, 66, 65, + 63, 62, 60, 59, 58, 57, 56, 55, 52, 49, + 43, 41, 38, 37, 34, 31, 30, 29, 28, 25, + 24, 23, 21, 20, 19, 17, 15, 14, 13, 7, + + 4, 3, 214, 214, 214, 214, 214, 214, 214, 214, + 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, + 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, + 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, + 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, + 214, 214, 214, 214, 214 + } ; + +/* Table of booleans, true if rule could match eol. */ +static yyconst flex_int32_t yy_rule_can_match_eol[42] = + { 0, +0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, + 0, 0, }; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int nsgenbind__flex_debug; +int nsgenbind__flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *nsgenbind_text; +#line 1 "nsgenbind-lexer.l" +#line 2 "nsgenbind-lexer.l" + +/* lexer for the binding generation config file + * + * This file is part of nsgenbind. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2012 Vincent Sanders <vince@netsurf-browser.org> + */ + +#include <stdbool.h> +#include <stdio.h> +#include <string.h> + +#include "nsgenbind-parser.h" +#include "nsgenbind-ast.h" + +#define YY_USER_ACTION \ + yylloc->first_line = yylloc->last_line = nsgenbind_lineno; \ + yylloc->first_column = yylloc->last_column + 1; \ + yylloc->last_column += nsgenbind_leng; + + +/* Ensure compatability with bison 2.6 and later */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED && defined NSGENBIND_STYPE_IS_DECLARED +#define YYSTYPE NSGENBIND_STYPE +#endif + +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED && defined NSGENBIND_LTYPE_IS_DECLARED +#define YYLTYPE NSGENBIND_LTYPE +#endif + +static struct YYLTYPE *locations = NULL; + +static struct YYLTYPE *push_location(struct YYLTYPE *head, + struct YYLTYPE *loc, + const char *filename) +{ + struct YYLTYPE *res; + res = calloc(1, sizeof(struct YYLTYPE)); + /* copy current location and line number */ + *res = *loc; + res->start_line = nsgenbind_lineno; + res->next = head; + + /* reset current location */ + loc->first_line = loc->last_line = 1; + loc->first_column = loc->last_column = 1; + loc->filename = strdup(filename); + nsgenbind_lineno = 1; + + return res; +} + +static struct YYLTYPE *pop_location(struct YYLTYPE *head, struct YYLTYPE *loc) +{ + struct YYLTYPE *res = NULL; + + if (head != NULL) { + res = head->next; + *loc = *head; + free(head); + + nsgenbind_lineno = loc->start_line; + } + return res; +} + + +/* lexer options */ +#define YY_NO_INPUT 1 +/* other Unicode “space separator” */ +/* non breaking space \u00A0 */ +/* Line separator \u2028 */ +/* paragraph separator \u2029 */ +/* used for #include directive */ + + +#line 727 "nsgenbind-lexer.c" + +#define INITIAL 0 +#define cblock 1 +#define incl 2 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int nsgenbind_lex_destroy (void ); + +int nsgenbind_get_debug (void ); + +void nsgenbind_set_debug (int debug_flag ); + +YY_EXTRA_TYPE nsgenbind_get_extra (void ); + +void nsgenbind_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *nsgenbind_get_in (void ); + +void nsgenbind_set_in (FILE * _in_str ); + +FILE *nsgenbind_get_out (void ); + +void nsgenbind_set_out (FILE * _out_str ); + + int nsgenbind_get_leng (void ); + +char *nsgenbind_get_text (void ); + +int nsgenbind_get_lineno (void ); + +void nsgenbind_set_lineno (int _line_number ); + +YYSTYPE * nsgenbind_get_lval (void ); + +void nsgenbind_set_lval (YYSTYPE * yylval_param ); + + YYLTYPE *nsgenbind_get_lloc (void ); + + void nsgenbind_set_lloc (YYLTYPE * yylloc_param ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int nsgenbind_wrap (void ); +#else +extern int nsgenbind_wrap (void ); +#endif +#endif + +#ifndef YY_NO_UNPUT + +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( nsgenbind_text, (size_t) nsgenbind_leng, 1, nsgenbind_out )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( nsgenbind_in )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( nsgenbind_in ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, nsgenbind_in)) == 0 && ferror(nsgenbind_in)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(nsgenbind_in); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int nsgenbind_lex \ + (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ); + +#define YY_DECL int nsgenbind_lex \ + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param ) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after nsgenbind_text and nsgenbind_leng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK /*LINTED*/break; +#endif + +#define YY_RULE_SETUP \ + if ( nsgenbind_leng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (nsgenbind_text[nsgenbind_leng - 1] == '\n'); \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + + YYSTYPE * yylval; + + YYLTYPE * yylloc; + + yylval = yylval_param; + + yylloc = yylloc_param; + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! nsgenbind_in ) + nsgenbind_in = stdin; + + if ( ! nsgenbind_out ) + nsgenbind_out = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + nsgenbind_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + nsgenbind__create_buffer(nsgenbind_in,YY_BUF_SIZE ); + } + + nsgenbind__load_buffer_state( ); + } + + { +#line 121 "nsgenbind-lexer.l" + + +#line 969 "nsgenbind-lexer.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of nsgenbind_text. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); +yy_match: + do + { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 215 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_current_state != 214 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + + if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) + { + int yyl; + for ( yyl = 0; yyl < nsgenbind_leng; ++yyl ) + if ( nsgenbind_text[yyl] == '\n' ) + + nsgenbind_lineno++; +; + } + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 123 "nsgenbind-lexer.l" +++yylloc->last_column;/* nothing */ + YY_BREAK +case 2: +/* rule 2 can match eol */ +YY_RULE_SETUP +#line 125 "nsgenbind-lexer.l" +if (nsgenbind_text[0] != '\r') { + /* update position counts */ + ++yylloc->last_line; + yylloc->last_column = 0; + } + YY_BREAK +/* binding terminals */ +case 3: +YY_RULE_SETUP +#line 133 "nsgenbind-lexer.l" +return TOK_BINDING; + YY_BREAK +case 4: +YY_RULE_SETUP +#line 134 "nsgenbind-lexer.l" +return TOK_WEBIDL; + YY_BREAK +case 5: +YY_RULE_SETUP +#line 135 "nsgenbind-lexer.l" +return TOK_PREFACE; + YY_BREAK +case 6: +YY_RULE_SETUP +#line 136 "nsgenbind-lexer.l" +return TOK_PROLOGUE; + YY_BREAK +case 7: +YY_RULE_SETUP +#line 137 "nsgenbind-lexer.l" +return TOK_EPILOGUE; + YY_BREAK +case 8: +YY_RULE_SETUP +#line 138 "nsgenbind-lexer.l" +return TOK_POSTFACE; + YY_BREAK +/* class member terminals */ +case 9: +YY_RULE_SETUP +#line 143 "nsgenbind-lexer.l" +return TOK_CLASS; + YY_BREAK +case 10: +YY_RULE_SETUP +#line 144 "nsgenbind-lexer.l" +return TOK_PRIVATE; + YY_BREAK +case 11: +YY_RULE_SETUP +#line 145 "nsgenbind-lexer.l" +return TOK_INTERNAL; + YY_BREAK +case 12: +YY_RULE_SETUP +#line 146 "nsgenbind-lexer.l" +return TOK_FLAGS; + YY_BREAK +case 13: +YY_RULE_SETUP +#line 147 "nsgenbind-lexer.l" +return TOK_TYPE; + YY_BREAK +case 14: +YY_RULE_SETUP +#line 148 "nsgenbind-lexer.l" +return TOK_UNSHARED; + YY_BREAK +case 15: +YY_RULE_SETUP +#line 149 "nsgenbind-lexer.l" +return TOK_SHARED; + YY_BREAK +case 16: +YY_RULE_SETUP +#line 150 "nsgenbind-lexer.l" +return TOK_PROPERTY; + YY_BREAK +/* implementation terminals */ +case 17: +YY_RULE_SETUP +#line 154 "nsgenbind-lexer.l" +return TOK_INIT; + YY_BREAK +case 18: +YY_RULE_SETUP +#line 155 "nsgenbind-lexer.l" +return TOK_FINI; + YY_BREAK +case 19: +YY_RULE_SETUP +#line 156 "nsgenbind-lexer.l" +return TOK_METHOD; + YY_BREAK +case 20: +YY_RULE_SETUP +#line 157 "nsgenbind-lexer.l" +return TOK_GETTER; + YY_BREAK +case 21: +YY_RULE_SETUP +#line 158 "nsgenbind-lexer.l" +return TOK_SETTER; + YY_BREAK +case 22: +YY_RULE_SETUP +#line 159 "nsgenbind-lexer.l" +return TOK_PROTOTYPE; + YY_BREAK +/* c type terminals */ +case 23: +YY_RULE_SETUP +#line 163 "nsgenbind-lexer.l" +return TOK_STRUCT; + YY_BREAK +case 24: +YY_RULE_SETUP +#line 164 "nsgenbind-lexer.l" +return TOK_UNION; + YY_BREAK +case 25: +YY_RULE_SETUP +#line 165 "nsgenbind-lexer.l" +return TOK_UNSIGNED; + YY_BREAK +/* other terminals */ +case 26: +YY_RULE_SETUP +#line 169 "nsgenbind-lexer.l" +return TOK_DBLCOLON; + YY_BREAK +case 27: +YY_RULE_SETUP +#line 171 "nsgenbind-lexer.l" +BEGIN(cblock); + YY_BREAK +case 28: +YY_RULE_SETUP +#line 173 "nsgenbind-lexer.l" +{ + /* A leading "_" is used to escape an identifier from + * looking like a reserved word terminal. + */ + yylval->text = (nsgenbind_text[0] == '_') ? strdup(nsgenbind_text + 1) : strdup(nsgenbind_text); + return TOK_IDENTIFIER; + } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 181 "nsgenbind-lexer.l" +yylval->text = strndup(nsgenbind_text + 1, nsgenbind_leng - 2 ); return TOK_STRING_LITERAL; + YY_BREAK +case 30: +/* rule 30 can match eol */ +YY_RULE_SETUP +#line 183 "nsgenbind-lexer.l" +/* nothing */ + YY_BREAK +case 31: +YY_RULE_SETUP +#line 185 "nsgenbind-lexer.l" +BEGIN(incl); + YY_BREAK +case 32: +YY_RULE_SETUP +#line 187 "nsgenbind-lexer.l" +return (int) nsgenbind_text[0]; + YY_BREAK +case 33: +YY_RULE_SETUP +#line 189 "nsgenbind-lexer.l" +/* nothing */ + YY_BREAK +case 34: +/* rule 34 can match eol */ +YY_RULE_SETUP +#line 191 "nsgenbind-lexer.l" +yylval->text = strdup(nsgenbind_text); return TOK_CCODE_LITERAL; + YY_BREAK +case 35: +YY_RULE_SETUP +#line 192 "nsgenbind-lexer.l" +BEGIN(INITIAL); + YY_BREAK +case 36: +YY_RULE_SETUP +#line 193 "nsgenbind-lexer.l" +yylval->text = strdup(nsgenbind_text); return TOK_CCODE_LITERAL; + YY_BREAK +case 37: +YY_RULE_SETUP +#line 196 "nsgenbind-lexer.l" +/* eat the whitespace and open quotes */ + YY_BREAK +case 38: +YY_RULE_SETUP +#line 198 "nsgenbind-lexer.l" +{ + /* got the include file name */ + nsgenbind_in = genbindopen(nsgenbind_text); + + if (! nsgenbind_in) { + fprintf(stderr, "Unable to open include %s\n", nsgenbind_text); + exit(3); + } + + locations = push_location(locations, yylloc, nsgenbind_text); + + nsgenbind_push_buffer_state(nsgenbind__create_buffer(nsgenbind_in,YY_BUF_SIZE)); + BEGIN(INITIAL); + } + YY_BREAK +case 39: +/* rule 39 can match eol */ +YY_RULE_SETUP +#line 213 "nsgenbind-lexer.l" +BEGIN(INITIAL); + YY_BREAK +case 40: +YY_RULE_SETUP +#line 215 "nsgenbind-lexer.l" +/* nothing */ + YY_BREAK +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(cblock): +case YY_STATE_EOF(incl): +#line 217 "nsgenbind-lexer.l" +{ + nsgenbind_pop_buffer_state(); + + if ( !YY_CURRENT_BUFFER ) { + yyterminate(); + } else { + locations = pop_location(locations, yylloc); + BEGIN(incl); + } + + } + YY_BREAK +case 41: +YY_RULE_SETUP +#line 229 "nsgenbind-lexer.l" +YY_FATAL_ERROR( "flex scanner jammed" ); + YY_BREAK +#line 1286 "nsgenbind-lexer.c" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed nsgenbind_in at a new source and called + * nsgenbind_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = nsgenbind_in; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( nsgenbind_wrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * nsgenbind_text, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of nsgenbind_lex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + nsgenbind_realloc((void *) b->yy_ch_buf,(yy_size_t) (b->yy_buf_size + 2) ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = NULL; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + nsgenbind_restart(nsgenbind_in ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) nsgenbind_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,(yy_size_t) new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + yy_state_type yy_current_state; + char *yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 215 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); + + YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 215 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 214); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + nsgenbind_restart(nsgenbind_in ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( nsgenbind_wrap( ) ) + return 0; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve nsgenbind_text */ + (yy_hold_char) = *++(yy_c_buf_p); + + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + if ( YY_CURRENT_BUFFER_LVALUE->yy_at_bol ) + + nsgenbind_lineno++; +; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void nsgenbind_restart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + nsgenbind_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + nsgenbind__create_buffer(nsgenbind_in,YY_BUF_SIZE ); + } + + nsgenbind__init_buffer(YY_CURRENT_BUFFER,input_file ); + nsgenbind__load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void nsgenbind__switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * nsgenbind_pop_buffer_state(); + * nsgenbind_push_buffer_state(new_buffer); + */ + nsgenbind_ensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + nsgenbind__load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (nsgenbind_wrap()) processing, but the only time this flag + * is looked at is after nsgenbind_wrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void nsgenbind__load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + nsgenbind_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE nsgenbind__create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) nsgenbind_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in nsgenbind__create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) nsgenbind_alloc((yy_size_t) (b->yy_buf_size + 2) ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in nsgenbind__create_buffer()" ); + + b->yy_is_our_buffer = 1; + + nsgenbind__init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with nsgenbind__create_buffer() + * + */ + void nsgenbind__delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + nsgenbind_free((void *) b->yy_ch_buf ); + + nsgenbind_free((void *) b ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a nsgenbind_restart() or at EOF. + */ + static void nsgenbind__init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + nsgenbind__flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then nsgenbind__init_buffer was _probably_ + * called from nsgenbind_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void nsgenbind__flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + nsgenbind__load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void nsgenbind_push_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + nsgenbind_ensure_buffer_stack(); + + /* This block is copied from nsgenbind__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from nsgenbind__switch_to_buffer. */ + nsgenbind__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void nsgenbind_pop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + nsgenbind__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + nsgenbind__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void nsgenbind_ensure_buffer_stack (void) +{ + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)nsgenbind_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in nsgenbind_ensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)nsgenbind_realloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in nsgenbind_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE nsgenbind__scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return NULL; + + b = (YY_BUFFER_STATE) nsgenbind_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in nsgenbind__scan_buffer()" ); + + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = NULL; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + nsgenbind__switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to nsgenbind_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * nsgenbind__scan_bytes() instead. + */ +YY_BUFFER_STATE nsgenbind__scan_string (yyconst char * yystr ) +{ + + return nsgenbind__scan_bytes(yystr,(int) strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to nsgenbind_lex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE nsgenbind__scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) nsgenbind_alloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in nsgenbind__scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = nsgenbind__scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in nsgenbind__scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yynoreturn yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up nsgenbind_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + nsgenbind_text[nsgenbind_leng] = (yy_hold_char); \ + (yy_c_buf_p) = nsgenbind_text + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + nsgenbind_leng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int nsgenbind_get_lineno (void) +{ + + return nsgenbind_lineno; +} + +/** Get the input stream. + * + */ +FILE *nsgenbind_get_in (void) +{ + return nsgenbind_in; +} + +/** Get the output stream. + * + */ +FILE *nsgenbind_get_out (void) +{ + return nsgenbind_out; +} + +/** Get the length of the current token. + * + */ +int nsgenbind_get_leng (void) +{ + return nsgenbind_leng; +} + +/** Get the current token. + * + */ + +char *nsgenbind_get_text (void) +{ + return nsgenbind_text; +} + +/** Set the current line number. + * @param _line_number line number + * + */ +void nsgenbind_set_lineno (int _line_number ) +{ + + nsgenbind_lineno = _line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param _in_str A readable stream. + * + * @see nsgenbind__switch_to_buffer + */ +void nsgenbind_set_in (FILE * _in_str ) +{ + nsgenbind_in = _in_str ; +} + +void nsgenbind_set_out (FILE * _out_str ) +{ + nsgenbind_out = _out_str ; +} + +int nsgenbind_get_debug (void) +{ + return nsgenbind__flex_debug; +} + +void nsgenbind_set_debug (int _bdebug ) +{ + nsgenbind__flex_debug = _bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from nsgenbind_lex_destroy(), so don't allocate here. + */ + + /* We do not touch nsgenbind_lineno unless the option is enabled. */ + nsgenbind_lineno = 1; + + (yy_buffer_stack) = NULL; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = NULL; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + nsgenbind_in = stdin; + nsgenbind_out = stdout; +#else + nsgenbind_in = NULL; + nsgenbind_out = NULL; +#endif + + /* For future reference: Set errno on error, since we are called by + * nsgenbind_lex_init() + */ + return 0; +} + +/* nsgenbind_lex_destroy is for both reentrant and non-reentrant scanners. */ +int nsgenbind_lex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + nsgenbind__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + nsgenbind_pop_buffer_state(); + } + + /* Destroy the stack itself. */ + nsgenbind_free((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * nsgenbind_lex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *nsgenbind_alloc (yy_size_t size ) +{ + return malloc(size); +} + +void *nsgenbind_realloc (void * ptr, yy_size_t size ) +{ + + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return realloc(ptr, size); +} + +void nsgenbind_free (void * ptr ) +{ + free( (char *) ptr ); /* see nsgenbind_realloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 229 "nsgenbind-lexer.l" + + + diff --git a/pkg/netsurf/nsgenbind/nsgenbind-lexer.h b/pkg/netsurf/nsgenbind/nsgenbind-lexer.h new file mode 100644 index 00000000..997babd3 --- /dev/null +++ b/pkg/netsurf/nsgenbind/nsgenbind-lexer.h @@ -0,0 +1,338 @@ +#ifndef nsgenbind_HEADER_H +#define nsgenbind_HEADER_H 1 +#define nsgenbind_IN_HEADER 1 + +#line 6 "nsgenbind-lexer.h" + +#line 8 "nsgenbind-lexer.h" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 2 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern int nsgenbind_leng; + +extern FILE *nsgenbind_in, *nsgenbind_out; + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +void nsgenbind_restart (FILE *input_file ); +void nsgenbind__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE nsgenbind__create_buffer (FILE *file,int size ); +void nsgenbind__delete_buffer (YY_BUFFER_STATE b ); +void nsgenbind__flush_buffer (YY_BUFFER_STATE b ); +void nsgenbind_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void nsgenbind_pop_buffer_state (void ); + +YY_BUFFER_STATE nsgenbind__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE nsgenbind__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE nsgenbind__scan_bytes (yyconst char *bytes,int len ); + +void *nsgenbind_alloc (yy_size_t ); +void *nsgenbind_realloc (void *,yy_size_t ); +void nsgenbind_free (void * ); + +/* Begin user sect3 */ + +#define nsgenbind_wrap() (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP + +extern int nsgenbind_lineno; + +extern char *nsgenbind_text; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr nsgenbind_text + +#ifdef YY_HEADER_EXPORT_START_CONDITIONS +#define INITIAL 0 +#define cblock 1 +#define incl 2 + +#endif + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int nsgenbind_lex_destroy (void ); + +int nsgenbind_get_debug (void ); + +void nsgenbind_set_debug (int debug_flag ); + +YY_EXTRA_TYPE nsgenbind_get_extra (void ); + +void nsgenbind_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *nsgenbind_get_in (void ); + +void nsgenbind_set_in (FILE * _in_str ); + +FILE *nsgenbind_get_out (void ); + +void nsgenbind_set_out (FILE * _out_str ); + + int nsgenbind_get_leng (void ); + +char *nsgenbind_get_text (void ); + +int nsgenbind_get_lineno (void ); + +void nsgenbind_set_lineno (int _line_number ); + +YYSTYPE * nsgenbind_get_lval (void ); + +void nsgenbind_set_lval (YYSTYPE * yylval_param ); + + YYLTYPE *nsgenbind_get_lloc (void ); + + void nsgenbind_set_lloc (YYLTYPE * yylloc_param ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int nsgenbind_wrap (void ); +#else +extern int nsgenbind_wrap (void ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int nsgenbind_lex \ + (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ); + +#define YY_DECL int nsgenbind_lex \ + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param ) +#endif /* !YY_DECL */ + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL +#endif + +#line 229 "nsgenbind-lexer.l" + + +#line 337 "nsgenbind-lexer.h" +#undef nsgenbind_IN_HEADER +#endif /* nsgenbind_HEADER_H */ diff --git a/pkg/netsurf/nsgenbind/nsgenbind-parser.c b/pkg/netsurf/nsgenbind/nsgenbind-parser.c new file mode 100644 index 00000000..9cfbb918 --- /dev/null +++ b/pkg/netsurf/nsgenbind/nsgenbind-parser.c @@ -0,0 +1,2317 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Substitute the type names. */ +#define YYSTYPE NSGENBIND_STYPE +#define YYLTYPE NSGENBIND_LTYPE +/* Substitute the variable and function names. */ +#define yyparse nsgenbind_parse +#define yylex nsgenbind_lex +#define yyerror nsgenbind_error +#define yydebug nsgenbind_debug +#define yynerrs nsgenbind_nerrs + + +/* Copy the first part of user declarations. */ + +#line 75 "nsgenbind-parser.c" /* yacc.c:339 */ + +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 1 +#endif + +/* In a future release of Bison, this section will be replaced + by #include "nsgenbind-parser.h". */ +#ifndef YY_NSGENBIND_NSGENBIND_PARSER_H_INCLUDED +# define YY_NSGENBIND_NSGENBIND_PARSER_H_INCLUDED +/* Debug traces. */ +#ifndef NSGENBIND_DEBUG +# if defined YYDEBUG +#if YYDEBUG +# define NSGENBIND_DEBUG 1 +# else +# define NSGENBIND_DEBUG 0 +# endif +# else /* ! defined YYDEBUG */ +# define NSGENBIND_DEBUG 1 +# endif /* ! defined YYDEBUG */ +#endif /* ! defined NSGENBIND_DEBUG */ +#if NSGENBIND_DEBUG +extern int nsgenbind_debug; +#endif +/* "%code requires" blocks. */ +#line 21 "nsgenbind-parser.y" /* yacc.c:355 */ + + +#define YYLTYPE YYLTYPE +typedef struct YYLTYPE { + struct YYLTYPE *next; + int start_line; + char *filename; + + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; + + +#define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + (Current).filename = YYRHSLOC (Rhs, 1).filename; \ + (Current).start_line = YYRHSLOC (Rhs, 1).start_line; \ + } else { /* empty RHS */ \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + (Current).filename = YYRHSLOC (Rhs, 0).filename; \ + (Current).start_line = YYRHSLOC (Rhs, 0).start_line; \ + } \ + while (0) + + +#line 149 "nsgenbind-parser.c" /* yacc.c:355 */ + +/* Token type. */ +#ifndef NSGENBIND_TOKENTYPE +# define NSGENBIND_TOKENTYPE + enum nsgenbind_tokentype + { + TOK_BINDING = 258, + TOK_WEBIDL = 259, + TOK_PREFACE = 260, + TOK_PROLOGUE = 261, + TOK_EPILOGUE = 262, + TOK_POSTFACE = 263, + TOK_CLASS = 264, + TOK_PRIVATE = 265, + TOK_INTERNAL = 266, + TOK_FLAGS = 267, + TOK_TYPE = 268, + TOK_UNSHARED = 269, + TOK_SHARED = 270, + TOK_PROPERTY = 271, + TOK_INIT = 272, + TOK_FINI = 273, + TOK_METHOD = 274, + TOK_GETTER = 275, + TOK_SETTER = 276, + TOK_PROTOTYPE = 277, + TOK_DBLCOLON = 278, + TOK_STRUCT = 279, + TOK_UNION = 280, + TOK_UNSIGNED = 281, + TOK_IDENTIFIER = 282, + TOK_STRING_LITERAL = 283, + TOK_CCODE_LITERAL = 284 + }; +#endif + +/* Value type. */ +#if ! defined NSGENBIND_STYPE && ! defined NSGENBIND_STYPE_IS_DECLARED + +union NSGENBIND_STYPE +{ +#line 180 "nsgenbind-parser.y" /* yacc.c:355 */ + + char *text; + struct genbind_node *node; + long value; + +#line 197 "nsgenbind-parser.c" /* yacc.c:355 */ +}; + +typedef union NSGENBIND_STYPE NSGENBIND_STYPE; +# define NSGENBIND_STYPE_IS_TRIVIAL 1 +# define NSGENBIND_STYPE_IS_DECLARED 1 +#endif + +/* Location type. */ +#if ! defined NSGENBIND_LTYPE && ! defined NSGENBIND_LTYPE_IS_DECLARED +typedef struct NSGENBIND_LTYPE NSGENBIND_LTYPE; +struct NSGENBIND_LTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +}; +# define NSGENBIND_LTYPE_IS_DECLARED 1 +# define NSGENBIND_LTYPE_IS_TRIVIAL 1 +#endif + + + +int nsgenbind_parse (char *filename, struct genbind_node **genbind_ast); + +#endif /* !YY_NSGENBIND_NSGENBIND_PARSER_H_INCLUDED */ + +/* Copy the second part of user declarations. */ + +#line 227 "nsgenbind-parser.c" /* yacc.c:358 */ +/* Unqualified %code blocks. */ +#line 63 "nsgenbind-parser.y" /* yacc.c:359 */ + +/* parser for the binding generation config file + * + * This file is part of nsgenbind. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2012 Vincent Sanders <vince@netsurf-browser.org> + */ + +#include <stdio.h> +#include <string.h> + +#define YYFPRINTF genbind_fprintf +#define YY_LOCATION_PRINT(File, Loc) \ + genbind_fprintf(File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) + +#include "utils.h" +#include "nsgenbind-lexer.h" +#include "webidl-ast.h" +#include "nsgenbind-ast.h" + +char *errtxt; + +static void nsgenbind_error(YYLTYPE *locp, + char *filename, + struct genbind_node **genbind_ast, + const char *str) +{ + int errlen; + + UNUSED(genbind_ast); + UNUSED(filename); + + errlen = snprintf(NULL, 0, "%s:%d:%s", + locp->filename, locp->first_line, str); + errtxt = malloc(errlen + 1); + snprintf(errtxt, errlen + 1, "%s:%d:%s", + locp->filename, locp->first_line, str); + +} + +static struct genbind_node * +add_method(struct genbind_node **genbind_ast, + long methodtype, + struct genbind_node *declarator, + char *cdata, + long lineno, + char *filename) +{ + struct genbind_node *res_node; + struct genbind_node *method_node; + struct genbind_node *class_node; + struct genbind_node *cdata_node; + struct genbind_node *location_node; + char *class_name; + + /* extract the class name from the declarator */ + class_name = genbind_node_gettext( + genbind_node_find_type( + genbind_node_getnode( + genbind_node_find_type( + declarator, + NULL, + GENBIND_NODE_TYPE_CLASS)), + NULL, + GENBIND_NODE_TYPE_IDENT)); + + if (cdata == NULL) { + cdata_node = declarator; + } else { + cdata_node = genbind_new_node(GENBIND_NODE_TYPE_CDATA, + declarator, + cdata); + } + + location_node = genbind_new_node(GENBIND_NODE_TYPE_FILE, + genbind_new_node(GENBIND_NODE_TYPE_LINE, + cdata_node, + (void *)lineno), + strdup(filename)); + + /* generate method node */ + method_node = genbind_new_node(GENBIND_NODE_TYPE_METHOD, + NULL, + genbind_new_node(GENBIND_NODE_TYPE_METHOD_TYPE, + location_node, + (void *)methodtype)); + + class_node = genbind_node_find_type_ident(*genbind_ast, + NULL, + GENBIND_NODE_TYPE_CLASS, + class_name); + if (class_node == NULL) { + /* no existing class so manufacture one and attach method */ + res_node = genbind_new_node(GENBIND_NODE_TYPE_CLASS, NULL, + genbind_new_node(GENBIND_NODE_TYPE_IDENT, + method_node, + class_name)); + } else { + /* update the existing class */ + + /* link member node into class_node */ + genbind_node_add(class_node, method_node); + + res_node = NULL; /* updating so no need to add a new node */ + } + return res_node; +} + + +#line 342 "nsgenbind-parser.c" /* yacc.c:359 */ + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined NSGENBIND_LTYPE_IS_TRIVIAL && NSGENBIND_LTYPE_IS_TRIVIAL \ + && defined NSGENBIND_STYPE_IS_TRIVIAL && NSGENBIND_STYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 25 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 134 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 37 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 24 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 61 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 104 + +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 284 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 35, 36, 33, 2, 34, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 30, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 31, 2, 32, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29 +}; + +#if NSGENBIND_DEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 251, 251, 258, 260, 265, 274, 276, 278, 282, + 292, 294, 301, 303, 317, 327, 336, 345, 354, 361, + 363, 370, 375, 384, 386, 394, 399, 410, 415, 422, + 427, 432, 437, 442, 447, 452, 456, 461, 466, 471, + 478, 483, 488, 496, 507, 518, 527, 538, 547, 551, + 558, 563, 568, 578, 583, 596, 601, 609, 613, 620, + 625, 630 +}; +#endif + +#if NSGENBIND_DEBUG || YYERROR_VERBOSE || 1 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "TOK_BINDING", "TOK_WEBIDL", + "TOK_PREFACE", "TOK_PROLOGUE", "TOK_EPILOGUE", "TOK_POSTFACE", + "TOK_CLASS", "TOK_PRIVATE", "TOK_INTERNAL", "TOK_FLAGS", "TOK_TYPE", + "TOK_UNSHARED", "TOK_SHARED", "TOK_PROPERTY", "TOK_INIT", "TOK_FINI", + "TOK_METHOD", "TOK_GETTER", "TOK_SETTER", "TOK_PROTOTYPE", + "TOK_DBLCOLON", "TOK_STRUCT", "TOK_UNION", "TOK_UNSIGNED", + "TOK_IDENTIFIER", "TOK_STRING_LITERAL", "TOK_CCODE_LITERAL", "';'", + "'{'", "'}'", "'*'", "','", "'('", "')'", "$accept", "Input", + "Statements", "Statement", "Binding", "BindingArgs", "BindingArg", + "WebIDL", "CTypeSpecifier", "CType", "CTypeIdent", "CBlock", + "ParameterList", "Method", "MethodType", "BindingAndMethodType", + "MethodName", "MethodDeclarator", "Class", "ClassArgs", "ClassArg", + "ClassFlags", "Modifiers", "Modifier", YY_NULLPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 59, 123, 125, 42, 44, 40, 41 +}; +# endif + +#define YYPACT_NINF -42 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-42))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int8 yypact[] = +{ + 6, -20, 13, -42, -42, -42, -42, 51, -42, -42, + -42, -42, -42, -42, 91, 26, -42, -42, -42, 65, + -42, -42, -42, 62, 64, -42, -42, -15, 37, 76, + 63, 38, 28, -42, -42, 67, 66, -2, -42, -42, + 68, 61, 61, 71, -42, 68, 69, 63, -42, -42, + -42, 70, 72, 73, 75, -42, -42, 74, 77, -42, + -17, -42, 78, 79, -42, 47, 80, 81, -42, -12, + 23, 60, 82, -42, 36, -42, -42, -42, -42, 83, + 61, -42, -42, -42, -42, -42, -42, -42, 86, -42, + -42, -42, 84, -42, -42, -42, -42, 22, 88, -42, + -42, -42, -42, -42 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 0, 0, 0, 36, 37, 38, 39, 0, 29, 30, + 31, 32, 33, 34, 0, 2, 3, 6, 8, 0, + 35, 7, 5, 0, 0, 1, 4, 0, 0, 0, + 48, 0, 0, 23, 28, 27, 0, 0, 10, 12, + 0, 0, 0, 0, 57, 0, 0, 48, 42, 41, + 40, 0, 0, 0, 0, 18, 46, 19, 0, 25, + 0, 24, 0, 0, 11, 0, 0, 0, 55, 0, + 0, 0, 0, 49, 0, 16, 17, 15, 20, 21, + 0, 45, 14, 9, 13, 50, 51, 53, 0, 59, + 60, 61, 0, 58, 54, 47, 44, 0, 0, 26, + 56, 52, 43, 22 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -42, -42, -42, 101, -42, -42, 85, -42, -42, -42, + -41, -24, 29, -42, -42, 12, -42, -42, -42, 87, + -42, -42, -42, -42 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 14, 15, 16, 17, 37, 38, 39, 57, 58, + 59, 35, 60, 18, 19, 20, 51, 28, 21, 46, + 47, 69, 70, 93 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_uint8 yytable[] = +{ + 66, 67, 36, 3, 4, 5, 6, 1, 31, 2, + 22, 3, 4, 5, 6, 7, 65, 80, 87, 81, + 32, 71, 88, 8, 9, 10, 11, 12, 13, 2, + 63, 3, 4, 5, 6, 7, 89, 90, 91, 99, + 23, 40, 45, 8, 9, 10, 11, 12, 13, 40, + 92, 48, 52, 53, 54, 55, 80, 49, 102, 45, + 52, 53, 54, 55, 56, 50, 33, 34, 3, 4, + 5, 6, 96, 41, 42, 43, 61, 84, 24, 44, + 36, 3, 4, 5, 6, 52, 53, 54, 55, 61, + 94, 25, 27, 29, 62, 30, 61, 33, 68, 75, + 76, 72, 77, 97, 79, 74, 98, 78, 82, 83, + 85, 86, 95, 100, 101, 103, 26, 0, 0, 0, + 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 73 +}; + +static const yytype_int8 yycheck[] = +{ + 41, 42, 4, 5, 6, 7, 8, 1, 23, 3, + 30, 5, 6, 7, 8, 9, 40, 34, 30, 36, + 35, 45, 34, 17, 18, 19, 20, 21, 22, 3, + 32, 5, 6, 7, 8, 9, 13, 14, 15, 80, + 27, 29, 30, 17, 18, 19, 20, 21, 22, 37, + 27, 13, 24, 25, 26, 27, 34, 19, 36, 47, + 24, 25, 26, 27, 36, 27, 29, 30, 5, 6, + 7, 8, 36, 10, 11, 12, 29, 30, 27, 16, + 4, 5, 6, 7, 8, 24, 25, 26, 27, 29, + 30, 0, 27, 31, 28, 31, 29, 29, 27, 27, + 27, 32, 27, 74, 27, 35, 23, 33, 30, 30, + 30, 30, 30, 27, 30, 27, 15, -1, -1, -1, + -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 47 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 1, 3, 5, 6, 7, 8, 9, 17, 18, + 19, 20, 21, 22, 38, 39, 40, 41, 50, 51, + 52, 55, 30, 27, 27, 0, 40, 27, 54, 31, + 31, 23, 35, 29, 30, 48, 4, 42, 43, 44, + 52, 10, 11, 12, 16, 52, 56, 57, 13, 19, + 27, 53, 24, 25, 26, 27, 36, 45, 46, 47, + 49, 29, 28, 32, 43, 48, 47, 47, 27, 58, + 59, 48, 32, 56, 35, 27, 27, 27, 33, 27, + 34, 36, 30, 30, 30, 30, 30, 30, 34, 13, + 14, 15, 27, 60, 30, 30, 36, 49, 23, 47, + 27, 30, 36, 27 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 37, 38, 39, 39, 39, 40, 40, 40, 41, + 42, 42, 43, 43, 44, 45, 45, 45, 45, 46, + 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, + 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, + 53, 53, 53, 54, 54, 54, 54, 55, 56, 56, + 57, 57, 57, 57, 57, 58, 58, 59, 59, 60, + 60, 60 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 2, 2, 1, 1, 1, 6, + 1, 2, 1, 3, 3, 2, 2, 2, 1, 1, + 2, 2, 4, 1, 2, 1, 3, 3, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 6, 5, 4, 3, 6, 0, 2, + 3, 3, 4, 3, 3, 1, 3, 0, 2, 1, + 1, 1 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (&yylloc, filename, genbind_ast, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) +#endif + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) + + +/* Enable debugging if requested. */ +#if NSGENBIND_DEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if defined NSGENBIND_LTYPE_IS_TRIVIAL && NSGENBIND_LTYPE_IS_TRIVIAL + +/* Print *YYLOCP on YYO. Private, do not rely on its existence. */ + +YY_ATTRIBUTE_UNUSED +static unsigned +yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) +{ + unsigned res = 0; + int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; + if (0 <= yylocp->first_line) + { + res += YYFPRINTF (yyo, "%d", yylocp->first_line); + if (0 <= yylocp->first_column) + res += YYFPRINTF (yyo, ".%d", yylocp->first_column); + } + if (0 <= yylocp->last_line) + { + if (yylocp->first_line < yylocp->last_line) + { + res += YYFPRINTF (yyo, "-%d", yylocp->last_line); + if (0 <= end_col) + res += YYFPRINTF (yyo, ".%d", end_col); + } + else if (0 <= end_col && yylocp->first_column < end_col) + res += YYFPRINTF (yyo, "-%d", end_col); + } + return res; + } + +# define YY_LOCATION_PRINT(File, Loc) \ + yy_location_print_ (File, &(Loc)) + +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, Location, filename, genbind_ast); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, char *filename, struct genbind_node **genbind_ast) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + YYUSE (yylocationp); + YYUSE (filename); + YYUSE (genbind_ast); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, char *filename, struct genbind_node **genbind_ast) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + YY_LOCATION_PRINT (yyoutput, *yylocationp); + YYFPRINTF (yyoutput, ": "); + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, filename, genbind_ast); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, char *filename, struct genbind_node **genbind_ast) +{ + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , &(yylsp[(yyi + 1) - (yynrhs)]) , filename, genbind_ast); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, yylsp, Rule, filename, genbind_ast); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !NSGENBIND_DEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !NSGENBIND_DEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, char *filename, struct genbind_node **genbind_ast) +{ + YYUSE (yyvaluep); + YYUSE (yylocationp); + YYUSE (filename); + YYUSE (genbind_ast); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (char *filename, struct genbind_node **genbind_ast) +{ +/* The lookahead symbol. */ +int yychar; + + +/* The semantic value of the lookahead symbol. */ +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); + +/* Location data for the lookahead symbol. */ +static YYLTYPE yyloc_default +# if defined NSGENBIND_LTYPE_IS_TRIVIAL && NSGENBIND_LTYPE_IS_TRIVIAL + = { 1, 1, 1, 1 } +# endif +; +YYLTYPE yylloc = yyloc_default; + + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + 'yyls': related to locations. + + Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[3]; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + YYLTYPE yyloc; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yylsp = yyls = yylsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + +/* User initialization code. */ +#line 57 "nsgenbind-parser.y" /* yacc.c:1429 */ +{ + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 1; + yylloc.filename = filename; +} + +#line 1428 "nsgenbind-parser.c" /* yacc.c:1429 */ + yylsp[0] = yylloc; + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + YYLTYPE *yyls1 = yyls; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); + + yyls = yyls1; + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + yylsp = yyls + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (&yylval, &yylloc); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + *++yylsp = yylloc; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + /* Default location. */ + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: +#line 252 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + *genbind_ast = (yyvsp[0].node); + } +#line 1619 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 4: +#line 261 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = *genbind_ast = genbind_node_prepend((yyvsp[0].node), (yyvsp[-1].node)); + } +#line 1627 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 5: +#line 266 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + fprintf(stderr, "%s\n", errtxt); + free(errtxt); + YYABORT ; + } +#line 1637 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 9: +#line 283 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_BINDING, + NULL, + genbind_new_node(GENBIND_NODE_TYPE_NAME, + (yyvsp[-2].node), (yyvsp[-4].text))); + } +#line 1648 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 11: +#line 295 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_node_link((yyvsp[0].node), (yyvsp[-1].node)); + } +#line 1656 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 13: +#line 304 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_METHOD, + NULL, + genbind_new_node(GENBIND_NODE_TYPE_METHOD_TYPE, + genbind_new_node(GENBIND_NODE_TYPE_CDATA, + NULL, + (yyvsp[-1].text)), + (void *)(yyvsp[-2].value))); + } +#line 1670 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 14: +#line 318 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_WEBIDL, NULL, (yyvsp[-1].text)); + } +#line 1678 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 15: +#line 328 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_NAME, + genbind_new_node(GENBIND_NODE_TYPE_NAME, + NULL, + strdup("unsigned")), + (yyvsp[0].text)); + } +#line 1690 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 16: +#line 337 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_NAME, + genbind_new_node(GENBIND_NODE_TYPE_NAME, + NULL, + strdup("struct")), + (yyvsp[0].text)); + } +#line 1702 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 17: +#line 346 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_NAME, + genbind_new_node(GENBIND_NODE_TYPE_NAME, + NULL, + strdup("union")), + (yyvsp[0].text)); + } +#line 1714 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 18: +#line 355 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_NAME, NULL, (yyvsp[0].text)); + } +#line 1722 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 20: +#line 364 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_NAME, (yyvsp[-1].node), strdup("*")); + } +#line 1730 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 21: +#line 371 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_IDENT, (yyvsp[-1].node), (yyvsp[0].text)); + } +#line 1738 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 22: +#line 376 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_IDENT, + genbind_new_node(GENBIND_NODE_TYPE_IDENT, (yyvsp[-3].node), (yyvsp[-2].text)), (yyvsp[0].text)); + } +#line 1747 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 24: +#line 387 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = genbind_strapp((yyvsp[-1].text), (yyvsp[0].text)); + } +#line 1755 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 25: +#line 395 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_PARAMETER, NULL, (yyvsp[0].node)); + } +#line 1763 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 26: +#line 400 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_node_prepend((yyvsp[-2].node), + genbind_new_node( + GENBIND_NODE_TYPE_PARAMETER, + NULL, + (yyvsp[0].node))); + } +#line 1775 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 27: +#line 411 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = add_method(genbind_ast, (yyvsp[-2].value), (yyvsp[-1].node), (yyvsp[0].text), (yylsp[-2]).first_line, (yylsp[-2]).filename); + } +#line 1783 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 28: +#line 416 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = add_method(genbind_ast, (yyvsp[-2].value), (yyvsp[-1].node), NULL, (yylsp[-2]).first_line, (yylsp[-2]).filename); + } +#line 1791 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 29: +#line 423 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.value) = GENBIND_METHOD_TYPE_INIT; + } +#line 1799 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 30: +#line 428 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.value) = GENBIND_METHOD_TYPE_FINI; + } +#line 1807 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 31: +#line 433 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.value) = GENBIND_METHOD_TYPE_METHOD; + } +#line 1815 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 32: +#line 438 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.value) = GENBIND_METHOD_TYPE_GETTER; + } +#line 1823 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 33: +#line 443 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.value) = GENBIND_METHOD_TYPE_SETTER; + } +#line 1831 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 34: +#line 448 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.value) = GENBIND_METHOD_TYPE_PROTOTYPE; + } +#line 1839 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 36: +#line 457 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.value) = GENBIND_METHOD_TYPE_PREFACE; + } +#line 1847 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 37: +#line 462 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.value) = GENBIND_METHOD_TYPE_PROLOGUE; + } +#line 1855 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 38: +#line 467 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.value) = GENBIND_METHOD_TYPE_EPILOGUE; + } +#line 1863 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 39: +#line 472 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.value) = GENBIND_METHOD_TYPE_POSTFACE; + } +#line 1871 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 40: +#line 479 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = (yyvsp[0].text); + } +#line 1879 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 41: +#line 484 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("method"); + } +#line 1887 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 42: +#line 489 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("type"); + } +#line 1895 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 43: +#line 497 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_CLASS, + genbind_new_node(GENBIND_NODE_TYPE_IDENT, + (yyvsp[-1].node), + (yyvsp[-3].text)), + genbind_new_node(GENBIND_NODE_TYPE_IDENT, + NULL, + (yyvsp[-5].text))); + } +#line 1909 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 44: +#line 508 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_CLASS, + genbind_new_node(GENBIND_NODE_TYPE_IDENT, + NULL, + (yyvsp[-2].text)), + genbind_new_node(GENBIND_NODE_TYPE_IDENT, + NULL, + (yyvsp[-4].text))); + } +#line 1923 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 45: +#line 519 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_CLASS, + (yyvsp[-1].node), + genbind_new_node(GENBIND_NODE_TYPE_IDENT, + NULL, + (yyvsp[-3].text))); + } +#line 1935 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 46: +#line 528 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_CLASS, NULL, + genbind_new_node(GENBIND_NODE_TYPE_IDENT, + NULL, + (yyvsp[-2].text))); + } +#line 1946 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 47: +#line 539 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_CLASS, NULL, + genbind_new_node(GENBIND_NODE_TYPE_IDENT, (yyvsp[-2].node), (yyvsp[-4].text))); + } +#line 1955 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 48: +#line 547 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 1963 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 49: +#line 552 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_node_prepend((yyvsp[0].node), (yyvsp[-1].node)); + } +#line 1971 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 50: +#line 559 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_PRIVATE, NULL, (yyvsp[-1].node)); + } +#line 1979 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 51: +#line 564 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_INTERNAL, NULL, (yyvsp[-1].node)); + } +#line 1987 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 52: +#line 569 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_PROPERTY, NULL, + genbind_new_node(GENBIND_NODE_TYPE_MODIFIER, + genbind_new_node(GENBIND_NODE_TYPE_IDENT, + NULL, + (yyvsp[-1].text)), + (void *)(yyvsp[-2].value))); + } +#line 2000 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 53: +#line 579 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_FLAGS, NULL, (yyvsp[-1].node)); + } +#line 2008 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 54: +#line 584 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_METHOD, + NULL, + genbind_new_node(GENBIND_NODE_TYPE_METHOD_TYPE, + genbind_new_node(GENBIND_NODE_TYPE_CDATA, + NULL, + (yyvsp[-1].text)), + (void *)(yyvsp[-2].value))); + } +#line 2022 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 55: +#line 597 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_IDENT, NULL, (yyvsp[0].text)); + } +#line 2030 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 56: +#line 602 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = genbind_new_node(GENBIND_NODE_TYPE_IDENT, (yyvsp[-2].node), (yyvsp[0].text)); + } +#line 2038 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 57: +#line 609 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.value) = GENBIND_TYPE_NONE; + } +#line 2046 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 58: +#line 614 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.value) |= (yyvsp[0].value); + } +#line 2054 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 59: +#line 621 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.value) = GENBIND_TYPE_TYPE; + } +#line 2062 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 60: +#line 626 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.value) = GENBIND_TYPE_UNSHARED; + } +#line 2070 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + case 61: +#line 631 "nsgenbind-parser.y" /* yacc.c:1646 */ + { + (yyval.value) = GENBIND_TYPE_NONE; + } +#line 2078 "nsgenbind-parser.c" /* yacc.c:1646 */ + break; + + +#line 2082 "nsgenbind-parser.c" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + *++yylsp = yyloc; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (&yylloc, filename, genbind_ast, YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (&yylloc, filename, genbind_ast, yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + yyerror_range[1] = yylloc; + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, &yylloc, filename, genbind_ast); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + yyerror_range[1] = yylsp[1-yylen]; + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + yyerror_range[1] = *yylsp; + yydestruct ("Error: popping", + yystos[yystate], yyvsp, yylsp, filename, genbind_ast); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + yyerror_range[2] = yylloc; + /* Using YYLLOC is tempting, but would change the location of + the lookahead. YYLOC is available though. */ + YYLLOC_DEFAULT (yyloc, yyerror_range, 2); + *++yylsp = yyloc; + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (&yylloc, filename, genbind_ast, YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, &yylloc, filename, genbind_ast); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, yylsp, filename, genbind_ast); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} +#line 636 "nsgenbind-parser.y" /* yacc.c:1906 */ + diff --git a/pkg/netsurf/nsgenbind/nsgenbind-parser.h b/pkg/netsurf/nsgenbind/nsgenbind-parser.h new file mode 100644 index 00000000..928718f7 --- /dev/null +++ b/pkg/netsurf/nsgenbind/nsgenbind-parser.h @@ -0,0 +1,161 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison interface for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +#ifndef YY_NSGENBIND_NSGENBIND_PARSER_H_INCLUDED +# define YY_NSGENBIND_NSGENBIND_PARSER_H_INCLUDED +/* Debug traces. */ +#ifndef NSGENBIND_DEBUG +# if defined YYDEBUG +#if YYDEBUG +# define NSGENBIND_DEBUG 1 +# else +# define NSGENBIND_DEBUG 0 +# endif +# else /* ! defined YYDEBUG */ +# define NSGENBIND_DEBUG 1 +# endif /* ! defined YYDEBUG */ +#endif /* ! defined NSGENBIND_DEBUG */ +#if NSGENBIND_DEBUG +extern int nsgenbind_debug; +#endif +/* "%code requires" blocks. */ +#line 21 "nsgenbind-parser.y" /* yacc.c:1909 */ + + +#define YYLTYPE YYLTYPE +typedef struct YYLTYPE { + struct YYLTYPE *next; + int start_line; + char *filename; + + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; + + +#define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + (Current).filename = YYRHSLOC (Rhs, 1).filename; \ + (Current).start_line = YYRHSLOC (Rhs, 1).start_line; \ + } else { /* empty RHS */ \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + (Current).filename = YYRHSLOC (Rhs, 0).filename; \ + (Current).start_line = YYRHSLOC (Rhs, 0).start_line; \ + } \ + while (0) + + +#line 88 "nsgenbind-parser.h" /* yacc.c:1909 */ + +/* Token type. */ +#ifndef NSGENBIND_TOKENTYPE +# define NSGENBIND_TOKENTYPE + enum nsgenbind_tokentype + { + TOK_BINDING = 258, + TOK_WEBIDL = 259, + TOK_PREFACE = 260, + TOK_PROLOGUE = 261, + TOK_EPILOGUE = 262, + TOK_POSTFACE = 263, + TOK_CLASS = 264, + TOK_PRIVATE = 265, + TOK_INTERNAL = 266, + TOK_FLAGS = 267, + TOK_TYPE = 268, + TOK_UNSHARED = 269, + TOK_SHARED = 270, + TOK_PROPERTY = 271, + TOK_INIT = 272, + TOK_FINI = 273, + TOK_METHOD = 274, + TOK_GETTER = 275, + TOK_SETTER = 276, + TOK_PROTOTYPE = 277, + TOK_DBLCOLON = 278, + TOK_STRUCT = 279, + TOK_UNION = 280, + TOK_UNSIGNED = 281, + TOK_IDENTIFIER = 282, + TOK_STRING_LITERAL = 283, + TOK_CCODE_LITERAL = 284 + }; +#endif + +/* Value type. */ +#if ! defined NSGENBIND_STYPE && ! defined NSGENBIND_STYPE_IS_DECLARED + +union NSGENBIND_STYPE +{ +#line 180 "nsgenbind-parser.y" /* yacc.c:1909 */ + + char *text; + struct genbind_node *node; + long value; + +#line 136 "nsgenbind-parser.h" /* yacc.c:1909 */ +}; + +typedef union NSGENBIND_STYPE NSGENBIND_STYPE; +# define NSGENBIND_STYPE_IS_TRIVIAL 1 +# define NSGENBIND_STYPE_IS_DECLARED 1 +#endif + +/* Location type. */ +#if ! defined NSGENBIND_LTYPE && ! defined NSGENBIND_LTYPE_IS_DECLARED +typedef struct NSGENBIND_LTYPE NSGENBIND_LTYPE; +struct NSGENBIND_LTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +}; +# define NSGENBIND_LTYPE_IS_DECLARED 1 +# define NSGENBIND_LTYPE_IS_TRIVIAL 1 +#endif + + + +int nsgenbind_parse (char *filename, struct genbind_node **genbind_ast); + +#endif /* !YY_NSGENBIND_NSGENBIND_PARSER_H_INCLUDED */ diff --git a/pkg/netsurf/nsgenbind/patch/0001-Use-relative-include-paths.patch b/pkg/netsurf/nsgenbind/patch/0001-Use-relative-include-paths.patch new file mode 100644 index 00000000..db7579c2 --- /dev/null +++ b/pkg/netsurf/nsgenbind/patch/0001-Use-relative-include-paths.patch @@ -0,0 +1,37 @@ +From bf6cb0cd861dd2cbfa6a2e4754b6dd278b89b1d9 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Fri, 23 Dec 2016 15:24:36 -0800 +Subject: [PATCH] Use relative include paths + +--- + src/duk-libdom-common.c | 14 +++----------- + 1 file changed, 3 insertions(+), 11 deletions(-) + +diff --git a/src/duk-libdom-common.c b/src/duk-libdom-common.c +index 6111070..ff225b0 100644 +--- a/src/duk-libdom-common.c ++++ b/src/duk-libdom-common.c +@@ -85,17 +85,9 @@ int output_tool_prologue(FILE* outf) + { + char *fpath; + +- fpath = genb_fpath("binding.h"); +- fprintf(outf, "\n#include \"%s\"\n", fpath); +- free(fpath); +- +- fpath = genb_fpath("private.h"); +- fprintf(outf, "#include \"%s\"\n", fpath); +- free(fpath); +- +- fpath = genb_fpath("prototype.h"); +- fprintf(outf, "#include \"%s\"\n", fpath); +- free(fpath); ++ fputs("\n#include \"binding.h\"\n", outf); ++ fputs("#include \"private.h\"\n", outf); ++ fputs("#include \"prototype.h\"\n", outf); + + return 0; + } +-- +2.11.0 + diff --git a/pkg/netsurf/nsgenbind/rev b/pkg/netsurf/nsgenbind/rev new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/pkg/netsurf/nsgenbind/rev @@ -0,0 +1 @@ +1 diff --git a/pkg/netsurf/nsgenbind/src b/pkg/netsurf/nsgenbind/src new file mode 160000 +Subproject ab1f1cb380783ce4e9c87632daad2cf08ca22da diff --git a/pkg/netsurf/nsgenbind/webidl-lexer.c b/pkg/netsurf/nsgenbind/webidl-lexer.c new file mode 100644 index 00000000..89e8bf2e --- /dev/null +++ b/pkg/netsurf/nsgenbind/webidl-lexer.c @@ -0,0 +1,2527 @@ +#line 2 "webidl-lexer.c" + +#line 4 "webidl-lexer.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define yy_create_buffer webidl__create_buffer +#define yy_delete_buffer webidl__delete_buffer +#define yy_flex_debug webidl__flex_debug +#define yy_init_buffer webidl__init_buffer +#define yy_flush_buffer webidl__flush_buffer +#define yy_load_buffer_state webidl__load_buffer_state +#define yy_switch_to_buffer webidl__switch_to_buffer +#define yyin webidl_in +#define yyleng webidl_leng +#define yylex webidl_lex +#define yylineno webidl_lineno +#define yyout webidl_out +#define yyrestart webidl_restart +#define yytext webidl_text +#define yywrap webidl_wrap +#define yyalloc webidl_alloc +#define yyrealloc webidl_realloc +#define yyfree webidl_free + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 2 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. + */ +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE webidl_restart(webidl_in ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern int webidl_leng; + +extern FILE *webidl_in, *webidl_out; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires + * access to the local variable yy_act. Since yyless() is a macro, it would break + * existing scanners that call yyless() from OUTSIDE webidl_lex. + * One obvious solution it to make yy_act a global. I tried that, and saw + * a 5% performance hit in a non-webidl_lineno scanner, because yy_act is + * normally declared as a register variable-- so it is not worth it. + */ + #define YY_LESS_LINENO(n) \ + do { \ + int yyl;\ + for ( yyl = n; yyl < webidl_leng; ++yyl )\ + if ( webidl_text[yyl] == '\n' )\ + --webidl_lineno;\ + }while(0) + #define YY_LINENO_REWIND_TO(dst) \ + do {\ + const char *p;\ + for ( p = yy_cp-1; p >= (dst); --p)\ + if ( *p == '\n' )\ + --webidl_lineno;\ + }while(0) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up webidl_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up webidl_text again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via webidl_restart()), so that the user can continue scanning by + * just pointing webidl_in at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when webidl_text is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int webidl_leng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = NULL; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow webidl_wrap()'s to do buffer switches + * instead of setting up a fresh webidl_in. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void webidl_restart (FILE *input_file ); +void webidl__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE webidl__create_buffer (FILE *file,int size ); +void webidl__delete_buffer (YY_BUFFER_STATE b ); +void webidl__flush_buffer (YY_BUFFER_STATE b ); +void webidl_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void webidl_pop_buffer_state (void ); + +static void webidl_ensure_buffer_stack (void ); +static void webidl__load_buffer_state (void ); +static void webidl__init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER webidl__flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE webidl__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE webidl__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE webidl__scan_bytes (yyconst char *bytes,int len ); + +void *webidl_alloc (yy_size_t ); +void *webidl_realloc (void *,yy_size_t ); +void webidl_free (void * ); + +#define yy_new_buffer webidl__create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + webidl_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + webidl__create_buffer(webidl_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + webidl_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + webidl__create_buffer(webidl_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define webidl_wrap() (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP + +typedef flex_uint8_t YY_CHAR; + +FILE *webidl_in = NULL, *webidl_out = NULL; + +typedef int yy_state_type; + +extern int webidl_lineno; + +int webidl_lineno = 1; + +extern char *webidl_text; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr webidl_text + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yynoreturn yy_fatal_error (yyconst char* msg ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up webidl_text. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + webidl_leng = (int) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 64 +#define YY_END_OF_BUFFER 65 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[407] = + { 0, + 0, 0, 0, 0, 65, 60, 1, 2, 1, 60, + 60, 60, 60, 52, 52, 51, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 51, 51, 51, 60, 60, + 60, 60, 1, 1, 60, 60, 60, 60, 60, 62, + 64, 63, 62, 61, 0, 56, 0, 52, 0, 55, + 0, 58, 55, 53, 0, 0, 52, 51, 51, 51, + 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 51, 51, 51, 37, 51, + + 51, 51, 51, 51, 51, 51, 51, 51, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 62, 0, 61, + 62, 0, 0, 0, 25, 0, 0, 0, 55, 0, + 0, 55, 54, 51, 51, 51, 51, 29, 51, 51, + 30, 51, 51, 51, 51, 51, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 51, 51, 51, 1, 2, + 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, + + 55, 57, 0, 55, 51, 51, 26, 51, 51, 51, + 51, 51, 4, 51, 51, 51, 51, 51, 51, 12, + 51, 51, 51, 51, 51, 51, 51, 51, 51, 34, + 35, 51, 51, 51, 51, 51, 51, 51, 51, 51, + 51, 51, 41, 51, 51, 51, 43, 0, 0, 0, + 51, 51, 51, 51, 51, 51, 51, 51, 8, 51, + 51, 51, 51, 51, 32, 33, 51, 51, 51, 51, + 51, 51, 51, 5, 51, 51, 51, 51, 51, 51, + 40, 51, 51, 51, 51, 51, 0, 0, 51, 51, + 51, 51, 51, 51, 51, 51, 51, 51, 51, 31, + + 51, 14, 51, 51, 51, 51, 51, 36, 51, 51, + 51, 51, 51, 20, 21, 51, 51, 51, 51, 0, + 51, 51, 51, 51, 45, 51, 3, 51, 9, 10, + 51, 51, 51, 16, 51, 51, 51, 51, 51, 19, + 51, 51, 51, 51, 23, 51, 51, 0, 51, 51, + 28, 51, 51, 7, 51, 51, 51, 51, 46, 51, + 51, 38, 44, 48, 39, 51, 51, 42, 59, 51, + 27, 51, 6, 51, 13, 51, 17, 51, 51, 51, + 51, 51, 51, 11, 15, 51, 51, 51, 51, 49, + 51, 51, 51, 22, 51, 51, 18, 51, 24, 51, + + 51, 51, 47, 51, 50, 0 + } ; + +static yyconst YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 4, 4, 5, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 6, 1, 7, 8, 1, 1, 1, 9, 1, + 1, 10, 11, 1, 11, 12, 13, 14, 15, 15, + 15, 15, 15, 15, 15, 15, 16, 1, 1, 1, + 1, 1, 1, 1, 17, 17, 18, 19, 20, 17, + 21, 21, 22, 21, 21, 21, 23, 24, 25, 26, + 21, 21, 27, 21, 21, 21, 21, 28, 21, 21, + 1, 29, 1, 1, 21, 1, 30, 31, 32, 33, + + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 21, 52, + 53, 21, 1, 1, 1, 1, 1, 54, 55, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 1, 1, + 1, 57, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 58, 1, 1, 1, 1, 59, 60, + 1, 1, 1, 1, 1, 1, 1, 61, 62, 1, + 1, 1, 1, 1, 63, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 64, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 65, 66, 67, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst YY_CHAR yy_meta[68] = + { 0, + 1, 2, 3, 1, 4, 1, 2, 1, 1, 1, + 1, 1, 1, 5, 5, 5, 5, 5, 5, 5, + 6, 6, 6, 6, 6, 6, 6, 6, 1, 5, + 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int16_t yy_base[413] = + { 0, + 0, 66, 73, 75, 659, 660, 660, 660, 660, 62, + 68, 73, 80, 82, 89, 0, 614, 70, 614, 626, + 608, 43, 54, 78, 77, 74, 83, 620, 86, 93, + 603, 107, 622, 617, 106, 59, 607, 605, 588, 13, + 64, 593, 140, 145, 608, 585, 98, 105, 590, 0, + 155, 660, 161, 660, 107, 660, 127, 158, 631, 166, + 632, 660, 169, 150, 179, 0, 201, 0, 598, 617, + 590, 603, 145, 593, 583, 586, 590, 584, 591, 588, + 596, 588, 596, 577, 576, 593, 583, 579, 573, 576, + 139, 586, 583, 575, 576, 577, 566, 565, 0, 566, + + 120, 150, 568, 161, 561, 565, 150, 571, 660, 554, + 550, 164, 547, 551, 226, 566, 543, 164, 147, 548, + 558, 234, 546, 542, 189, 539, 543, 0, 247, 660, + 253, 232, 295, 317, 660, 251, 586, 582, 254, 261, + 232, 242, 0, 546, 566, 558, 553, 0, 556, 547, + 0, 541, 546, 552, 544, 536, 553, 548, 532, 549, + 537, 544, 529, 546, 526, 533, 539, 538, 524, 540, + 533, 527, 533, 532, 527, 515, 530, 512, 511, 511, + 512, 509, 519, 522, 521, 520, 515, 519, 660, 660, + 497, 493, 224, 490, 494, 515, 314, 368, 390, 267, + + 270, 660, 280, 289, 497, 496, 0, 501, 510, 504, + 503, 506, 0, 508, 489, 488, 487, 497, 493, 0, + 488, 498, 482, 496, 495, 481, 480, 496, 493, 0, + 0, 492, 474, 478, 483, 476, 481, 484, 483, 467, + 477, 471, 0, 480, 464, 475, 0, 351, 469, 412, + 462, 461, 469, 488, 457, 473, 473, 472, 0, 457, + 466, 455, 464, 448, 0, 0, 449, 453, 456, 458, + 461, 438, 441, 0, 446, 458, 444, 439, 442, 437, + 0, 451, 446, 447, 431, 436, 428, 0, 427, 438, + 426, 430, 430, 413, 414, 424, 394, 393, 396, 0, + + 400, 0, 403, 387, 405, 393, 191, 0, 403, 378, + 373, 379, 380, 0, 0, 373, 362, 349, 361, 361, + 361, 349, 338, 347, 0, 340, 0, 337, 0, 0, + 346, 331, 331, 0, 341, 338, 341, 321, 328, 0, + 315, 334, 332, 330, 0, 326, 330, 328, 312, 324, + 0, 310, 322, 0, 307, 303, 296, 310, 0, 302, + 308, 0, 0, 0, 0, 303, 308, 0, 660, 295, + 0, 289, 0, 270, 0, 273, 0, 278, 270, 274, + 258, 259, 250, 0, 0, 255, 243, 224, 230, 0, + 213, 194, 206, 0, 200, 199, 0, 173, 0, 126, + + 137, 101, 0, 73, 0, 660, 447, 453, 455, 461, + 467, 94 + } ; + +static yyconst flex_int16_t yy_def[413] = + { 0, + 406, 1, 407, 407, 406, 406, 406, 406, 406, 408, + 406, 406, 406, 406, 406, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 410, + 406, 406, 410, 406, 408, 406, 408, 406, 406, 406, + 411, 406, 406, 406, 406, 412, 406, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + + 409, 409, 409, 409, 409, 409, 409, 409, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 410, 406, 406, + 410, 408, 408, 133, 406, 406, 411, 411, 406, 406, + 406, 406, 412, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 133, 133, 406, + + 406, 406, 406, 406, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 406, 406, 133, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 406, 199, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 406, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 406, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 406, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, + + 409, 409, 409, 409, 409, 0, 406, 406, 406, 406, + 406, 406 + } ; + +static yyconst flex_int16_t yy_nxt[728] = + { 0, + 6, 7, 8, 9, 8, 7, 10, 6, 6, 6, + 11, 12, 13, 14, 15, 15, 16, 17, 18, 16, + 16, 19, 16, 20, 16, 21, 16, 16, 6, 22, + 23, 24, 25, 26, 27, 28, 16, 29, 16, 16, + 30, 16, 31, 32, 33, 16, 34, 35, 36, 37, + 38, 16, 16, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 39, 40, 41, 42, 43, 56, 44, + 110, 43, 111, 45, 51, 52, 51, 52, 53, 54, + 53, 54, 58, 58, 59, 75, 60, 60, 60, 61, + 57, 76, 62, 63, 70, 64, 64, 77, 143, 71, + + 63, 65, 67, 67, 67, 105, 78, 79, 65, 66, + 82, 106, 87, 56, 83, 65, 85, 112, 113, 405, + 84, 80, 65, 88, 81, 86, 93, 90, 91, 46, + 47, 48, 49, 66, 92, 57, 94, 96, 97, 102, + 132, 115, 103, 115, 404, 115, 115, 116, 115, 177, + 115, 98, 116, 99, 104, 123, 129, 124, 125, 126, + 129, 130, 129, 64, 64, 178, 131, 130, 148, 63, + 403, 67, 67, 67, 402, 167, 133, 65, 134, 60, + 60, 60, 139, 139, 139, 136, 149, 168, 140, 141, + 182, 65, 142, 142, 142, 179, 186, 187, 180, 136, + + 193, 194, 140, 117, 118, 119, 120, 183, 117, 118, + 119, 120, 63, 401, 67, 67, 67, 189, 189, 189, + 65, 191, 337, 192, 190, 190, 189, 115, 338, 115, + 400, 115, 399, 116, 65, 115, 398, 115, 56, 115, + 397, 116, 197, 197, 197, 142, 142, 142, 129, 190, + 190, 197, 129, 130, 129, 142, 142, 142, 131, 130, + 57, 200, 396, 395, 201, 201, 201, 139, 139, 139, + 394, 203, 393, 140, 204, 204, 204, 248, 248, 248, + 201, 201, 201, 201, 201, 201, 248, 140, 392, 117, + 118, 119, 120, 204, 204, 204, 391, 117, 118, 119, + + 120, 56, 204, 204, 204, 390, 389, 388, 198, 198, + 198, 198, 198, 198, 198, 115, 387, 115, 386, 115, + 385, 116, 384, 57, 198, 198, 198, 198, 198, 198, + 199, 199, 199, 199, 199, 199, 199, 383, 382, 381, + 380, 379, 378, 377, 376, 375, 199, 199, 199, 199, + 199, 199, 115, 374, 115, 373, 115, 372, 116, 371, + 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, + 360, 359, 358, 357, 356, 355, 354, 117, 118, 119, + 120, 250, 250, 250, 250, 250, 250, 250, 353, 352, + 351, 350, 349, 348, 347, 346, 345, 250, 250, 250, + + 250, 250, 250, 132, 132, 132, 132, 132, 132, 132, + 344, 343, 342, 341, 117, 118, 119, 120, 340, 132, + 132, 132, 132, 132, 132, 288, 288, 288, 288, 288, + 288, 288, 339, 336, 335, 334, 333, 332, 331, 330, + 329, 288, 288, 288, 288, 288, 288, 50, 50, 50, + 50, 50, 50, 55, 55, 328, 327, 55, 55, 68, + 68, 128, 326, 325, 128, 128, 128, 137, 137, 137, + 137, 137, 137, 324, 323, 322, 321, 320, 319, 318, + 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, + 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, + + 297, 296, 295, 294, 293, 292, 291, 290, 289, 287, + 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, + 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, + 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, + 256, 255, 254, 253, 252, 251, 249, 248, 248, 248, + 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, + 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, + 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, + 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, + 208, 207, 206, 205, 202, 138, 197, 197, 197, 197, + + 196, 195, 115, 121, 189, 189, 189, 189, 188, 185, + 184, 181, 176, 175, 174, 173, 172, 171, 170, 169, + 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, + 156, 155, 154, 153, 152, 151, 150, 147, 146, 145, + 144, 138, 135, 127, 122, 121, 114, 109, 108, 107, + 101, 100, 95, 89, 74, 73, 72, 69, 406, 5, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406 + } ; + +static yyconst flex_int16_t yy_chk[728] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 2, 10, 2, + 40, 2, 40, 2, 3, 3, 4, 4, 3, 3, + 4, 4, 11, 11, 12, 22, 12, 12, 12, 13, + 10, 22, 13, 14, 18, 14, 14, 23, 412, 18, + + 15, 14, 15, 15, 15, 36, 23, 24, 15, 14, + 25, 36, 27, 55, 25, 14, 26, 41, 41, 404, + 25, 24, 15, 27, 24, 26, 30, 29, 29, 2, + 2, 2, 2, 14, 29, 55, 30, 32, 32, 35, + 57, 43, 35, 43, 402, 43, 44, 43, 44, 101, + 44, 32, 44, 32, 35, 47, 51, 47, 48, 48, + 51, 51, 53, 64, 64, 101, 53, 53, 73, 58, + 401, 58, 58, 58, 400, 91, 57, 58, 57, 60, + 60, 60, 63, 63, 63, 60, 73, 91, 63, 65, + 104, 58, 65, 65, 65, 102, 107, 107, 102, 60, + + 119, 119, 63, 43, 43, 43, 43, 104, 44, 44, + 44, 44, 67, 398, 67, 67, 67, 112, 112, 112, + 67, 118, 307, 118, 112, 112, 112, 115, 307, 115, + 396, 115, 395, 115, 67, 122, 393, 122, 132, 122, + 392, 122, 125, 125, 125, 141, 141, 141, 129, 125, + 125, 125, 129, 129, 131, 142, 142, 142, 131, 131, + 132, 136, 391, 389, 136, 136, 136, 139, 139, 139, + 388, 140, 387, 139, 140, 140, 140, 193, 193, 193, + 200, 200, 200, 201, 201, 201, 193, 139, 386, 115, + 115, 115, 115, 203, 203, 203, 383, 122, 122, 122, + + 122, 133, 204, 204, 204, 382, 381, 380, 133, 133, + 133, 133, 133, 133, 133, 197, 379, 197, 378, 197, + 376, 197, 374, 133, 133, 133, 133, 133, 133, 133, + 134, 134, 134, 134, 134, 134, 134, 372, 370, 367, + 366, 361, 360, 358, 357, 356, 134, 134, 134, 134, + 134, 134, 248, 355, 248, 353, 248, 352, 248, 350, + 349, 348, 347, 346, 344, 343, 342, 341, 339, 338, + 337, 336, 335, 333, 332, 331, 328, 197, 197, 197, + 197, 198, 198, 198, 198, 198, 198, 198, 326, 324, + 323, 322, 321, 320, 319, 318, 317, 198, 198, 198, + + 198, 198, 198, 199, 199, 199, 199, 199, 199, 199, + 316, 313, 312, 311, 248, 248, 248, 248, 310, 199, + 199, 199, 199, 199, 199, 250, 250, 250, 250, 250, + 250, 250, 309, 306, 305, 304, 303, 301, 299, 298, + 297, 250, 250, 250, 250, 250, 250, 407, 407, 407, + 407, 407, 407, 408, 408, 296, 295, 408, 408, 409, + 409, 410, 294, 293, 410, 410, 410, 411, 411, 411, + 411, 411, 411, 292, 291, 290, 289, 287, 286, 285, + 284, 283, 282, 280, 279, 278, 277, 276, 275, 273, + 272, 271, 270, 269, 268, 267, 264, 263, 262, 261, + + 260, 258, 257, 256, 255, 254, 253, 252, 251, 249, + 246, 245, 244, 242, 241, 240, 239, 238, 237, 236, + 235, 234, 233, 232, 229, 228, 227, 226, 225, 224, + 223, 222, 221, 219, 218, 217, 216, 215, 214, 212, + 211, 210, 209, 208, 206, 205, 196, 195, 194, 192, + 191, 188, 187, 186, 185, 184, 183, 182, 181, 180, + 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, + 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, + 159, 158, 157, 156, 155, 154, 153, 152, 150, 149, + 147, 146, 145, 144, 138, 137, 127, 126, 124, 123, + + 121, 120, 117, 116, 114, 113, 111, 110, 108, 106, + 105, 103, 100, 98, 97, 96, 95, 94, 93, 92, + 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, + 80, 79, 78, 77, 76, 75, 74, 72, 71, 70, + 69, 61, 59, 49, 46, 45, 42, 39, 38, 37, + 34, 33, 31, 28, 21, 20, 19, 17, 5, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406 + } ; + +/* Table of booleans, true if rule could match eol. */ +static yyconst flex_int32_t yy_rule_can_match_eol[65] = + { 0, +0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0, }; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int webidl__flex_debug; +int webidl__flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *webidl_text; +#line 1 "webidl-lexer.l" +#line 2 "webidl-lexer.l" + +/* This is a unicode tolerant lexer for web IDL + * + * This file is part of nsgenbind. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2012 Vincent Sanders <vince@netsurf-browser.org> + * + * Derived from: + * + * W3C WEB IDL - http://www.w3.org/TR/WebIDL/ (especially the grammar + * in apendix A) + * + * The ECMA script spec - + * http://ecma-international.org/ecma-262/5.1/#sec-7.2 (expecially + * section 7.2 for unicode value handling) + */ + +#include <stdbool.h> +#include <stdio.h> +#include <string.h> + +#include "webidl-parser.h" + +#define YY_USER_ACTION yylloc->first_line = yylloc->last_line; \ + yylloc->first_column = yylloc->last_column + 1; \ + yylloc->last_column += webidl_leng; + +/* Ensure compatability with bison 2.6 and later */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED && defined WEBIDL_STYPE_IS_DECLARED +#define YYSTYPE WEBIDL_STYPE +#endif + +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED && defined WEBIDL_LTYPE_IS_DECLARED +#define YYLTYPE WEBIDL_LTYPE +#endif + +/* lexer options */ +/* regular definitions */ +/* ecmascript section 7.2 defines whitespace http://ecma-international.org/ecma-262/5.1/#sec-7.2 +* Web IDL appendix A has the IDL grammar http://www.w3.org/TR/WebIDL/#idl-grammar +*/ +/* we do not define space, line feed, carriage return, tab, vertical +* tab or form feed here as they are the standard C escapes +*/ +/* other Unicode “space separator” */ +/* Line separator \u2028 */ +/* paragraph separator \u2029 */ +/* non breaking space \u00A0 */ +/* web idl grammar for whitespace matches single and multiline + * comments too. Here there are separate definitions for both single + * and multiline comments. + */ +/* integer numbers in hexidecimal, decimal and octal, slight extension + * to spec which only allows for decimal values + */ +/* decimal floating point number */ +/* quoted string. spec simply has "[^"]*" but here escapes are allowed for */ +/* web idl identifier direct from spec */ +/* web idl other direct from spec */ +/* used for #include directive - not part of web idl spec */ + +#line 859 "webidl-lexer.c" + +#define INITIAL 0 +#define incl 1 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int webidl_lex_destroy (void ); + +int webidl_get_debug (void ); + +void webidl_set_debug (int debug_flag ); + +YY_EXTRA_TYPE webidl_get_extra (void ); + +void webidl_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *webidl_get_in (void ); + +void webidl_set_in (FILE * _in_str ); + +FILE *webidl_get_out (void ); + +void webidl_set_out (FILE * _out_str ); + + int webidl_get_leng (void ); + +char *webidl_get_text (void ); + +int webidl_get_lineno (void ); + +void webidl_set_lineno (int _line_number ); + +YYSTYPE * webidl_get_lval (void ); + +void webidl_set_lval (YYSTYPE * yylval_param ); + + YYLTYPE *webidl_get_lloc (void ); + + void webidl_set_lloc (YYLTYPE * yylloc_param ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int webidl_wrap (void ); +#else +extern int webidl_wrap (void ); +#endif +#endif + +#ifndef YY_NO_UNPUT + +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( webidl_text, (size_t) webidl_leng, 1, webidl_out )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( webidl_in )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( webidl_in ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, webidl_in)) == 0 && ferror(webidl_in)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(webidl_in); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int webidl_lex \ + (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ); + +#define YY_DECL int webidl_lex \ + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param ) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after webidl_text and webidl_leng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK /*LINTED*/break; +#endif + +#define YY_RULE_SETUP \ + if ( webidl_leng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (webidl_text[webidl_leng - 1] == '\n'); \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + + YYSTYPE * yylval; + + YYLTYPE * yylloc; + + yylval = yylval_param; + + yylloc = yylloc_param; + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! webidl_in ) + webidl_in = stdin; + + if ( ! webidl_out ) + webidl_out = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + webidl_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + webidl__create_buffer(webidl_in,YY_BUF_SIZE ); + } + + webidl__load_buffer_state( ); + } + + { +#line 114 "webidl-lexer.l" + + +#line 1100 "webidl-lexer.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of webidl_text. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); +yy_match: + do + { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 407 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_current_state != 406 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + + if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) + { + int yyl; + for ( yyl = 0; yyl < webidl_leng; ++yyl ) + if ( webidl_text[yyl] == '\n' ) + + webidl_lineno++; +; + } + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 116 "webidl-lexer.l" +++yylloc->last_column; /* skip whitespace */ + YY_BREAK +case 2: +/* rule 2 can match eol */ +YY_RULE_SETUP +#line 118 "webidl-lexer.l" +if (webidl_text[0] != '\r') { + /* update position counts */ + ++yylloc->last_line; + yylloc->last_column = 0; + } + YY_BREAK +/* Simple text terminals */ +case 3: +YY_RULE_SETUP +#line 126 "webidl-lexer.l" +return TOK_BOOLEAN; + YY_BREAK +case 4: +YY_RULE_SETUP +#line 128 "webidl-lexer.l" +return TOK_BYTE; + YY_BREAK +case 5: +YY_RULE_SETUP +#line 130 "webidl-lexer.l" +return TOK_OCTET; + YY_BREAK +case 6: +YY_RULE_SETUP +#line 132 "webidl-lexer.l" +return TOK_ATTRIBUTE; + YY_BREAK +case 7: +YY_RULE_SETUP +#line 134 "webidl-lexer.l" +return TOK_CALLBACK; + YY_BREAK +case 8: +YY_RULE_SETUP +#line 136 "webidl-lexer.l" +return TOK_CONST; + YY_BREAK +case 9: +YY_RULE_SETUP +#line 138 "webidl-lexer.l" +return TOK_CREATOR; + YY_BREAK +case 10: +YY_RULE_SETUP +#line 140 "webidl-lexer.l" +return TOK_DELETER; + YY_BREAK +case 11: +YY_RULE_SETUP +#line 142 "webidl-lexer.l" +return TOK_DICTIONARY; + YY_BREAK +case 12: +YY_RULE_SETUP +#line 144 "webidl-lexer.l" +return TOK_ENUM; + YY_BREAK +case 13: +YY_RULE_SETUP +#line 146 "webidl-lexer.l" +return TOK_EXCEPTION; + YY_BREAK +case 14: +YY_RULE_SETUP +#line 148 "webidl-lexer.l" +return TOK_GETTER; + YY_BREAK +case 15: +YY_RULE_SETUP +#line 150 "webidl-lexer.l" +return TOK_IMPLEMENTS; + YY_BREAK +case 16: +YY_RULE_SETUP +#line 152 "webidl-lexer.l" +return TOK_INHERIT; + YY_BREAK +case 17: +YY_RULE_SETUP +#line 154 "webidl-lexer.l" +return TOK_INTERFACE; + YY_BREAK +case 18: +YY_RULE_SETUP +#line 156 "webidl-lexer.l" +return TOK_LEGACYCALLER; + YY_BREAK +case 19: +YY_RULE_SETUP +#line 158 "webidl-lexer.l" +return TOK_PARTIAL; + YY_BREAK +case 20: +YY_RULE_SETUP +#line 160 "webidl-lexer.l" +return TOK_SETTER; + YY_BREAK +case 21: +YY_RULE_SETUP +#line 162 "webidl-lexer.l" +return TOK_STATIC; + YY_BREAK +case 22: +YY_RULE_SETUP +#line 164 "webidl-lexer.l" +return TOK_STRINGIFIER; + YY_BREAK +case 23: +YY_RULE_SETUP +#line 166 "webidl-lexer.l" +return TOK_TYPEDEF; + YY_BREAK +case 24: +YY_RULE_SETUP +#line 168 "webidl-lexer.l" +return TOK_UNRESTRICTED; + YY_BREAK +case 25: +YY_RULE_SETUP +#line 170 "webidl-lexer.l" +return TOK_ELLIPSIS; + YY_BREAK +case 26: +YY_RULE_SETUP +#line 172 "webidl-lexer.l" +return TOK_DATE; + YY_BREAK +case 27: +YY_RULE_SETUP +#line 174 "webidl-lexer.l" +return TOK_STRING; /* dom strings are just strings */ + YY_BREAK +case 28: +YY_RULE_SETUP +#line 176 "webidl-lexer.l" +return TOK_INFINITY; + YY_BREAK +case 29: +YY_RULE_SETUP +#line 178 "webidl-lexer.l" +return TOK_NAN; + YY_BREAK +case 30: +YY_RULE_SETUP +#line 180 "webidl-lexer.l" +return TOK_ANY; + YY_BREAK +case 31: +YY_RULE_SETUP +#line 182 "webidl-lexer.l" +return TOK_DOUBLE; + YY_BREAK +case 32: +YY_RULE_SETUP +#line 184 "webidl-lexer.l" +return TOK_FALSE; + YY_BREAK +case 33: +YY_RULE_SETUP +#line 186 "webidl-lexer.l" +return TOK_FLOAT; + YY_BREAK +case 34: +YY_RULE_SETUP +#line 188 "webidl-lexer.l" +return TOK_LONG; + YY_BREAK +case 35: +YY_RULE_SETUP +#line 190 "webidl-lexer.l" +return TOK_NULL_LITERAL; + YY_BREAK +case 36: +YY_RULE_SETUP +#line 192 "webidl-lexer.l" +yylval->text = strdup(webidl_text); return TOK_IDENTIFIER; + YY_BREAK +case 37: +YY_RULE_SETUP +#line 194 "webidl-lexer.l" +return TOK_OR; + YY_BREAK +case 38: +YY_RULE_SETUP +#line 196 "webidl-lexer.l" +return TOK_OPTIONAL; + YY_BREAK +case 39: +YY_RULE_SETUP +#line 198 "webidl-lexer.l" +return TOK_SEQUENCE; + YY_BREAK +case 40: +YY_RULE_SETUP +#line 200 "webidl-lexer.l" +return TOK_SHORT; + YY_BREAK +case 41: +YY_RULE_SETUP +#line 202 "webidl-lexer.l" +return TOK_TRUE; + YY_BREAK +case 42: +YY_RULE_SETUP +#line 204 "webidl-lexer.l" +return TOK_UNSIGNED; + YY_BREAK +case 43: +YY_RULE_SETUP +#line 206 "webidl-lexer.l" +return TOK_VOID; + YY_BREAK +case 44: +YY_RULE_SETUP +#line 208 "webidl-lexer.l" +return TOK_READONLY; + YY_BREAK +case 45: +YY_RULE_SETUP +#line 210 "webidl-lexer.l" +return TOK_PROMISE; + YY_BREAK +case 46: +YY_RULE_SETUP +#line 212 "webidl-lexer.l" +return TOK_ITERABLE; + YY_BREAK +case 47: +YY_RULE_SETUP +#line 214 "webidl-lexer.l" +return TOK_LEGACYITERABLE; + YY_BREAK +case 48: +YY_RULE_SETUP +#line 216 "webidl-lexer.l" +return TOK_REQUIRED; + YY_BREAK +case 49: +YY_RULE_SETUP +#line 218 "webidl-lexer.l" +return TOK_CONSTRUCTOR; + YY_BREAK +case 50: +YY_RULE_SETUP +#line 220 "webidl-lexer.l" +return TOK_NAMEDCONSTRUCTOR; + YY_BREAK +case 51: +YY_RULE_SETUP +#line 222 "webidl-lexer.l" +{ + /* A leading "_" is used to escape an identifier from + * looking like a reserved word terminal. */ + yylval->text = (webidl_text[0] == '_') ? strdup(webidl_text + 1) : strdup(webidl_text); + return TOK_IDENTIFIER; + } + YY_BREAK +case 52: +YY_RULE_SETUP +#line 229 "webidl-lexer.l" +yylval->value = strtol(webidl_text, NULL, 10); return TOK_INT_LITERAL; + YY_BREAK +case 53: +YY_RULE_SETUP +#line 231 "webidl-lexer.l" +yylval->value = strtol(webidl_text, NULL, 8); return TOK_INT_LITERAL; + YY_BREAK +case 54: +YY_RULE_SETUP +#line 233 "webidl-lexer.l" +yylval->value = strtol(webidl_text, NULL, 16); return TOK_INT_LITERAL; + YY_BREAK +case 55: +YY_RULE_SETUP +#line 235 "webidl-lexer.l" +yylval->text = strdup(webidl_text); return TOK_FLOAT_LITERAL; + YY_BREAK +case 56: +YY_RULE_SETUP +#line 237 "webidl-lexer.l" +yylval->text = strdup(webidl_text + 1); *(yylval->text + webidl_leng - 2) = 0; return TOK_STRING_LITERAL; + YY_BREAK +case 57: +/* rule 57 can match eol */ +YY_RULE_SETUP +#line 239 "webidl-lexer.l" +{ + /* multicomment */ + char* s = webidl_text; + for (; *s; ++s) + { + if (*s == '\n') + { + ++yylloc->last_line; + yylloc->last_column = 0; + } + else + { + ++yylloc->last_column; + } + } + if (strncmp(webidl_text, "/**", 3) == 0) + { + /* Javadoc style comment */ + yylval->text = strdup(webidl_text); + return TOK_JAVADOC; + } + } + YY_BREAK +case 58: +YY_RULE_SETUP +#line 262 "webidl-lexer.l" +{ + /* singlecomment */ + int c; + + do { + c = input(); + } while (c != '\n' && c != '\r' && c != EOF); + ++yylloc->last_line; + yylloc->last_column = 0; + } + YY_BREAK +case 59: +YY_RULE_SETUP +#line 275 "webidl-lexer.l" +BEGIN(incl); + YY_BREAK +case 60: +YY_RULE_SETUP +#line 277 "webidl-lexer.l" +return (int) webidl_text[0]; + YY_BREAK +case 61: +YY_RULE_SETUP +#line 279 "webidl-lexer.l" +/* eat the whitespace and open quotes */ + YY_BREAK +case 62: +YY_RULE_SETUP +#line 281 "webidl-lexer.l" +{ + /* got the include file name */ + webidl_in = fopen( webidl_text, "r" ); + + if ( ! webidl_in ) { + fprintf(stderr, "Unable to open include %s\n", webidl_text); + exit(3); + } + webidl_push_buffer_state(webidl__create_buffer(webidl_in,YY_BUF_SIZE )); + + BEGIN(INITIAL); + } + YY_BREAK +case 63: +/* rule 63 can match eol */ +YY_RULE_SETUP +#line 294 "webidl-lexer.l" +BEGIN(INITIAL); + YY_BREAK +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(incl): +#line 296 "webidl-lexer.l" +{ + webidl_pop_buffer_state(); + + if ( !YY_CURRENT_BUFFER ) { + yyterminate(); + } else { + BEGIN(incl); + } + + } + YY_BREAK +case 64: +YY_RULE_SETUP +#line 308 "webidl-lexer.l" +ECHO; + YY_BREAK +#line 1552 "webidl-lexer.c" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed webidl_in at a new source and called + * webidl_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = webidl_in; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( webidl_wrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * webidl_text, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of webidl_lex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + webidl_realloc((void *) b->yy_ch_buf,(yy_size_t) (b->yy_buf_size + 2) ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = NULL; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + webidl_restart(webidl_in ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) webidl_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,(yy_size_t) new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + yy_state_type yy_current_state; + char *yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 407 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); + + YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 407 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 406); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + webidl_restart(webidl_in ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( webidl_wrap( ) ) + return 0; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve webidl_text */ + (yy_hold_char) = *++(yy_c_buf_p); + + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + if ( YY_CURRENT_BUFFER_LVALUE->yy_at_bol ) + + webidl_lineno++; +; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void webidl_restart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + webidl_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + webidl__create_buffer(webidl_in,YY_BUF_SIZE ); + } + + webidl__init_buffer(YY_CURRENT_BUFFER,input_file ); + webidl__load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void webidl__switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * webidl_pop_buffer_state(); + * webidl_push_buffer_state(new_buffer); + */ + webidl_ensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + webidl__load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (webidl_wrap()) processing, but the only time this flag + * is looked at is after webidl_wrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void webidl__load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + webidl_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE webidl__create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) webidl_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in webidl__create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) webidl_alloc((yy_size_t) (b->yy_buf_size + 2) ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in webidl__create_buffer()" ); + + b->yy_is_our_buffer = 1; + + webidl__init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with webidl__create_buffer() + * + */ + void webidl__delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + webidl_free((void *) b->yy_ch_buf ); + + webidl_free((void *) b ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a webidl_restart() or at EOF. + */ + static void webidl__init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + webidl__flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then webidl__init_buffer was _probably_ + * called from webidl_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void webidl__flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + webidl__load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void webidl_push_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + webidl_ensure_buffer_stack(); + + /* This block is copied from webidl__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from webidl__switch_to_buffer. */ + webidl__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void webidl_pop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + webidl__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + webidl__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void webidl_ensure_buffer_stack (void) +{ + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)webidl_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in webidl_ensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)webidl_realloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in webidl_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE webidl__scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return NULL; + + b = (YY_BUFFER_STATE) webidl_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in webidl__scan_buffer()" ); + + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = NULL; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + webidl__switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to webidl_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * webidl__scan_bytes() instead. + */ +YY_BUFFER_STATE webidl__scan_string (yyconst char * yystr ) +{ + + return webidl__scan_bytes(yystr,(int) strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to webidl_lex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE webidl__scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) webidl_alloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in webidl__scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = webidl__scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in webidl__scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yynoreturn yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up webidl_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + webidl_text[webidl_leng] = (yy_hold_char); \ + (yy_c_buf_p) = webidl_text + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + webidl_leng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int webidl_get_lineno (void) +{ + + return webidl_lineno; +} + +/** Get the input stream. + * + */ +FILE *webidl_get_in (void) +{ + return webidl_in; +} + +/** Get the output stream. + * + */ +FILE *webidl_get_out (void) +{ + return webidl_out; +} + +/** Get the length of the current token. + * + */ +int webidl_get_leng (void) +{ + return webidl_leng; +} + +/** Get the current token. + * + */ + +char *webidl_get_text (void) +{ + return webidl_text; +} + +/** Set the current line number. + * @param _line_number line number + * + */ +void webidl_set_lineno (int _line_number ) +{ + + webidl_lineno = _line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param _in_str A readable stream. + * + * @see webidl__switch_to_buffer + */ +void webidl_set_in (FILE * _in_str ) +{ + webidl_in = _in_str ; +} + +void webidl_set_out (FILE * _out_str ) +{ + webidl_out = _out_str ; +} + +int webidl_get_debug (void) +{ + return webidl__flex_debug; +} + +void webidl_set_debug (int _bdebug ) +{ + webidl__flex_debug = _bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from webidl_lex_destroy(), so don't allocate here. + */ + + /* We do not touch webidl_lineno unless the option is enabled. */ + webidl_lineno = 1; + + (yy_buffer_stack) = NULL; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = NULL; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + webidl_in = stdin; + webidl_out = stdout; +#else + webidl_in = NULL; + webidl_out = NULL; +#endif + + /* For future reference: Set errno on error, since we are called by + * webidl_lex_init() + */ + return 0; +} + +/* webidl_lex_destroy is for both reentrant and non-reentrant scanners. */ +int webidl_lex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + webidl__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + webidl_pop_buffer_state(); + } + + /* Destroy the stack itself. */ + webidl_free((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * webidl_lex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *webidl_alloc (yy_size_t size ) +{ + return malloc(size); +} + +void *webidl_realloc (void * ptr, yy_size_t size ) +{ + + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return realloc(ptr, size); +} + +void webidl_free (void * ptr ) +{ + free( (char *) ptr ); /* see webidl_realloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 308 "webidl-lexer.l" + + + diff --git a/pkg/netsurf/nsgenbind/webidl-lexer.h b/pkg/netsurf/nsgenbind/webidl-lexer.h new file mode 100644 index 00000000..12212166 --- /dev/null +++ b/pkg/netsurf/nsgenbind/webidl-lexer.h @@ -0,0 +1,337 @@ +#ifndef webidl_HEADER_H +#define webidl_HEADER_H 1 +#define webidl_IN_HEADER 1 + +#line 6 "webidl-lexer.h" + +#line 8 "webidl-lexer.h" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 2 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern int webidl_leng; + +extern FILE *webidl_in, *webidl_out; + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +void webidl_restart (FILE *input_file ); +void webidl__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE webidl__create_buffer (FILE *file,int size ); +void webidl__delete_buffer (YY_BUFFER_STATE b ); +void webidl__flush_buffer (YY_BUFFER_STATE b ); +void webidl_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void webidl_pop_buffer_state (void ); + +YY_BUFFER_STATE webidl__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE webidl__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE webidl__scan_bytes (yyconst char *bytes,int len ); + +void *webidl_alloc (yy_size_t ); +void *webidl_realloc (void *,yy_size_t ); +void webidl_free (void * ); + +/* Begin user sect3 */ + +#define webidl_wrap() (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP + +extern int webidl_lineno; + +extern char *webidl_text; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr webidl_text + +#ifdef YY_HEADER_EXPORT_START_CONDITIONS +#define INITIAL 0 +#define incl 1 + +#endif + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int webidl_lex_destroy (void ); + +int webidl_get_debug (void ); + +void webidl_set_debug (int debug_flag ); + +YY_EXTRA_TYPE webidl_get_extra (void ); + +void webidl_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *webidl_get_in (void ); + +void webidl_set_in (FILE * _in_str ); + +FILE *webidl_get_out (void ); + +void webidl_set_out (FILE * _out_str ); + + int webidl_get_leng (void ); + +char *webidl_get_text (void ); + +int webidl_get_lineno (void ); + +void webidl_set_lineno (int _line_number ); + +YYSTYPE * webidl_get_lval (void ); + +void webidl_set_lval (YYSTYPE * yylval_param ); + + YYLTYPE *webidl_get_lloc (void ); + + void webidl_set_lloc (YYLTYPE * yylloc_param ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int webidl_wrap (void ); +#else +extern int webidl_wrap (void ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int webidl_lex \ + (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ); + +#define YY_DECL int webidl_lex \ + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param ) +#endif /* !YY_DECL */ + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL +#endif + +#line 308 "webidl-lexer.l" + + +#line 336 "webidl-lexer.h" +#undef webidl_IN_HEADER +#endif /* webidl_HEADER_H */ diff --git a/pkg/netsurf/nsgenbind/webidl-parser.c b/pkg/netsurf/nsgenbind/webidl-parser.c new file mode 100644 index 00000000..896afc1f --- /dev/null +++ b/pkg/netsurf/nsgenbind/webidl-parser.c @@ -0,0 +1,3976 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Substitute the type names. */ +#define YYSTYPE WEBIDL_STYPE +#define YYLTYPE WEBIDL_LTYPE +/* Substitute the variable and function names. */ +#define yyparse webidl_parse +#define yylex webidl_lex +#define yyerror webidl_error +#define yydebug webidl_debug +#define yynerrs webidl_nerrs + + +/* Copy the first part of user declarations. */ +#line 1 "webidl-parser.y" /* yacc.c:339 */ + + +/* This is a bison parser for Web IDL + * + * This file is part of nsgenbind. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2012 Vincent Sanders <vince@netsurf-browser.org> + * + * Derived from the the grammar in apendix A of W3C WEB IDL + * http://www.w3.org/TR/WebIDL/ + * + * WebIDL now has a second edition draft (mid 2015) that the dom and + * html specs are using. https://heycam.github.io/webidl + */ + +#include <stdio.h> +#include <string.h> +#include <stdbool.h> +#include <stdint.h> +#include <math.h> + +#define YYFPRINTF webidl_fprintf +#define YY_LOCATION_PRINT(File, Loc) \ + webidl_fprintf(File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) + +#include "utils.h" +#include "webidl-parser.h" +#include "webidl-lexer.h" + +#include "webidl-ast.h" + +char *errtxt; + +static void +webidl_error(YYLTYPE *locp, struct webidl_node **winbind_ast, const char *str) +{ + UNUSED(locp); + UNUSED(winbind_ast); + errtxt = strdup(str); +} + + +#line 120 "webidl-parser.c" /* yacc.c:339 */ + +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 1 +#endif + +/* In a future release of Bison, this section will be replaced + by #include "webidl-parser.h". */ +#ifndef YY_WEBIDL_WEBIDL_PARSER_H_INCLUDED +# define YY_WEBIDL_WEBIDL_PARSER_H_INCLUDED +/* Debug traces. */ +#ifndef WEBIDL_DEBUG +# if defined YYDEBUG +#if YYDEBUG +# define WEBIDL_DEBUG 1 +# else +# define WEBIDL_DEBUG 0 +# endif +# else /* ! defined YYDEBUG */ +# define WEBIDL_DEBUG 1 +# endif /* ! defined YYDEBUG */ +#endif /* ! defined WEBIDL_DEBUG */ +#if WEBIDL_DEBUG +extern int webidl_debug; +#endif + +/* Token type. */ +#ifndef WEBIDL_TOKENTYPE +# define WEBIDL_TOKENTYPE + enum webidl_tokentype + { + TOK_ANY = 258, + TOK_ATTRIBUTE = 259, + TOK_BOOLEAN = 260, + TOK_BYTE = 261, + TOK_CALLBACK = 262, + TOK_CONST = 263, + TOK_CONSTRUCTOR = 264, + TOK_CREATOR = 265, + TOK_DATE = 266, + TOK_DELETER = 267, + TOK_DICTIONARY = 268, + TOK_DOUBLE = 269, + TOK_ELLIPSIS = 270, + TOK_ENUM = 271, + TOK_EOL = 272, + TOK_EXCEPTION = 273, + TOK_FALSE = 274, + TOK_FLOAT = 275, + TOK_GETRAISES = 276, + TOK_GETTER = 277, + TOK_IMPLEMENTS = 278, + TOK_IN = 279, + TOK_INFINITY = 280, + TOK_INHERIT = 281, + TOK_INTERFACE = 282, + TOK_ITERABLE = 283, + TOK_LEGACYCALLER = 284, + TOK_LEGACYITERABLE = 285, + TOK_LONG = 286, + TOK_MODULE = 287, + TOK_NAN = 288, + TOK_NATIVE = 289, + TOK_NAMEDCONSTRUCTOR = 290, + TOK_NULL_LITERAL = 291, + TOK_OBJECT = 292, + TOK_OCTET = 293, + TOK_OMITTABLE = 294, + TOK_OPTIONAL = 295, + TOK_OR = 296, + TOK_PARTIAL = 297, + TOK_PROMISE = 298, + TOK_RAISES = 299, + TOK_READONLY = 300, + TOK_REQUIRED = 301, + TOK_SETRAISES = 302, + TOK_SETTER = 303, + TOK_SEQUENCE = 304, + TOK_SHORT = 305, + TOK_STATIC = 306, + TOK_STRING = 307, + TOK_STRINGIFIER = 308, + TOK_TRUE = 309, + TOK_TYPEDEF = 310, + TOK_UNRESTRICTED = 311, + TOK_UNSIGNED = 312, + TOK_VOID = 313, + TOK_POUND_SIGN = 314, + TOK_IDENTIFIER = 315, + TOK_INT_LITERAL = 316, + TOK_FLOAT_LITERAL = 317, + TOK_STRING_LITERAL = 318, + TOK_OTHER_LITERAL = 319, + TOK_JAVADOC = 320 + }; +#endif + +/* Value type. */ +#if ! defined WEBIDL_STYPE && ! defined WEBIDL_STYPE_IS_DECLARED + +union WEBIDL_STYPE +{ +#line 56 "webidl-parser.y" /* yacc.c:355 */ + + int attr; + long value; + bool isit; + char* text; + struct webidl_node *node; + +#line 242 "webidl-parser.c" /* yacc.c:355 */ +}; + +typedef union WEBIDL_STYPE WEBIDL_STYPE; +# define WEBIDL_STYPE_IS_TRIVIAL 1 +# define WEBIDL_STYPE_IS_DECLARED 1 +#endif + +/* Location type. */ +#if ! defined WEBIDL_LTYPE && ! defined WEBIDL_LTYPE_IS_DECLARED +typedef struct WEBIDL_LTYPE WEBIDL_LTYPE; +struct WEBIDL_LTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +}; +# define WEBIDL_LTYPE_IS_DECLARED 1 +# define WEBIDL_LTYPE_IS_TRIVIAL 1 +#endif + + + +int webidl_parse (struct webidl_node **webidl_ast); + +#endif /* !YY_WEBIDL_WEBIDL_PARSER_H_INCLUDED */ + +/* Copy the second part of user declarations. */ + +#line 272 "webidl-parser.c" /* yacc.c:358 */ + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined WEBIDL_LTYPE_IS_TRIVIAL && WEBIDL_LTYPE_IS_TRIVIAL \ + && defined WEBIDL_STYPE_IS_TRIVIAL && WEBIDL_STYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 3 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 819 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 81 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 83 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 232 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 387 + +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 320 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 72, 73, 2, 2, 71, 74, 79, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 70, 68, + 75, 69, 76, 80, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 77, 2, 78, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 66, 2, 67, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65 +}; + +#if WEBIDL_DEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 230, 230, 234, 240, 250, 252, 254, 256, 258, + 260, 262, 268, 273, 278, 280, 285, 326, 334, 336, + 341, 372, 376, 440, 442, 444, 446, 451, 492, 496, + 509, 520, 548, 585, 589, 598, 600, 608, 615, 618, + 624, 628, 636, 646, 651, 652, 658, 659, 666, 674, + 682, 714, 732, 734, 736, 743, 751, 758, 768, 778, + 788, 798, 811, 816, 818, 823, 825, 831, 841, 870, + 879, 898, 918, 926, 928, 933, 943, 947, 959, 963, + 972, 980, 988, 1004, 1008, 1016, 1023, 1030, 1040, 1047, + 1057, 1069, 1073, 1085, 1089, 1098, 1102, 1111, 1119, 1128, + 1140, 1142, 1148, 1152, 1160, 1165, 1174, 1178, 1186, 1188, + 1193, 1199, 1203, 1214, 1218, 1230, 1235, 1241, 1247, 1255, + 1267, 1281, 1293, 1297, 1306, 1310, 1319, 1329, 1339, 1350, + 1357, 1362, 1367, 1372, 1377, 1382, 1387, 1392, 1397, 1402, + 1407, 1412, 1417, 1422, 1427, 1432, 1437, 1442, 1447, 1452, + 1457, 1462, 1467, 1472, 1477, 1482, 1487, 1492, 1497, 1502, + 1507, 1512, 1517, 1522, 1527, 1537, 1542, 1547, 1552, 1557, + 1562, 1567, 1572, 1577, 1582, 1587, 1592, 1597, 1602, 1607, + 1612, 1617, 1622, 1627, 1632, 1637, 1642, 1650, 1655, 1663, + 1668, 1677, 1679, 1689, 1697, 1702, 1708, 1717, 1721, 1732, + 1737, 1743, 1748, 1755, 1760, 1765, 1773, 1778, 1790, 1792, + 1794, 1799, 1804, 1812, 1819, 1824, 1829, 1837, 1844, 1849, + 1854, 1867, 1871, 1879, 1888, 1892, 1897, 1906, 1910, 1917, + 1920, 1925, 1927 +}; +#endif + +#if WEBIDL_DEBUG || YYERROR_VERBOSE || 1 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "TOK_ANY", "TOK_ATTRIBUTE", + "TOK_BOOLEAN", "TOK_BYTE", "TOK_CALLBACK", "TOK_CONST", + "TOK_CONSTRUCTOR", "TOK_CREATOR", "TOK_DATE", "TOK_DELETER", + "TOK_DICTIONARY", "TOK_DOUBLE", "TOK_ELLIPSIS", "TOK_ENUM", "TOK_EOL", + "TOK_EXCEPTION", "TOK_FALSE", "TOK_FLOAT", "TOK_GETRAISES", "TOK_GETTER", + "TOK_IMPLEMENTS", "TOK_IN", "TOK_INFINITY", "TOK_INHERIT", + "TOK_INTERFACE", "TOK_ITERABLE", "TOK_LEGACYCALLER", + "TOK_LEGACYITERABLE", "TOK_LONG", "TOK_MODULE", "TOK_NAN", "TOK_NATIVE", + "TOK_NAMEDCONSTRUCTOR", "TOK_NULL_LITERAL", "TOK_OBJECT", "TOK_OCTET", + "TOK_OMITTABLE", "TOK_OPTIONAL", "TOK_OR", "TOK_PARTIAL", "TOK_PROMISE", + "TOK_RAISES", "TOK_READONLY", "TOK_REQUIRED", "TOK_SETRAISES", + "TOK_SETTER", "TOK_SEQUENCE", "TOK_SHORT", "TOK_STATIC", "TOK_STRING", + "TOK_STRINGIFIER", "TOK_TRUE", "TOK_TYPEDEF", "TOK_UNRESTRICTED", + "TOK_UNSIGNED", "TOK_VOID", "TOK_POUND_SIGN", "TOK_IDENTIFIER", + "TOK_INT_LITERAL", "TOK_FLOAT_LITERAL", "TOK_STRING_LITERAL", + "TOK_OTHER_LITERAL", "TOK_JAVADOC", "'{'", "'}'", "';'", "'='", "':'", + "','", "'('", "')'", "'-'", "'<'", "'>'", "'['", "']'", "'.'", "'?'", + "$accept", "Definitions", "Definition", "CallbackOrInterface", + "CallbackRestOrInterface", "Interface", "Partial", "PartialDefinition", + "PartialInterface", "InterfaceMembers", "InterfaceMember", "Dictionary", + "DictionaryMembers", "DictionaryMember", "PartialDictionary", "Default", + "DefaultValue", "Exception", "ExceptionMembers", "Inheritance", "Enum", + "EnumValueList", "EnumValueListComma", "EnumValueListString", + "CallbackRest", "Typedef", "ImplementsStatement", "Const", "ConstValue", + "BooleanLiteral", "FloatLiteral", "AttributeOrOperation", + "StringifierAttributeOrOperation", "Attribute", "StaticMember", + "StaticMemberRest", "AttributeRest", "AttributeName", + "AttributeNameKeyword", "Inherit", "ReadOnly", "Operation", + "SpecialOperation", "Specials", "Special", "OperationRest", + "OptionalIdentifier", "ArgumentList", "Arguments", "Argument", + "OptionalOrRequiredArgument", "ArgumentName", "Ellipsis", "Iterable", + "OptionalType", "ExceptionMember", "ExceptionField", + "ExtendedAttributeList", "ExtendedAttributes", "ExtendedAttribute", + "ExtendedAttributeRest", "ExtendedAttributeInner", "Other", + "ArgumentNameKeyword", "OtherOrComma", "Type", "SingleType", "UnionType", + "UnionMemberType", "UnionMemberTypes", "NonAnyType", "ConstType", + "PrimitiveType", "UnrestrictedFloatType", "FloatType", + "UnsignedIntegerType", "IntegerType", "OptionalLong", "PromiseType", + "TypeSuffix", "TypeSuffixStartingWithArray", "Null", "ReturnType", YY_NULLPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 123, 125, 59, 61, + 58, 44, 40, 41, 45, 60, 62, 91, 93, 46, + 63 +}; +# endif + +#define YYPACT_NINF -289 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-289))) + +#define YYTABLE_NINF -94 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + 16, -289, 11, -289, 256, 32, -289, -289, -289, -289, + -289, -289, 0, -289, -289, -289, -289, -289, -289, -289, + -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, + -289, -289, -289, 12, -289, -289, -289, -289, -289, -289, + -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, + -289, -289, -289, -289, -289, -289, -289, 334, -289, -289, + -289, 334, -289, -289, -289, 334, -289, -289, -20, 256, + -289, -3, 18, 34, 39, 41, 9, 27, 83, -289, + -289, -289, -289, -289, -289, -289, -289, -289, -10, 47, + 334, -289, 334, 334, 51, -289, 334, 40, 36, 256, + 42, -289, -289, 50, -289, -289, -289, 57, 55, 57, + 57, 69, 79, -289, -289, -289, 660, 81, 70, 73, + 460, 76, 78, 77, 74, 256, -289, 256, 256, -20, + -289, 508, 91, 87, 93, 88, 92, 94, 98, 80, + -289, -289, -15, -289, -289, 128, -15, -289, 90, 99, + -289, -15, 46, -1, -15, 708, 109, -289, -15, -289, + -15, -289, -289, -289, -289, -15, 108, -289, 27, -289, + 660, -289, 165, -10, 334, 334, 334, -289, -289, -289, + -289, -289, -289, 110, -289, -42, 113, 123, -30, -289, + -42, -289, 107, -289, 116, 80, -289, -289, -289, -289, + 508, 660, -289, -289, -289, -289, 114, -15, 158, -289, + 132, -289, -289, -289, -289, 73, 759, -289, 759, 129, + -289, -289, -289, -10, 134, 556, 140, -289, 138, 141, + 612, -21, 142, -13, -15, -15, -289, 131, 135, 136, + -289, 708, -289, -289, -289, 143, -289, -289, -289, 153, + 145, 660, -42, 168, 113, -289, -289, 162, 111, -289, + -30, -289, 172, 166, 167, 169, 170, -289, -289, -289, + 155, -15, 192, 737, -289, 173, -289, 176, -289, 143, + -289, -289, 155, 180, 155, -289, 174, -289, -289, -289, + -289, -289, 171, -289, 177, -289, 412, 1, -289, -289, + -289, -289, -289, 198, -289, -289, 118, -289, 184, -289, + -289, -289, -289, -289, 708, 175, -289, -289, -289, -289, + -289, -289, -289, -289, 222, -289, -289, -289, -289, -289, + 181, 183, -289, 186, -289, -289, 660, 660, -289, -289, + 249, 184, -289, -289, -289, -289, -289, 185, 249, 508, + 118, -289, 192, -289, -289, -289, -289, 72, 202, 201, + 660, -289, -289, -10, -289, 184, -289, -289, 188, 660, + 204, 220, -18, 217, -289, -289, -289, 227, -289, -289, + -289, 231, -289, 232, -289, -289, -289 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 0, 4, 111, 1, 0, 0, 147, 165, 148, 149, + 166, 167, 118, 168, 143, 169, 170, 150, 136, 171, + 172, 151, 152, 173, 174, 145, 175, 176, 177, 178, + 179, 153, 146, 0, 154, 155, 156, 158, 157, 180, + 181, 182, 159, 160, 183, 144, 184, 161, 185, 186, + 162, 163, 131, 129, 130, 132, 133, 124, 138, 140, + 137, 124, 134, 139, 141, 124, 135, 142, 113, 122, + 164, 0, 0, 0, 0, 0, 0, 111, 0, 3, + 5, 13, 6, 7, 8, 9, 10, 11, 111, 0, + 124, 188, 124, 124, 0, 187, 124, 0, 0, 0, + 0, 123, 121, 0, 12, 15, 14, 40, 0, 40, + 40, 0, 0, 17, 18, 19, 0, 0, 0, 95, + 0, 0, 0, 0, 0, 122, 128, 122, 122, 113, + 112, 0, 0, 0, 0, 0, 0, 0, 0, 227, + 210, 211, 224, 216, 215, 221, 224, 212, 0, 0, + 219, 224, 0, 0, 224, 0, 0, 189, 224, 191, + 224, 209, 214, 208, 218, 224, 0, 119, 111, 94, + 0, 97, 102, 111, 124, 124, 124, 117, 115, 116, + 114, 232, 231, 0, 41, 111, 45, 0, 111, 21, + 111, 21, 0, 192, 0, 227, 205, 222, 220, 204, + 0, 0, 201, 213, 217, 202, 0, 224, 0, 194, + 0, 190, 199, 200, 50, 95, 0, 103, 0, 0, + 127, 125, 126, 111, 0, 0, 47, 43, 0, 0, + 0, 111, 0, 111, 224, 224, 226, 0, 0, 0, + 195, 0, 49, 96, 101, 33, 100, 99, 120, 0, + 0, 0, 111, 0, 45, 44, 42, 0, 0, 108, + 111, 109, 0, 0, 76, 0, 0, 228, 225, 223, + 229, 224, 197, 0, 98, 0, 27, 0, 29, 33, + 46, 37, 229, 0, 229, 39, 0, 16, 87, 88, + 85, 77, 0, 89, 0, 86, 78, 76, 22, 23, + 24, 63, 25, 78, 64, 81, 83, 26, 91, 32, + 20, 230, 203, 196, 0, 0, 57, 60, 61, 55, + 56, 54, 58, 36, 0, 34, 35, 52, 53, 48, + 0, 0, 207, 0, 206, 110, 0, 0, 79, 69, + 0, 91, 92, 67, 62, 65, 66, 0, 0, 0, + 83, 80, 197, 193, 59, 30, 31, 0, 106, 0, + 0, 70, 71, 111, 68, 91, 84, 198, 0, 0, + 0, 0, 0, 0, 82, 51, 107, 0, 105, 75, + 74, 0, 73, 0, 104, 72, 90 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -289, -289, -289, -289, -289, 230, -289, -289, -289, 112, + -289, -289, -172, -289, -289, 44, -289, -289, 61, 2, + -289, -289, 75, -289, -289, -289, -289, 63, -23, -289, + -289, -289, -289, 54, -289, -289, -33, -289, -289, -289, + 52, -289, -289, -7, 102, -288, -289, -171, 154, 190, + -289, 150, -289, -289, -289, -289, -289, -2, 244, 4, + -43, -52, 10, -185, -289, -115, -289, -152, -231, 25, + -151, -289, 120, -289, 229, -289, 226, -289, -289, -139, + 206, -184, -194 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 2, 79, 80, 104, 81, 82, 113, 114, 231, + 298, 83, 224, 252, 115, 274, 325, 84, 229, 133, + 85, 187, 227, 255, 106, 86, 87, 259, 326, 327, + 328, 300, 344, 301, 302, 339, 361, 381, 382, 303, + 340, 304, 305, 349, 350, 346, 347, 118, 169, 119, + 171, 245, 218, 307, 370, 260, 261, 120, 100, 101, + 102, 94, 95, 70, 96, 182, 157, 158, 208, 315, + 159, 283, 160, 161, 162, 163, 164, 198, 165, 196, + 193, 312, 183 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_int16 yytable[] = +{ + 5, 156, 219, 207, 209, 172, 237, 199, 68, 97, + 272, 3, 202, 98, 69, 205, -2, 1, 232, 211, + 351, 212, 111, -2, 75, -28, 213, 291, 379, -2, + 145, 246, -2, 246, -2, 4, 112, -38, 122, 71, + 123, 124, 380, -2, 126, 72, 263, 4, 73, 150, + 74, 99, 249, 362, 266, 216, 4, 103, -2, 75, + 143, 342, 194, -93, 4, 195, 144, 4, 240, 343, + 308, -2, 88, -91, 76, 116, -2, 374, 107, 69, + 278, 89, 177, 352, 178, 179, 238, 77, 4, 207, + 209, 316, 78, -2, 108, 267, 268, 317, 332, 109, + 334, 110, 341, 129, 4, 318, 117, 121, 319, 69, + 253, 135, 136, 127, 128, 262, 140, 141, 125, 131, + 130, 134, 220, 221, 222, 143, 320, 132, 288, 137, + 289, 144, 313, 321, 322, 69, 277, 69, 69, 138, + 290, 166, 145, 167, 168, 174, 324, 293, 173, 147, + 175, 184, 176, 185, 188, 365, 186, 192, 189, 197, + 190, 150, 207, 209, 191, 200, 295, 152, 153, 210, + 139, 282, 140, 141, 201, 258, 214, 288, 142, 289, + 217, 143, 223, 225, 226, 234, 230, 144, 225, 290, + 228, 239, 373, 291, 235, 292, 293, 294, 145, 241, + 242, 250, 248, 254, 146, 147, 256, 269, 257, 265, + 148, 270, 273, 276, 271, 295, 149, 150, 296, 151, + 297, 358, 359, 152, 153, 181, 275, 154, 279, 264, + 281, 264, 286, 314, 287, 311, 330, 309, 310, 155, + 333, 329, 335, 338, 342, 372, 336, 354, 353, 355, + 225, 356, 337, 360, 376, 357, 375, 363, 230, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 369, 20, 21, 22, 371, 23, 24, + 377, 25, 26, 27, 28, 29, 30, 31, 378, 32, + 383, 33, 34, 35, 36, 384, 37, 38, 39, 385, + 386, 105, 40, 233, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 364, 52, 53, 54, 55, + 56, 285, 57, 331, 58, 59, 60, 299, 61, 280, + 62, 63, 64, 65, 368, 66, 67, 6, 7, 8, + 9, 10, 11, 366, 13, 14, 15, 16, 17, 18, + 19, 345, 20, 21, 22, 348, 23, 24, 215, 25, + 26, 27, 28, 29, 30, 31, 306, 32, 247, 243, + 34, 35, 36, 180, 37, 38, 39, 367, 284, 204, + 40, 203, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 0, 52, 53, 54, 55, 56, 0, + 90, 236, 58, 59, 60, 91, 92, 0, 62, 63, + 64, 93, 0, 66, 67, 139, 0, 140, 141, 0, + 0, 0, 0, 142, 0, 0, 143, 0, 0, 0, + 0, 0, 144, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 145, 0, 0, 0, 0, 0, 146, + 147, 0, 0, 0, 0, 148, 0, 338, 0, 0, + 0, 149, 150, 139, 151, 140, 141, 0, 152, 153, + 181, 142, 154, 0, 143, 0, 0, 0, 0, 0, + 144, 0, 0, 0, 155, 0, 0, 0, 0, 0, + 0, 145, 0, 0, 0, 0, 0, 146, 147, 0, + 170, 0, 0, 148, 0, 0, 0, 0, 0, 149, + 150, 139, 151, 140, 141, 0, 152, 153, 0, 142, + 154, 0, 143, 0, 0, 0, 0, 0, 144, 0, + 0, 0, 155, 0, 0, 0, 0, 0, 0, 145, + 0, 0, 0, 0, 0, 146, 147, 0, 0, 0, + 0, 148, 0, 0, 0, 0, 0, 149, 150, 139, + 151, 140, 141, 0, 152, 153, 181, 142, 154, 0, + 143, 0, 0, 0, 0, 0, 144, 0, 0, 0, + 155, 0, 0, 0, 0, 0, 0, 145, 0, 0, + 0, 0, 0, 146, 147, 0, 0, 0, 0, 148, + 0, 0, 251, 0, 0, 149, 150, 0, 151, 0, + 0, 0, 152, 153, 0, 139, 154, 140, 141, 0, + 258, 0, 0, 142, 0, 0, 143, 0, 155, 0, + 0, 0, 144, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 145, 0, 0, 0, 0, 0, 146, + 147, 0, 0, 0, 0, 148, 0, 0, 0, 0, + 0, 149, 150, 139, 151, 140, 141, 0, 152, 153, + 0, 142, 154, 0, 143, 0, 0, 0, 0, 0, + 144, 0, 0, 0, 155, 0, 0, 0, 0, 0, + 0, 145, 0, 0, 0, 0, 0, 146, 147, 0, + 0, 0, 0, 148, 0, 0, 0, 0, 0, 149, + 150, 206, 151, 140, 141, 0, 152, 153, 0, 142, + 154, 0, 143, 0, 0, 0, 0, 0, 144, 0, + 0, 0, 155, 0, 0, 0, 0, 0, 0, 145, + 0, 0, 0, 0, 0, 146, 147, 0, 0, 0, + 0, 148, 0, 0, 0, 0, 316, 149, 150, 0, + 151, 0, 317, 7, 152, 153, 10, 11, 154, 13, + 318, 15, 16, 319, 0, 19, 0, 20, 0, 0, + 155, 23, 24, 0, 0, 26, 27, 28, 29, 30, + 0, 320, 0, 0, 0, 0, 0, 0, 321, 322, + 323, 39, 0, 0, 0, 40, 0, 41, 0, 0, + 44, 324, 46, 0, 48, 49, 0, 0, 0, 244 +}; + +static const yytype_int16 yycheck[] = +{ + 2, 116, 173, 155, 155, 120, 200, 146, 4, 61, + 241, 0, 151, 65, 4, 154, 0, 1, 190, 158, + 308, 160, 13, 7, 27, 67, 165, 26, 46, 13, + 31, 216, 16, 218, 18, 77, 27, 67, 90, 7, + 92, 93, 60, 27, 96, 13, 67, 77, 16, 50, + 18, 71, 223, 341, 67, 170, 77, 60, 42, 27, + 14, 60, 77, 73, 77, 80, 20, 77, 207, 68, + 264, 55, 72, 72, 42, 77, 60, 365, 60, 69, + 252, 69, 125, 314, 127, 128, 201, 55, 77, 241, + 241, 19, 60, 77, 60, 234, 235, 25, 282, 60, + 284, 60, 296, 99, 77, 33, 23, 60, 36, 99, + 225, 109, 110, 73, 78, 230, 5, 6, 67, 69, + 78, 66, 174, 175, 176, 14, 54, 70, 10, 60, + 12, 20, 271, 61, 62, 125, 251, 127, 128, 60, + 22, 60, 31, 73, 71, 67, 74, 29, 72, 38, + 73, 60, 78, 66, 66, 349, 63, 77, 66, 31, + 66, 50, 314, 314, 66, 75, 48, 56, 57, 60, + 3, 60, 5, 6, 75, 8, 68, 10, 11, 12, + 15, 14, 72, 185, 71, 78, 188, 20, 190, 22, + 67, 77, 363, 26, 78, 28, 29, 30, 31, 41, + 68, 67, 73, 63, 37, 38, 68, 76, 67, 67, + 43, 76, 69, 68, 78, 48, 49, 50, 51, 52, + 53, 336, 337, 56, 57, 58, 73, 60, 60, 231, + 68, 233, 60, 41, 68, 80, 60, 68, 68, 72, + 60, 68, 68, 45, 60, 360, 75, 25, 73, 68, + 252, 68, 75, 4, 369, 69, 68, 72, 260, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 71, 18, 19, 20, 76, 22, 23, + 76, 25, 26, 27, 28, 29, 30, 31, 68, 33, + 73, 35, 36, 37, 38, 68, 40, 41, 42, 68, + 68, 71, 46, 191, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 348, 60, 61, 62, 63, + 64, 260, 66, 279, 68, 69, 70, 264, 72, 254, + 74, 75, 76, 77, 357, 79, 80, 3, 4, 5, + 6, 7, 8, 350, 10, 11, 12, 13, 14, 15, + 16, 297, 18, 19, 20, 303, 22, 23, 168, 25, + 26, 27, 28, 29, 30, 31, 264, 33, 218, 215, + 36, 37, 38, 129, 40, 41, 42, 352, 258, 153, + 46, 152, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, -1, 60, 61, 62, 63, 64, -1, + 66, 195, 68, 69, 70, 71, 72, -1, 74, 75, + 76, 77, -1, 79, 80, 3, -1, 5, 6, -1, + -1, -1, -1, 11, -1, -1, 14, -1, -1, -1, + -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 31, -1, -1, -1, -1, -1, 37, + 38, -1, -1, -1, -1, 43, -1, 45, -1, -1, + -1, 49, 50, 3, 52, 5, 6, -1, 56, 57, + 58, 11, 60, -1, 14, -1, -1, -1, -1, -1, + 20, -1, -1, -1, 72, -1, -1, -1, -1, -1, + -1, 31, -1, -1, -1, -1, -1, 37, 38, -1, + 40, -1, -1, 43, -1, -1, -1, -1, -1, 49, + 50, 3, 52, 5, 6, -1, 56, 57, -1, 11, + 60, -1, 14, -1, -1, -1, -1, -1, 20, -1, + -1, -1, 72, -1, -1, -1, -1, -1, -1, 31, + -1, -1, -1, -1, -1, 37, 38, -1, -1, -1, + -1, 43, -1, -1, -1, -1, -1, 49, 50, 3, + 52, 5, 6, -1, 56, 57, 58, 11, 60, -1, + 14, -1, -1, -1, -1, -1, 20, -1, -1, -1, + 72, -1, -1, -1, -1, -1, -1, 31, -1, -1, + -1, -1, -1, 37, 38, -1, -1, -1, -1, 43, + -1, -1, 46, -1, -1, 49, 50, -1, 52, -1, + -1, -1, 56, 57, -1, 3, 60, 5, 6, -1, + 8, -1, -1, 11, -1, -1, 14, -1, 72, -1, + -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 31, -1, -1, -1, -1, -1, 37, + 38, -1, -1, -1, -1, 43, -1, -1, -1, -1, + -1, 49, 50, 3, 52, 5, 6, -1, 56, 57, + -1, 11, 60, -1, 14, -1, -1, -1, -1, -1, + 20, -1, -1, -1, 72, -1, -1, -1, -1, -1, + -1, 31, -1, -1, -1, -1, -1, 37, 38, -1, + -1, -1, -1, 43, -1, -1, -1, -1, -1, 49, + 50, 3, 52, 5, 6, -1, 56, 57, -1, 11, + 60, -1, 14, -1, -1, -1, -1, -1, 20, -1, + -1, -1, 72, -1, -1, -1, -1, -1, -1, 31, + -1, -1, -1, -1, -1, 37, 38, -1, -1, -1, + -1, 43, -1, -1, -1, -1, 19, 49, 50, -1, + 52, -1, 25, 4, 56, 57, 7, 8, 60, 10, + 33, 12, 13, 36, -1, 16, -1, 18, -1, -1, + 72, 22, 23, -1, -1, 26, 27, 28, 29, 30, + -1, 54, -1, -1, -1, -1, -1, -1, 61, 62, + 63, 42, -1, -1, -1, 46, -1, 48, -1, -1, + 51, 74, 53, -1, 55, 56, -1, -1, -1, 60 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 1, 82, 0, 77, 138, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 18, 19, 20, 22, 23, 25, 26, 27, 28, 29, + 30, 31, 33, 35, 36, 37, 38, 40, 41, 42, + 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 60, 61, 62, 63, 64, 66, 68, 69, + 70, 72, 74, 75, 76, 77, 79, 80, 140, 143, + 144, 7, 13, 16, 18, 27, 42, 55, 60, 83, + 84, 86, 87, 92, 98, 101, 106, 107, 72, 69, + 66, 71, 72, 77, 142, 143, 145, 142, 142, 71, + 139, 140, 141, 60, 85, 86, 105, 60, 60, 60, + 60, 13, 27, 88, 89, 95, 138, 23, 128, 130, + 138, 60, 142, 142, 142, 67, 142, 73, 78, 140, + 78, 69, 70, 100, 66, 100, 100, 60, 60, 3, + 5, 6, 11, 14, 20, 31, 37, 38, 43, 49, + 50, 52, 56, 57, 60, 72, 146, 147, 148, 151, + 153, 154, 155, 156, 157, 159, 60, 73, 71, 129, + 40, 131, 146, 72, 67, 73, 78, 141, 141, 141, + 139, 58, 146, 163, 60, 66, 63, 102, 66, 66, + 66, 66, 77, 161, 77, 80, 160, 31, 158, 160, + 75, 75, 160, 155, 157, 160, 3, 148, 149, 151, + 60, 160, 160, 160, 68, 130, 146, 15, 133, 128, + 142, 142, 142, 72, 93, 138, 71, 103, 67, 99, + 138, 90, 93, 90, 78, 78, 161, 163, 146, 77, + 160, 41, 68, 129, 60, 132, 144, 132, 73, 128, + 67, 46, 94, 146, 63, 104, 68, 67, 8, 108, + 136, 137, 146, 67, 138, 67, 67, 160, 160, 76, + 76, 78, 149, 69, 96, 73, 68, 146, 93, 60, + 103, 68, 60, 152, 153, 99, 60, 68, 10, 12, + 22, 26, 28, 29, 30, 48, 51, 53, 91, 108, + 112, 114, 115, 120, 122, 123, 125, 134, 163, 68, + 68, 80, 162, 160, 41, 150, 19, 25, 33, 36, + 54, 61, 62, 63, 74, 97, 109, 110, 111, 68, + 60, 96, 162, 60, 162, 68, 75, 75, 45, 116, + 121, 163, 60, 68, 113, 114, 126, 127, 121, 124, + 125, 126, 149, 73, 25, 68, 68, 69, 146, 146, + 4, 117, 126, 72, 117, 163, 124, 150, 109, 71, + 135, 76, 146, 128, 126, 68, 146, 76, 68, 46, + 60, 118, 119, 73, 68, 68, 68 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 81, 82, 82, 82, 83, 83, 83, 83, 83, + 83, 83, 84, 84, 85, 85, 86, 87, 88, 88, + 89, 90, 90, 91, 91, 91, 91, 92, 93, 93, + 94, 94, 95, 96, 96, 97, 97, 98, 99, 99, + 100, 100, 101, 102, 103, 103, 104, 104, 105, 106, + 107, 108, 109, 109, 109, 109, 110, 110, 111, 111, + 111, 111, 112, 112, 112, 113, 113, 113, 114, 115, + 116, 116, 117, 118, 118, 119, 120, 120, 121, 121, + 122, 122, 123, 124, 124, 125, 125, 125, 125, 125, + 126, 127, 127, 128, 128, 129, 129, 130, 131, 131, + 132, 132, 133, 133, 134, 134, 135, 135, 136, 136, + 137, 138, 138, 139, 139, 140, 140, 140, 140, 140, + 140, 140, 141, 141, 142, 142, 142, 142, 142, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 145, 145, 146, + 146, 147, 147, 148, 149, 149, 149, 150, 150, 151, + 151, 151, 151, 151, 151, 151, 152, 152, 153, 153, + 153, 153, 153, 154, 154, 155, 155, 156, 156, 157, + 157, 158, 158, 159, 160, 160, 160, 161, 161, 162, + 162, 163, 163 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 3, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 1, 1, 1, 7, 2, 1, 1, + 6, 0, 3, 1, 1, 1, 1, 7, 0, 3, + 4, 4, 6, 0, 2, 1, 1, 7, 0, 3, + 0, 2, 6, 2, 2, 0, 2, 0, 7, 5, + 4, 6, 1, 1, 1, 1, 1, 1, 1, 2, + 1, 1, 2, 1, 1, 1, 1, 1, 3, 2, + 2, 2, 4, 1, 1, 1, 0, 1, 0, 1, + 2, 1, 4, 0, 2, 1, 1, 1, 1, 1, + 5, 0, 1, 0, 2, 0, 3, 2, 4, 3, + 1, 1, 0, 1, 6, 5, 0, 2, 1, 1, + 3, 0, 4, 0, 3, 4, 4, 4, 1, 4, + 6, 2, 0, 1, 0, 4, 4, 4, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 1, 2, 6, 1, 2, 4, 0, 3, 2, + 2, 2, 2, 5, 2, 2, 2, 2, 1, 1, + 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, + 2, 0, 1, 4, 0, 3, 2, 0, 3, 0, + 1, 1, 1 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (&yylloc, webidl_ast, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) +#endif + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) + + +/* Enable debugging if requested. */ +#if WEBIDL_DEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if defined WEBIDL_LTYPE_IS_TRIVIAL && WEBIDL_LTYPE_IS_TRIVIAL + +/* Print *YYLOCP on YYO. Private, do not rely on its existence. */ + +YY_ATTRIBUTE_UNUSED +static unsigned +yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) +{ + unsigned res = 0; + int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; + if (0 <= yylocp->first_line) + { + res += YYFPRINTF (yyo, "%d", yylocp->first_line); + if (0 <= yylocp->first_column) + res += YYFPRINTF (yyo, ".%d", yylocp->first_column); + } + if (0 <= yylocp->last_line) + { + if (yylocp->first_line < yylocp->last_line) + { + res += YYFPRINTF (yyo, "-%d", yylocp->last_line); + if (0 <= end_col) + res += YYFPRINTF (yyo, ".%d", end_col); + } + else if (0 <= end_col && yylocp->first_column < end_col) + res += YYFPRINTF (yyo, "-%d", end_col); + } + return res; + } + +# define YY_LOCATION_PRINT(File, Loc) \ + yy_location_print_ (File, &(Loc)) + +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, Location, webidl_ast); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct webidl_node **webidl_ast) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + YYUSE (yylocationp); + YYUSE (webidl_ast); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct webidl_node **webidl_ast) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + YY_LOCATION_PRINT (yyoutput, *yylocationp); + YYFPRINTF (yyoutput, ": "); + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, webidl_ast); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, struct webidl_node **webidl_ast) +{ + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , &(yylsp[(yyi + 1) - (yynrhs)]) , webidl_ast); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, yylsp, Rule, webidl_ast); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !WEBIDL_DEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !WEBIDL_DEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, struct webidl_node **webidl_ast) +{ + YYUSE (yyvaluep); + YYUSE (yylocationp); + YYUSE (webidl_ast); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (struct webidl_node **webidl_ast) +{ +/* The lookahead symbol. */ +int yychar; + + +/* The semantic value of the lookahead symbol. */ +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); + +/* Location data for the lookahead symbol. */ +static YYLTYPE yyloc_default +# if defined WEBIDL_LTYPE_IS_TRIVIAL && WEBIDL_LTYPE_IS_TRIVIAL + = { 1, 1, 1, 1 } +# endif +; +YYLTYPE yylloc = yyloc_default; + + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + 'yyls': related to locations. + + Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[3]; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + YYLTYPE yyloc; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yylsp = yyls = yylsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + yylsp[0] = yylloc; + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + YYLTYPE *yyls1 = yyls; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); + + yyls = yyls1; + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + yylsp = yyls + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (&yylval, &yylloc); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + *++yylsp = yylloc; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + /* Default location. */ + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: +#line 230 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 1855 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 3: +#line 235 "webidl-parser.y" /* yacc.c:1646 */ + { + webidl_node_add((yyvsp[0].node), (yyvsp[-1].node)); + (yyval.node) = *webidl_ast = webidl_node_prepend(*webidl_ast, (yyvsp[0].node)); + } +#line 1864 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 4: +#line 241 "webidl-parser.y" /* yacc.c:1646 */ + { + fprintf(stderr, "%d: %s\n", yylloc.first_line, errtxt); + free(errtxt); + YYABORT ; + } +#line 1874 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 12: +#line 269 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = (yyvsp[0].node); + } +#line 1882 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 16: +#line 286 "webidl-parser.y" /* yacc.c:1646 */ + { + /* extend interface with additional members */ + struct webidl_node *interface_node; + struct webidl_node *members = NULL; + + if ((yyvsp[-4].text) != NULL) { + members = webidl_node_new(WEBIDL_NODE_TYPE_INHERITANCE, + members, + (yyvsp[-4].text)); + } + + members = webidl_node_new(WEBIDL_NODE_TYPE_LIST, members, (yyvsp[-2].node)); + + + interface_node = webidl_node_find_type_ident(*webidl_ast, + WEBIDL_NODE_TYPE_INTERFACE, + (yyvsp[-5].text)); + + if (interface_node == NULL) { + /* no existing interface - create one with ident */ + members = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, + members, + (yyvsp[-5].text)); + + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE, + NULL, + members); + } else { + /* update the existing interface */ + + /* link member node into interfaces_node */ + webidl_node_add(interface_node, members); + + (yyval.node) = NULL; /* updating so no need to add a new node */ + } + } +#line 1923 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 17: +#line 327 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = (yyvsp[0].node); + } +#line 1931 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 20: +#line 342 "webidl-parser.y" /* yacc.c:1646 */ + { + /* extend interface with additional members */ + struct webidl_node *members; + struct webidl_node *interface_node; + + interface_node = webidl_node_find_type_ident(*webidl_ast, + WEBIDL_NODE_TYPE_INTERFACE, + (yyvsp[-4].text)); + + members = webidl_node_new(WEBIDL_NODE_TYPE_LIST, NULL, (yyvsp[-2].node)); + + if (interface_node == NULL) { + /* doesnt already exist so create it */ + + members = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, members, (yyvsp[-4].text)); + + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE, NULL, members); + } else { + /* update the existing interface */ + + /* link member node into interfaces_node */ + webidl_node_add(interface_node, members); + + (yyval.node) = NULL; /* updating so no need to add a new node */ + } + } +#line 1962 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 21: +#line 372 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; /* empty */ + } +#line 1970 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 22: +#line 377 "webidl-parser.y" /* yacc.c:1646 */ + { + /* This needs to deal with members with the same + * identifier which indicate polymorphism. this is + * handled in the AST by adding the argument lists for + * each polymorphism to the same + * WEBIDL_NODE_TYPE_OPERATION + * + * @todo need to consider qualifer/stringifier compatibility + */ + struct webidl_node *member_node; + struct webidl_node *ident_node; + struct webidl_node *list_node; + + ident_node = webidl_node_find_type(webidl_node_getnode((yyvsp[0].node)), + NULL, + WEBIDL_NODE_TYPE_IDENT); + + list_node = webidl_node_find_type(webidl_node_getnode((yyvsp[0].node)), + NULL, + WEBIDL_NODE_TYPE_LIST); + + if (ident_node == NULL) { + /* something with no ident - possibly constructors? */ + /* @todo understand this better */ + + (yyval.node) = webidl_node_prepend((yyvsp[-2].node), (yyvsp[0].node)); + + } else if (list_node == NULL) { + /* member with no argument list, usually an + * attribute, cannot be polymorphic + */ + + /* add extended attributes to parameter list */ + webidl_node_add((yyvsp[0].node), (yyvsp[-1].node)); + + (yyval.node) = webidl_node_prepend((yyvsp[-2].node), (yyvsp[0].node)); + + } else { + /* add extended attributes to parameter list */ + webidl_node_add(list_node, (yyvsp[-1].node)); + + /* has an arguemnt list so can be polymorphic */ + member_node = webidl_node_find_type_ident( + (yyvsp[-2].node), + webidl_node_gettype((yyvsp[0].node)), + webidl_node_gettext(ident_node)); + if (member_node == NULL) { + /* not a member with that ident already present */ + (yyval.node) = webidl_node_prepend((yyvsp[-2].node), (yyvsp[0].node)); + } else { + webidl_node_add(member_node, list_node); + (yyval.node) = (yyvsp[-2].node); /* updated existing node do not add new one */ + } + } + } +#line 2030 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 27: +#line 452 "webidl-parser.y" /* yacc.c:1646 */ + { + /* extend dictionary with additional members */ + struct webidl_node *dictionary_node; + struct webidl_node *members = NULL; + + if ((yyvsp[-4].text) != NULL) { + members = webidl_node_new(WEBIDL_NODE_TYPE_INHERITANCE, + members, + (yyvsp[-4].text)); + } + + members = webidl_node_new(WEBIDL_NODE_TYPE_LIST, members, (yyvsp[-2].node)); + + dictionary_node = webidl_node_find_type_ident( + *webidl_ast, + WEBIDL_NODE_TYPE_DICTIONARY, + (yyvsp[-5].text)); + + if (dictionary_node == NULL) { + /* no existing interface - create one with ident */ + members = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, + members, + (yyvsp[-5].text)); + + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_DICTIONARY, + NULL, + members); + } else { + /* update the existing interface */ + + /* link member node into interfaces_node */ + webidl_node_add(dictionary_node, members); + + (yyval.node) = NULL; /* updating so no need to add a new node */ + } + } +#line 2071 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 28: +#line 492 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; /* empty */ + } +#line 2079 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 29: +#line 497 "webidl-parser.y" /* yacc.c:1646 */ + { + /** \todo handle ExtendedAttributeList */ + (yyval.node) = webidl_node_append((yyvsp[0].node), (yyvsp[-1].node)); + } +#line 2088 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 30: +#line 510 "webidl-parser.y" /* yacc.c:1646 */ + { + struct webidl_node *member; + /* add name */ + member = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, (yyvsp[-1].text)); + /* add type node */ + member = webidl_node_prepend(member, (yyvsp[-2].node)); + + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_ARGUMENT, NULL, member); + } +#line 2102 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 31: +#line 521 "webidl-parser.y" /* yacc.c:1646 */ + { + struct webidl_node *member; + /* add name */ + member = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, (yyvsp[-2].text)); + /* add default */ + member = webidl_node_new(WEBIDL_NODE_TYPE_OPTIONAL, member, (yyvsp[-1].node)); + /* add type node */ + member = webidl_node_prepend(member, (yyvsp[-3].node)); + + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_ARGUMENT, NULL, member); + } +#line 2118 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 32: +#line 549 "webidl-parser.y" /* yacc.c:1646 */ + { + /* extend dictionary with additional members */ + struct webidl_node *members; + struct webidl_node *dictionary_node; + + dictionary_node = webidl_node_find_type_ident( + *webidl_ast, + WEBIDL_NODE_TYPE_DICTIONARY, + (yyvsp[-4].text)); + + members = webidl_node_new(WEBIDL_NODE_TYPE_LIST, NULL, (yyvsp[-2].node)); + + if (dictionary_node == NULL) { + /* doesnt already exist so create it */ + + members = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, + members, + (yyvsp[-4].text)); + + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_DICTIONARY, + NULL, + members); + } else { + /* update the existing dictionary */ + + /* link member node into dictionary node */ + webidl_node_add(dictionary_node, members); + + (yyval.node) = NULL; /* updating so no need to add a new node */ + } + } +#line 2154 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 33: +#line 585 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2162 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 34: +#line 590 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = (yyvsp[0].node); + } +#line 2170 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 36: +#line 601 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_STRING, NULL, (yyvsp[0].text)); + } +#line 2178 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 37: +#line 609 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2186 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 40: +#line 624 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = NULL; + } +#line 2194 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 41: +#line 629 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = (yyvsp[0].text); + } +#line 2202 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 42: +#line 637 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2210 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 48: +#line 667 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2218 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 49: +#line 675 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2226 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 50: +#line 683 "webidl-parser.y" /* yacc.c:1646 */ + { + /* extend interface with implements members */ + struct webidl_node *implements; + struct webidl_node *interface_node; + + + interface_node = webidl_node_find_type_ident(*webidl_ast, + WEBIDL_NODE_TYPE_INTERFACE, + (yyvsp[-3].text)); + + implements = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE_IMPLEMENTS, NULL, (yyvsp[-1].text)); + + if (interface_node == NULL) { + /* interface doesnt already exist so create it */ + + implements = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, implements, (yyvsp[-3].text)); + + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE, NULL, implements); + } else { + /* update the existing interface */ + + /* link implements node into interfaces_node */ + webidl_node_add(interface_node, implements); + + (yyval.node) = NULL; /* updating so no need to add a new node */ + } + } +#line 2258 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 51: +#line 715 "webidl-parser.y" /* yacc.c:1646 */ + { + struct webidl_node *constant; + + constant = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, (yyvsp[-3].text)); + + /* add constant type */ + constant = webidl_node_prepend(constant, (yyvsp[-4].node)); + + /* add constant value */ + constant = webidl_node_prepend(constant, (yyvsp[-1].node)); + + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_CONST, NULL, constant); + } +#line 2276 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 54: +#line 737 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_INT, + NULL, + (void *)(yyvsp[0].value)); + } +#line 2286 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 55: +#line 744 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_NULL, NULL, NULL); + } +#line 2294 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 56: +#line 752 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_BOOL, + NULL, + (void *)true); + } +#line 2304 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 57: +#line 759 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_BOOL, + NULL, + (void *)false); + } +#line 2314 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 58: +#line 769 "webidl-parser.y" /* yacc.c:1646 */ + { + float *value; + value = malloc(sizeof(float)); + *value = strtof((yyvsp[0].text), NULL); + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_FLOAT, + NULL, + value); + } +#line 2327 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 59: +#line 779 "webidl-parser.y" /* yacc.c:1646 */ + { + float *value; + value = malloc(sizeof(float)); + *value = -INFINITY; + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_FLOAT, + NULL, + value); + } +#line 2340 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 60: +#line 789 "webidl-parser.y" /* yacc.c:1646 */ + { + float *value; + value = malloc(sizeof(float)); + *value = INFINITY; + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_FLOAT, + NULL, + value); + } +#line 2353 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 61: +#line 799 "webidl-parser.y" /* yacc.c:1646 */ + { + float *value; + value = malloc(sizeof(float)); + *value = NAN; + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_FLOAT, + NULL, + value); + } +#line 2366 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 62: +#line 812 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = (yyvsp[0].node); + } +#line 2374 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 66: +#line 826 "webidl-parser.y" /* yacc.c:1646 */ + { + /* @todo deal with stringifier */ + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, NULL, (yyvsp[0].node)); + } +#line 2383 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 67: +#line 832 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node)=NULL; + } +#line 2391 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 68: +#line 842 "webidl-parser.y" /* yacc.c:1646 */ + { + struct webidl_node *attribute; + + attribute = (yyvsp[0].node); + + /* deal with inherit modifier */ + if ((yyvsp[-2].isit)) { + attribute = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER, + attribute, + (void *)WEBIDL_TYPE_MODIFIER_INHERIT); + } + + /* deal with readonly modifier */ + if ((yyvsp[-1].isit)) { + attribute = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER, + attribute, + (void *)WEBIDL_TYPE_MODIFIER_READONLY); + } + + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_ATTRIBUTE, + NULL, + attribute); + } +#line 2419 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 69: +#line 871 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = (yyvsp[0].node); + } +#line 2427 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 70: +#line 880 "webidl-parser.y" /* yacc.c:1646 */ + { + struct webidl_node *attribute; + + attribute = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER, + (yyvsp[0].node), (void *)WEBIDL_TYPE_MODIFIER_STATIC); + + /* deal with readonly modifier */ + if ((yyvsp[-1].isit)) { + attribute = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER, + attribute, + (void *)WEBIDL_TYPE_MODIFIER_READONLY); + } + + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_ATTRIBUTE, + NULL, + attribute); + } +#line 2449 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 71: +#line 899 "webidl-parser.y" /* yacc.c:1646 */ + { + struct webidl_node *operation; + + /* add static modifier */ + operation = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER, + (yyvsp[0].node), (void *)WEBIDL_TYPE_MODIFIER_STATIC); + + /* put return type on the operation */ + operation = webidl_node_prepend((yyvsp[-1].node), operation); + + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, + NULL, + operation); + } +#line 2468 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 72: +#line 919 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, (yyvsp[-2].node), (yyvsp[-1].text)); + } +#line 2476 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 75: +#line 934 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("required"); + } +#line 2484 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 76: +#line 943 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.isit) = false; + } +#line 2492 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 77: +#line 948 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.isit) = true; + } +#line 2500 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 78: +#line 959 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.isit) = false; + } +#line 2508 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 79: +#line 964 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.isit) = true; + } +#line 2516 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 80: +#line 973 "webidl-parser.y" /* yacc.c:1646 */ + { + /* put return type on the operation */ + (yyvsp[0].node) = webidl_node_prepend((yyvsp[-1].node), (yyvsp[0].node)); + + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, NULL, (yyvsp[0].node)); + } +#line 2527 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 81: +#line 981 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, NULL, (yyvsp[0].node)); + } +#line 2535 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 82: +#line 989 "webidl-parser.y" /* yacc.c:1646 */ + { + /* put return type on the operation */ + (yyval.node) = webidl_node_prepend((yyvsp[0].node), (yyvsp[-1].node)); + + /* specials */ + (yyval.node) = webidl_node_prepend((yyval.node), (yyvsp[-2].node)); + + /* special */ + (yyval.node) = webidl_node_prepend((yyval.node), (yyvsp[-3].node)); + } +#line 2550 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 83: +#line 1004 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2558 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 84: +#line 1009 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_prepend((yyvsp[0].node), (yyvsp[-1].node)); + } +#line 2566 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 85: +#line 1017 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_SPECIAL, + NULL, + (void *)WEBIDL_TYPE_SPECIAL_GETTER); + } +#line 2576 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 86: +#line 1024 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_SPECIAL, + NULL, + (void *)WEBIDL_TYPE_SPECIAL_SETTER); + } +#line 2586 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 87: +#line 1031 "webidl-parser.y" /* yacc.c:1646 */ + { + /* second edition removed this special but the + * specifications still use it! + */ + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_SPECIAL, + NULL, + (void *)WEBIDL_TYPE_SPECIAL_CREATOR); + } +#line 2599 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 88: +#line 1041 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_SPECIAL, + NULL, + (void *)WEBIDL_TYPE_SPECIAL_DELETER); + } +#line 2609 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 89: +#line 1048 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_SPECIAL, + NULL, + (void *)WEBIDL_TYPE_SPECIAL_LEGACYCALLER); + } +#line 2619 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 90: +#line 1058 "webidl-parser.y" /* yacc.c:1646 */ + { + /* argument list */ + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_LIST, NULL, (yyvsp[-2].node)); + + (yyval.node) = webidl_node_prepend((yyvsp[-4].node), (yyval.node)); /* identifier */ + } +#line 2630 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 91: +#line 1069 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2638 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 92: +#line 1074 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, (yyvsp[0].text)); + } +#line 2646 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 93: +#line 1085 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2654 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 94: +#line 1090 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_append((yyvsp[0].node), (yyvsp[-1].node)); + } +#line 2662 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 95: +#line 1098 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2670 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 96: +#line 1103 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_append((yyvsp[0].node), (yyvsp[-1].node)); + } +#line 2678 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 97: +#line 1112 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = (yyvsp[0].node); + } +#line 2686 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 98: +#line 1120 "webidl-parser.y" /* yacc.c:1646 */ + { + struct webidl_node *argument; + argument = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, (yyvsp[-1].text)); + argument = webidl_node_new(WEBIDL_NODE_TYPE_OPTIONAL, argument, (yyvsp[0].node)); + argument = webidl_node_prepend(argument, (yyvsp[-2].node)); /* add type node */ + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_ARGUMENT, NULL, argument); + } +#line 2698 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 99: +#line 1129 "webidl-parser.y" /* yacc.c:1646 */ + { + struct webidl_node *argument; + argument = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, (yyvsp[0].text)); + argument = webidl_node_prepend(argument, (yyvsp[-1].node)); /* ellipsis node */ + argument = webidl_node_prepend(argument, (yyvsp[-2].node)); /* add type node */ + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_ARGUMENT, NULL, argument); + } +#line 2710 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 102: +#line 1148 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2718 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 103: +#line 1153 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_ELLIPSIS, NULL, NULL); + } +#line 2726 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 104: +#line 1161 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2734 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 105: +#line 1166 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2742 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 106: +#line 1174 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2750 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 107: +#line 1179 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2758 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 111: +#line 1199 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2766 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 112: +#line 1204 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, + (yyvsp[-1].node), + (yyvsp[-2].node)); + } +#line 2776 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 113: +#line 1214 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2784 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 114: +#line 1219 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, + (yyvsp[0].node), + (yyvsp[-1].node)); + } +#line 2794 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 115: +#line 1231 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, (yyvsp[0].node), (yyvsp[-2].node)); + } +#line 2802 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 116: +#line 1236 "webidl-parser.y" /* yacc.c:1646 */ + { + /* @todo should be a WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE_SQUARE */ + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, (yyvsp[0].node), (yyvsp[-2].node)); + } +#line 2811 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 117: +#line 1242 "webidl-parser.y" /* yacc.c:1646 */ + { + /* @todo should be a WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE_CURLY */ + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, (yyvsp[0].node), (yyvsp[-2].node)); + } +#line 2820 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 118: +#line 1248 "webidl-parser.y" /* yacc.c:1646 */ + { + /* Constructor */ + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, + NULL, + strdup("Constructor")); + } +#line 2831 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 119: +#line 1256 "webidl-parser.y" /* yacc.c:1646 */ + { + /* Constructor */ + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, + webidl_node_new(WEBIDL_NODE_TYPE_IDENT, + NULL, + strdup("Constructor")), + webidl_node_new(WEBIDL_NODE_TYPE_LIST, + NULL, + (yyvsp[-1].node))); + } +#line 2846 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 120: +#line 1268 "webidl-parser.y" /* yacc.c:1646 */ + { + /* Constructor */ + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, + webidl_node_new(WEBIDL_NODE_TYPE_IDENT, + NULL, + strdup("NamedConstructor")), + webidl_node_new(WEBIDL_NODE_TYPE_LIST, + webidl_node_new(WEBIDL_NODE_TYPE_IDENT, + NULL, + (yyvsp[-3].text)), + (yyvsp[-1].node))); + } +#line 2863 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 121: +#line 1282 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_append((yyvsp[0].node), + webidl_node_new(WEBIDL_NODE_TYPE_IDENT, + NULL, + (yyvsp[-1].text))); + } +#line 2874 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 122: +#line 1293 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2882 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 123: +#line 1298 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = (yyvsp[0].node); + } +#line 2890 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 124: +#line 1306 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 2898 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 125: +#line 1311 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_prepend( + webidl_node_new(WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, + NULL, + (yyvsp[-2].node)), + (yyvsp[0].node)); + } +#line 2910 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 126: +#line 1320 "webidl-parser.y" /* yacc.c:1646 */ + { + /* @todo should be a WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE_SQUARE */ + (yyval.node) = webidl_node_prepend( + webidl_node_new(WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, + NULL, + (yyvsp[-2].node)), + (yyvsp[0].node)); + } +#line 2923 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 127: +#line 1330 "webidl-parser.y" /* yacc.c:1646 */ + { + /* @todo should be a WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE_CURLY */ + (yyval.node) = webidl_node_prepend( + webidl_node_new(WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, + NULL, + (yyvsp[-2].node)), + (yyvsp[0].node)); + } +#line 2936 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 128: +#line 1340 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_append((yyvsp[0].node), + webidl_node_new(WEBIDL_NODE_TYPE_IDENT, + NULL, + (yyvsp[-1].text))); + } +#line 2947 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 129: +#line 1351 "webidl-parser.y" /* yacc.c:1646 */ + { + /* @todo loosing base info here might break the attribute */ + (yyval.text) = calloc(1, 32); + snprintf((yyval.text), 32, "%ld", (yyvsp[0].value)); + } +#line 2957 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 130: +#line 1358 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = (yyvsp[0].text); + } +#line 2965 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 131: +#line 1363 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = (yyvsp[0].text); + } +#line 2973 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 132: +#line 1368 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = (yyvsp[0].text); + } +#line 2981 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 133: +#line 1373 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = (yyvsp[0].text); + } +#line 2989 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 134: +#line 1378 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("-"); + } +#line 2997 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 135: +#line 1383 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("."); + } +#line 3005 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 136: +#line 1388 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("..."); + } +#line 3013 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 137: +#line 1393 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup(":"); + } +#line 3021 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 138: +#line 1398 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup(";"); + } +#line 3029 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 139: +#line 1403 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("<"); + } +#line 3037 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 140: +#line 1408 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("="); + } +#line 3045 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 141: +#line 1413 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup(">"); + } +#line 3053 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 142: +#line 1418 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("?"); + } +#line 3061 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 143: +#line 1423 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("Date"); + } +#line 3069 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 144: +#line 1428 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("DOMString"); + } +#line 3077 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 145: +#line 1433 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("Infinity"); + } +#line 3085 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 146: +#line 1438 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("NaN"); + } +#line 3093 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 147: +#line 1443 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("any"); + } +#line 3101 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 148: +#line 1448 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("boolean"); + } +#line 3109 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 149: +#line 1453 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("byte"); + } +#line 3117 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 150: +#line 1458 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("double"); + } +#line 3125 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 151: +#line 1463 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("false"); + } +#line 3133 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 152: +#line 1468 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("float"); + } +#line 3141 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 153: +#line 1473 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("long"); + } +#line 3149 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 154: +#line 1478 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("null"); + } +#line 3157 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 155: +#line 1483 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("object"); + } +#line 3165 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 156: +#line 1488 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("octet"); + } +#line 3173 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 157: +#line 1493 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("or"); + } +#line 3181 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 158: +#line 1498 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("optional"); + } +#line 3189 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 159: +#line 1503 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("sequence"); + } +#line 3197 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 160: +#line 1508 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("short"); + } +#line 3205 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 161: +#line 1513 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("true"); + } +#line 3213 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 162: +#line 1518 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("unsigned"); + } +#line 3221 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 163: +#line 1523 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("void"); + } +#line 3229 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 164: +#line 1528 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = (yyvsp[0].text); + } +#line 3237 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 165: +#line 1538 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("attribute"); + } +#line 3245 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 166: +#line 1543 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("callback"); + } +#line 3253 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 167: +#line 1548 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("const"); + } +#line 3261 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 168: +#line 1553 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("creator"); + } +#line 3269 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 169: +#line 1558 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("deleter"); + } +#line 3277 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 170: +#line 1563 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("dictionary"); + } +#line 3285 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 171: +#line 1568 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("enum"); + } +#line 3293 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 172: +#line 1573 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("exception"); + } +#line 3301 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 173: +#line 1578 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("getter"); + } +#line 3309 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 174: +#line 1583 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("implements"); + } +#line 3317 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 175: +#line 1588 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("inherit"); + } +#line 3325 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 176: +#line 1593 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("interface"); + } +#line 3333 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 177: +#line 1598 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("iterable"); + } +#line 3341 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 178: +#line 1603 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("legacycaller"); + } +#line 3349 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 179: +#line 1608 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("legacyiterable"); + } +#line 3357 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 180: +#line 1613 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("partial"); + } +#line 3365 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 181: +#line 1618 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("required"); + } +#line 3373 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 182: +#line 1623 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("setter"); + } +#line 3381 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 183: +#line 1628 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("static"); + } +#line 3389 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 184: +#line 1633 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("stringifier"); + } +#line 3397 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 185: +#line 1638 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("typedef"); + } +#line 3405 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 186: +#line 1643 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup("unrestricted"); + } +#line 3413 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 187: +#line 1651 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = (yyvsp[0].text); + } +#line 3421 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 188: +#line 1656 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.text) = strdup(","); + } +#line 3429 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 189: +#line 1664 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, (yyvsp[0].node)); + } +#line 3437 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 190: +#line 1669 "webidl-parser.y" /* yacc.c:1646 */ + { + /* todo handle suffix */ + (yyval.node) = (yyvsp[-1].node); + } +#line 3446 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 192: +#line 1680 "webidl-parser.y" /* yacc.c:1646 */ + { + /* todo deal with TypeSuffixStartingWithArray */ + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, + NULL, (void *)WEBIDL_TYPE_ANY); + } +#line 3456 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 193: +#line 1690 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_prepend((yyvsp[-4].node), webidl_node_prepend((yyvsp[-2].node), (yyvsp[-1].node))); + } +#line 3464 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 194: +#line 1698 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, (yyvsp[0].node)); + } +#line 3472 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 195: +#line 1703 "webidl-parser.y" /* yacc.c:1646 */ + { + /* todo handle suffix */ + (yyval.node) = (yyvsp[-1].node); + } +#line 3481 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 196: +#line 1709 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 3489 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 197: +#line 1717 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 3497 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 198: +#line 1722 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_prepend((yyvsp[-1].node), (yyvsp[0].node)); + } +#line 3505 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 199: +#line 1733 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_prepend((yyvsp[-1].node), (yyvsp[0].node)); + } +#line 3513 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 200: +#line 1738 "webidl-parser.y" /* yacc.c:1646 */ + { + /* second edition adds promise types */ + (yyval.node) = webidl_node_prepend((yyvsp[-1].node), (yyvsp[0].node)); + } +#line 3522 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 201: +#line 1744 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, (yyvsp[0].node), (void *)WEBIDL_TYPE_STRING); + } +#line 3530 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 202: +#line 1749 "webidl-parser.y" /* yacc.c:1646 */ + { + struct webidl_node *type; + type = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, (yyvsp[0].node), (void *)WEBIDL_TYPE_USER); + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, type, (yyvsp[-1].text)); + } +#line 3540 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 203: +#line 1756 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, (yyvsp[-2].node), (void *)WEBIDL_TYPE_SEQUENCE); + } +#line 3548 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 204: +#line 1761 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, (yyvsp[0].node), (void *)WEBIDL_TYPE_OBJECT); + } +#line 3556 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 205: +#line 1766 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, (yyvsp[0].node), (void *)WEBIDL_TYPE_DATE); + } +#line 3564 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 206: +#line 1774 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, (yyvsp[-1].node)); + } +#line 3572 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 207: +#line 1779 "webidl-parser.y" /* yacc.c:1646 */ + { + struct webidl_node *type; + type = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_USER); + type = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, type, (yyvsp[-1].text)); + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, type); + } +#line 3583 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 210: +#line 1795 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_BOOL); + } +#line 3591 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 211: +#line 1800 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_BYTE); + } +#line 3599 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 212: +#line 1805 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_OCTET); + } +#line 3607 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 213: +#line 1813 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER, + (yyvsp[0].node), + (void *)WEBIDL_TYPE_MODIFIER_UNRESTRICTED); + } +#line 3617 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 215: +#line 1825 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_FLOAT); + } +#line 3625 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 216: +#line 1830 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_DOUBLE); + } +#line 3633 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 217: +#line 1838 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER, + (yyvsp[0].node), + (void *)WEBIDL_TYPE_MODIFIER_UNSIGNED); + } +#line 3643 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 219: +#line 1850 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_SHORT); + } +#line 3651 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 220: +#line 1855 "webidl-parser.y" /* yacc.c:1646 */ + { + if ((yyvsp[0].isit)) { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_LONGLONG); + } else { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_LONG); + } + } +#line 3663 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 221: +#line 1867 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.isit) = false; + } +#line 3671 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 222: +#line 1872 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.isit) = true; + } +#line 3679 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 223: +#line 1880 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 3687 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 224: +#line 1888 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 3695 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 225: +#line 1893 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_ARRAY, (yyvsp[0].node), NULL); + } +#line 3703 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 226: +#line 1898 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_NULLABLE, (yyvsp[0].node), NULL); + } +#line 3711 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 227: +#line 1906 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = NULL; + } +#line 3719 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 228: +#line 1911 "webidl-parser.y" /* yacc.c:1646 */ + { + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_ARRAY, (yyvsp[0].node), NULL); + } +#line 3727 "webidl-parser.c" /* yacc.c:1646 */ + break; + + case 232: +#line 1928 "webidl-parser.y" /* yacc.c:1646 */ + { + struct webidl_node *type; + type = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_VOID); + (yyval.node) = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, type); + } +#line 3737 "webidl-parser.c" /* yacc.c:1646 */ + break; + + +#line 3741 "webidl-parser.c" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + *++yylsp = yyloc; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (&yylloc, webidl_ast, YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (&yylloc, webidl_ast, yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + yyerror_range[1] = yylloc; + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, &yylloc, webidl_ast); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + yyerror_range[1] = yylsp[1-yylen]; + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + yyerror_range[1] = *yylsp; + yydestruct ("Error: popping", + yystos[yystate], yyvsp, yylsp, webidl_ast); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + yyerror_range[2] = yylloc; + /* Using YYLLOC is tempting, but would change the location of + the lookahead. YYLOC is available though. */ + YYLLOC_DEFAULT (yyloc, yyerror_range, 2); + *++yylsp = yyloc; + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (&yylloc, webidl_ast, YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, &yylloc, webidl_ast); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, yylsp, webidl_ast); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} +#line 1936 "webidl-parser.y" /* yacc.c:1906 */ + diff --git a/pkg/netsurf/nsgenbind/webidl-parser.h b/pkg/netsurf/nsgenbind/webidl-parser.h new file mode 100644 index 00000000..106389b2 --- /dev/null +++ b/pkg/netsurf/nsgenbind/webidl-parser.h @@ -0,0 +1,161 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison interface for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +#ifndef YY_WEBIDL_WEBIDL_PARSER_H_INCLUDED +# define YY_WEBIDL_WEBIDL_PARSER_H_INCLUDED +/* Debug traces. */ +#ifndef WEBIDL_DEBUG +# if defined YYDEBUG +#if YYDEBUG +# define WEBIDL_DEBUG 1 +# else +# define WEBIDL_DEBUG 0 +# endif +# else /* ! defined YYDEBUG */ +# define WEBIDL_DEBUG 1 +# endif /* ! defined YYDEBUG */ +#endif /* ! defined WEBIDL_DEBUG */ +#if WEBIDL_DEBUG +extern int webidl_debug; +#endif + +/* Token type. */ +#ifndef WEBIDL_TOKENTYPE +# define WEBIDL_TOKENTYPE + enum webidl_tokentype + { + TOK_ANY = 258, + TOK_ATTRIBUTE = 259, + TOK_BOOLEAN = 260, + TOK_BYTE = 261, + TOK_CALLBACK = 262, + TOK_CONST = 263, + TOK_CONSTRUCTOR = 264, + TOK_CREATOR = 265, + TOK_DATE = 266, + TOK_DELETER = 267, + TOK_DICTIONARY = 268, + TOK_DOUBLE = 269, + TOK_ELLIPSIS = 270, + TOK_ENUM = 271, + TOK_EOL = 272, + TOK_EXCEPTION = 273, + TOK_FALSE = 274, + TOK_FLOAT = 275, + TOK_GETRAISES = 276, + TOK_GETTER = 277, + TOK_IMPLEMENTS = 278, + TOK_IN = 279, + TOK_INFINITY = 280, + TOK_INHERIT = 281, + TOK_INTERFACE = 282, + TOK_ITERABLE = 283, + TOK_LEGACYCALLER = 284, + TOK_LEGACYITERABLE = 285, + TOK_LONG = 286, + TOK_MODULE = 287, + TOK_NAN = 288, + TOK_NATIVE = 289, + TOK_NAMEDCONSTRUCTOR = 290, + TOK_NULL_LITERAL = 291, + TOK_OBJECT = 292, + TOK_OCTET = 293, + TOK_OMITTABLE = 294, + TOK_OPTIONAL = 295, + TOK_OR = 296, + TOK_PARTIAL = 297, + TOK_PROMISE = 298, + TOK_RAISES = 299, + TOK_READONLY = 300, + TOK_REQUIRED = 301, + TOK_SETRAISES = 302, + TOK_SETTER = 303, + TOK_SEQUENCE = 304, + TOK_SHORT = 305, + TOK_STATIC = 306, + TOK_STRING = 307, + TOK_STRINGIFIER = 308, + TOK_TRUE = 309, + TOK_TYPEDEF = 310, + TOK_UNRESTRICTED = 311, + TOK_UNSIGNED = 312, + TOK_VOID = 313, + TOK_POUND_SIGN = 314, + TOK_IDENTIFIER = 315, + TOK_INT_LITERAL = 316, + TOK_FLOAT_LITERAL = 317, + TOK_STRING_LITERAL = 318, + TOK_OTHER_LITERAL = 319, + TOK_JAVADOC = 320 + }; +#endif + +/* Value type. */ +#if ! defined WEBIDL_STYPE && ! defined WEBIDL_STYPE_IS_DECLARED + +union WEBIDL_STYPE +{ +#line 56 "webidl-parser.y" /* yacc.c:1909 */ + + int attr; + long value; + bool isit; + char* text; + struct webidl_node *node; + +#line 136 "webidl-parser.h" /* yacc.c:1909 */ +}; + +typedef union WEBIDL_STYPE WEBIDL_STYPE; +# define WEBIDL_STYPE_IS_TRIVIAL 1 +# define WEBIDL_STYPE_IS_DECLARED 1 +#endif + +/* Location type. */ +#if ! defined WEBIDL_LTYPE && ! defined WEBIDL_LTYPE_IS_DECLARED +typedef struct WEBIDL_LTYPE WEBIDL_LTYPE; +struct WEBIDL_LTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +}; +# define WEBIDL_LTYPE_IS_DECLARED 1 +# define WEBIDL_LTYPE_IS_TRIVIAL 1 +#endif + + + +int webidl_parse (struct webidl_node **webidl_ast); + +#endif /* !YY_WEBIDL_WEBIDL_PARSER_H_INCLUDED */ diff --git a/pkg/netsurf/patch/0001-Remove-non-reproducible-info-from-about-page.patch b/pkg/netsurf/patch/0001-Remove-non-reproducible-info-from-about-page.patch new file mode 100644 index 00000000..98663d3a --- /dev/null +++ b/pkg/netsurf/patch/0001-Remove-non-reproducible-info-from-about-page.patch @@ -0,0 +1,40 @@ +From ba5389200ff60bb5494efe503f1f1fc165383a85 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Fri, 23 Dec 2016 14:41:52 -0800 +Subject: [PATCH] Remove non-reproducible info from about page + +--- + content/fetchers/about.c | 17 ----------------- + 1 file changed, 17 deletions(-) + +diff --git a/content/fetchers/about.c b/content/fetchers/about.c +index 4d14020b0..aff21c81a 100644 +--- a/content/fetchers/about.c ++++ b/content/fetchers/about.c +@@ -477,23 +477,6 @@ static bool fetch_about_testament_handler(struct fetch_about_context *ctx) + if (fetch_about_send_callback(&msg, ctx)) + goto fetch_about_testament_handler_aborted; + +- +- slen = snprintf(buffer, sizeof buffer, +- "Built by %s (%s) from %s at revision %s on %s\n\n", +- GECOS, USERNAME, WT_BRANCHPATH, WT_REVID, WT_COMPILEDATE); +- +- msg.data.header_or_data.len = slen; +- if (fetch_about_send_callback(&msg, ctx)) +- goto fetch_about_testament_handler_aborted; +- +- slen = snprintf(buffer, sizeof buffer, +- "Built on %s in %s\n\n", +- WT_HOSTNAME, WT_ROOT); +- +- msg.data.header_or_data.len = slen; +- if (fetch_about_send_callback(&msg, ctx)) +- goto fetch_about_testament_handler_aborted; +- + if (WT_MODIFIED > 0) { + slen = snprintf(buffer, sizeof buffer, + "Working tree has %d modification%s\n\n", +-- +2.11.0 + diff --git a/pkg/netsurf/patch/0002-framebuffer-Set-default-backend-to-wayland.patch b/pkg/netsurf/patch/0002-framebuffer-Set-default-backend-to-wayland.patch new file mode 100644 index 00000000..4b63ac8e --- /dev/null +++ b/pkg/netsurf/patch/0002-framebuffer-Set-default-backend-to-wayland.patch @@ -0,0 +1,25 @@ +From ecd460198f101721260d770a6dcc52922f643a62 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Fri, 23 Dec 2016 15:13:31 -0800 +Subject: [PATCH] framebuffer: Set default backend to wayland + +--- + frontends/framebuffer/gui.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/frontends/framebuffer/gui.c b/frontends/framebuffer/gui.c +index 4d4c7334f..2e819e6fa 100644 +--- a/frontends/framebuffer/gui.c ++++ b/frontends/framebuffer/gui.c +@@ -466,7 +466,7 @@ process_cmdline(int argc, char** argv) + + LOG("argc %d, argv %p", argc, argv); + +- fename = "sdl"; ++ fename = "wayland"; + febpp = 32; + + fewidth = nsoption_int(window_width); +-- +2.11.0 + diff --git a/pkg/netsurf/patch/0003-framebuffer-Fix-cookie-defaults.patch b/pkg/netsurf/patch/0003-framebuffer-Fix-cookie-defaults.patch new file mode 100644 index 00000000..17bc12f5 --- /dev/null +++ b/pkg/netsurf/patch/0003-framebuffer-Fix-cookie-defaults.patch @@ -0,0 +1,100 @@ +From 8a15a5505db85870f340c61fea1db3da16fde039 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Sat, 24 Dec 2016 16:57:34 -0800 +Subject: [PATCH] framebuffer: Fix cookie defaults + +--- + frontends/framebuffer/gui.c | 48 +++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 46 insertions(+), 2 deletions(-) + +diff --git a/frontends/framebuffer/gui.c b/frontends/framebuffer/gui.c +index 2e819e6fa..e176ac9e4 100644 +--- a/frontends/framebuffer/gui.c ++++ b/frontends/framebuffer/gui.c +@@ -31,6 +31,7 @@ + + #include "utils/utils.h" + #include "utils/nsoption.h" ++#include "utils/file.h" + #include "utils/filepath.h" + #include "utils/log.h" + #include "utils/messages.h" +@@ -61,6 +62,7 @@ + fbtk_widget_t *fbtk; + + static bool fb_complete = false; ++static char *fb_data_home; + + struct gui_window *input_window = NULL; + struct gui_window *search_current_window; +@@ -527,9 +529,18 @@ process_cmdline(int argc, char** argv) + */ + static nserror set_defaults(struct nsoption_s *defaults) + { ++ char *fname; ++ + /* Set defaults for absent option strings */ +- nsoption_setnull_charp(cookie_file, strdup("~/.netsurf/Cookies")); +- nsoption_setnull_charp(cookie_jar, strdup("~/.netsurf/Cookies")); ++ fname = NULL; ++ netsurf_mkpath(&fname, NULL, 2, fb_data_home, "Cookies"); ++ if (fname != NULL) ++ nsoption_setnull_charp(cookie_file, fname); ++ ++ fname = NULL; ++ netsurf_mkpath(&fname, NULL, 2, fb_data_home, "Cookies"); ++ if (fname != NULL) ++ nsoption_setnull_charp(cookie_jar, fname); + + if (nsoption_charp(cookie_file) == NULL || + nsoption_charp(cookie_jar) == NULL) { +@@ -2076,6 +2087,34 @@ static struct gui_misc_table framebuffer_misc_table = { + .quit = gui_quit, + }; + ++static nserror get_data_home(char **data_home_out) ++{ ++ nserror ret; ++ char *xdg_data_home, *data_home, *home; ++ ++ xdg_data_home = getenv("XDG_DATA_HOME"); ++ if ((xdg_data_home == NULL) || (*xdg_data_home == '\0')) { ++ home = getenv("HOME"); ++ if (home == NULL) ++ return NSERROR_NOT_DIRECTORY; ++ ret = netsurf_mkpath(&data_home, NULL, 5, home, ".local", "share", "netsurf", "/"); ++ } else { ++ ret = netsurf_mkpath(&data_home, NULL, 3, xdg_data_home, "netsurf", "/"); ++ } ++ if (ret != NSERROR_OK) ++ return ret; ++ ++ ret = netsurf_mkdir_all(data_home); ++ if (ret != NSERROR_OK) { ++ free(data_home); ++ return ret; ++ } ++ data_home[strlen(data_home) - 1] = 0; ++ *data_home_out = data_home; ++ ++ return NSERROR_OK; ++} ++ + /** Entry point from OS. + * + * /param argc The number of arguments in the string vector. +@@ -2106,6 +2145,11 @@ main(int argc, char** argv) + die("NetSurf operation table failed registration"); + } + ++ ret = get_data_home(&fb_data_home); ++ if (ret != NSERROR_OK) { ++ die("Failed to get home data directory"); ++ } ++ + respaths = fb_init_resource(NETSURF_FB_RESPATH":"NETSURF_FB_FONTPATH); + + /* initialise logging. Not fatal if it fails but not much we +-- +2.11.0 + diff --git a/pkg/netsurf/patch/0004-framebuffer-Fix-font-layout-function-return-values.patch b/pkg/netsurf/patch/0004-framebuffer-Fix-font-layout-function-return-values.patch new file mode 100644 index 00000000..accd9cc0 --- /dev/null +++ b/pkg/netsurf/patch/0004-framebuffer-Fix-font-layout-function-return-values.patch @@ -0,0 +1,112 @@ +From 507e82825f659742b76df9179e59975b3bd55b30 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Sun, 25 Dec 2016 00:23:34 -0800 +Subject: [PATCH] framebuffer: Fix font layout function return values + +The return type is nserror, so they should return NSERROR_OK, not true. +--- + frontends/framebuffer/font_freetype.c | 10 +++++----- + frontends/framebuffer/font_internal.c | 10 +++++----- + 2 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/frontends/framebuffer/font_freetype.c b/frontends/framebuffer/font_freetype.c +index 9235ad476..42be6d443 100644 +--- a/frontends/framebuffer/font_freetype.c ++++ b/frontends/framebuffer/font_freetype.c +@@ -445,7 +445,7 @@ fb_font_width(const plot_font_style_t *fstyle, + *width += glyph->advance.x >> 16; + } + +- return true; ++ return NSERROR_OK; + } + + +@@ -481,7 +481,7 @@ fb_font_position(const plot_font_style_t *fstyle, + *actual_x = prev_x; + + *char_offset = nxtchr; +- return true; ++ return NSERROR_OK; + } + + +@@ -494,7 +494,7 @@ fb_font_position(const plot_font_style_t *fstyle, + * \param x width available + * \param char_offset updated to offset in string of actual_x, [1..length] + * \param actual_x updated to x coordinate of character closest to x +- * \return true on success, false on error and error reported ++ * \return NSERROR_OK on success or error code on failure + * + * On exit, char_offset indicates first character after split point. + * +@@ -537,7 +537,7 @@ fb_font_split(const plot_font_style_t *fstyle, + * found a space; return previous space */ + *actual_x = last_space_x; + *char_offset = last_space_idx; +- return true; ++ return NSERROR_OK; + } + + nxtchr = utf8_next(string, length, nxtchr); +@@ -545,7 +545,7 @@ fb_font_split(const plot_font_style_t *fstyle, + + *char_offset = nxtchr; + +- return true; ++ return NSERROR_OK; + } + + static struct gui_layout_table layout_table = { +diff --git a/frontends/framebuffer/font_internal.c b/frontends/framebuffer/font_internal.c +index 9164a29db..a9054098f 100644 +--- a/frontends/framebuffer/font_internal.c ++++ b/frontends/framebuffer/font_internal.c +@@ -364,7 +364,7 @@ fb_font_width(const plot_font_style_t *fstyle, + } + + *width *= fb_get_font_size(fstyle); +- return true; ++ return NSERROR_OK; + } + + +@@ -397,7 +397,7 @@ fb_font_position(const plot_font_style_t *fstyle, + *actual_x = x_pos; + + *char_offset = nxtchr; +- return true; ++ return NSERROR_OK; + } + + +@@ -410,7 +410,7 @@ fb_font_position(const plot_font_style_t *fstyle, + * \param x width available + * \param char_offset updated to offset in string of actual_x, [1..length] + * \param actual_x updated to x coordinate of character closest to x +- * \return true on success, false on error and error reported ++ * \return NSERROR_OK on success or error code on failure + * + * On exit, char_offset indicates first character after split point. + * +@@ -455,7 +455,7 @@ fb_font_split(const plot_font_style_t *fstyle, + * found a space; return previous space */ + *actual_x = last_space_x; + *char_offset = last_space_idx; +- return true; ++ return NSERROR_OK; + } + + nxtchr = utf8_next(string, length, nxtchr); +@@ -463,7 +463,7 @@ fb_font_split(const plot_font_style_t *fstyle, + + *char_offset = nxtchr; + +- return true; ++ return NSERROR_OK; + } + + +-- +2.11.0 + diff --git a/pkg/netsurf/patch/0005-framebuffer-Use-XKB-key-events.patch b/pkg/netsurf/patch/0005-framebuffer-Use-XKB-key-events.patch new file mode 100644 index 00000000..e79e4f4c --- /dev/null +++ b/pkg/netsurf/patch/0005-framebuffer-Use-XKB-key-events.patch @@ -0,0 +1,558 @@ +From e8a794e1ee7422613be28dbe6263b5877d9bf840 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Sun, 25 Dec 2016 14:46:31 -0800 +Subject: [PATCH] framebuffer: Use XKB key events + +--- + frontends/framebuffer/fbtk/event.c | 86 +------------ + frontends/framebuffer/fbtk/text.c | 83 ++++--------- + frontends/framebuffer/gui.c | 240 +++++++++++++++---------------------- + 3 files changed, 128 insertions(+), 281 deletions(-) + +diff --git a/frontends/framebuffer/fbtk/event.c b/frontends/framebuffer/fbtk/event.c +index a48e63809..29eed3286 100644 +--- a/frontends/framebuffer/fbtk/event.c ++++ b/frontends/framebuffer/fbtk/event.c +@@ -224,6 +224,11 @@ fbtk_event(fbtk_widget_t *root, nsfb_event_t *event, int timeout) + } + break; + ++ case NSFB_EVENT_XKB_KEY_DOWN: ++ case NSFB_EVENT_XKB_KEY_UP: ++ fbtk_input(root, event); ++ break; ++ + case NSFB_EVENT_CONTROL: + unused = true; + break; +@@ -261,87 +266,6 @@ fbtk_event(fbtk_widget_t *root, nsfb_event_t *event, int timeout) + return unused; + } + +-static int keymap[] = { +- /* 0 1 2 3 4 5 6 7 8 9 */ +- -1, -1, -1, -1, -1, -1, -1, -1, 8, 9, /* 0 - 9 */ +- -1, -1, -1, 13, -1, -1, -1, -1, -1, -1, /* 10 - 19 */ +- -1, -1, -1, -1, -1, -1, -1, 27, -1, -1, /* 20 - 29 */ +- -1, -1, ' ', '!', '"', '#', '$', -1, '&','\'', /* 30 - 39 */ +- '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', /* 40 - 49 */ +- '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', /* 50 - 59 */ +- '<', '=', '>', '?', '@', -1, -1, -1, -1, -1, /* 60 - 69 */ +- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 70 - 79 */ +- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 80 - 89 */ +- -1, '[','\\', ']', '~', '_', '`', 'a', 'b', 'c', /* 90 - 99 */ +- 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', /* 100 - 109 */ +- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', /* 110 - 119 */ +- 'x', 'y', 'z', -1, -1, -1, -1, -1, -1, -1, /* 120 - 129 */ +-}; +- +-static int sh_keymap[] = { +- /* 0 1 2 3 4 5 6 7 8 9 */ +- -1, -1, -1, -1, -1, -1, -1, -1, 8, 9, /* 0 - 9 */ +- -1, -1, -1, 13, -1, -1, -1, -1, -1, -1, /* 10 - 19 */ +- -1, -1, -1, -1, -1, -1, -1, 27, -1, -1, /* 20 - 29 */ +- -1, -1, ' ', '!', '"', '~', '$', -1, '&', '@', /* 30 - 39 */ +- '(', ')', '*', '+', '<', '_', '>', '?', ')', '!', /* 40 - 49 */ +- '"', 243, '$', '%', '^', '&', '*', '(', ';', ':', /* 50 - 59 */ +- '<', '+', '>', '?', '@', -1, -1, -1, -1, -1, /* 60 - 69 */ +- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 70 - 79 */ +- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 80 - 89 */ +- -1, '{', '|', '}', '~', '_', 254, 'A', 'B', 'C', /* 90 - 99 */ +- 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', /* 100 - 109 */ +- 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', /* 110 - 119 */ +- 'X', 'Y', 'Z', -1, -1, -1, -1, -1, -1, -1, /* 120 - 129 */ +-}; +- +- +-/* exported function documented in fbtk.h */ +-int +-fbtk_keycode_to_ucs4(int code, fbtk_modifier_type mods) +-{ +- int ucs4 = -1; +- +- if (mods & FBTK_MOD_LSHIFT || mods & FBTK_MOD_RSHIFT) { +- if ((code >= 0) && (code < (int) NOF_ELEMENTS(sh_keymap))) +- ucs4 = sh_keymap[code]; +- +- } else if (mods == FBTK_MOD_CLEAR) { +- if ((code >= 0) && (code < (int) NOF_ELEMENTS(keymap))) +- ucs4 = keymap[code]; +- +- } else if (mods & FBTK_MOD_LCTRL || mods & FBTK_MOD_RCTRL) { +- switch (code) { +- case NSFB_KEY_a: +- ucs4 = NS_KEY_SELECT_ALL; +- break; +- +- case NSFB_KEY_c: +- ucs4 = NS_KEY_COPY_SELECTION; +- break; +- +- case NSFB_KEY_u: +- ucs4 = NS_KEY_DELETE_LINE; +- break; +- +- case NSFB_KEY_v: +- ucs4 = NS_KEY_PASTE; +- break; +- +- case NSFB_KEY_x: +- ucs4 = NS_KEY_CUT_SELECTION; +- break; +- +- case NSFB_KEY_z: +- ucs4 = NS_KEY_CLEAR_SELECTION; +- break; +- default: +- break; +- } +- } +- return ucs4; +-} +- + /* + * Local Variables: + * c-basic-offset:8 +diff --git a/frontends/framebuffer/fbtk/text.c b/frontends/framebuffer/fbtk/text.c +index 00dcba491..95333a52f 100644 +--- a/frontends/framebuffer/fbtk/text.c ++++ b/frontends/framebuffer/fbtk/text.c +@@ -26,6 +26,7 @@ + #include <libnsfb_plot.h> + #include <libnsfb_plot_util.h> + #include <libnsfb_event.h> ++#include <xkbcommon/xkbcommon.h> + + #include "utils/log.h" + #include "netsurf/browser_window.h" +@@ -287,13 +288,14 @@ fb_text_input_remove_caret_cb(fbtk_widget_t *widget) + static int + text_input(fbtk_widget_t *widget, fbtk_callback_info *cbi) + { +- int value; +- static fbtk_modifier_type modifier = FBTK_MOD_CLEAR; ++ xkb_keysym_t sym; ++ enum nsfb_mod_e mods; + char *temp; + plot_font_style_t font_style; + int fh; + int border; + bool caret_moved = false; ++ uint32_t key; + + fb_text_font_style(widget, &fh, &border, &font_style); + +@@ -305,34 +307,14 @@ text_input(fbtk_widget_t *widget, fbtk_callback_info *cbi) + return 0; + } + +- value = cbi->event->value.keycode; +- +- if (cbi->event->type != NSFB_EVENT_KEY_DOWN) { +- switch (value) { +- case NSFB_KEY_RSHIFT: +- modifier &= ~FBTK_MOD_RSHIFT; +- break; +- +- case NSFB_KEY_LSHIFT: +- modifier &= ~FBTK_MOD_LSHIFT; +- break; +- +- case NSFB_KEY_RCTRL: +- modifier &= ~FBTK_MOD_RCTRL; +- break; +- +- case NSFB_KEY_LCTRL: +- modifier &= ~FBTK_MOD_LCTRL; +- break; +- +- default: +- break; +- } ++ if (cbi->event->type != NSFB_EVENT_XKB_KEY_DOWN) + return 0; +- } + +- switch (value) { +- case NSFB_KEY_BACKSPACE: ++ sym = cbi->event->value.xkb.sym; ++ mods = cbi->event->value.xkb.mod; ++ ++ switch (sym) { ++ case XKB_KEY_BackSpace: + if (widget->u.text.idx <= 0) + break; + memmove(widget->u.text.text + widget->u.text.idx - 1, +@@ -348,13 +330,13 @@ text_input(fbtk_widget_t *widget, fbtk_callback_info *cbi) + caret_moved = true; + break; + +- case NSFB_KEY_RETURN: ++ case XKB_KEY_Return: + widget->u.text.enter(widget->u.text.pw, widget->u.text.text); + break; + +- case NSFB_KEY_RIGHT: ++ case XKB_KEY_Right: + if (widget->u.text.idx < widget->u.text.len) { +- if (modifier == FBTK_MOD_CLEAR) ++ if (mods == 0) + widget->u.text.idx++; + else + widget->u.text.idx = widget->u.text.len; +@@ -363,9 +345,9 @@ text_input(fbtk_widget_t *widget, fbtk_callback_info *cbi) + } + break; + +- case NSFB_KEY_LEFT: ++ case XKB_KEY_Left: + if (widget->u.text.idx > 0) { +- if (modifier == FBTK_MOD_CLEAR) ++ if (mods == 0) + widget->u.text.idx--; + else + widget->u.text.idx = 0; +@@ -374,34 +356,18 @@ text_input(fbtk_widget_t *widget, fbtk_callback_info *cbi) + } + break; + +- case NSFB_KEY_PAGEUP: +- case NSFB_KEY_PAGEDOWN: +- case NSFB_KEY_UP: +- case NSFB_KEY_DOWN: ++ case XKB_KEY_Page_Up: ++ case XKB_KEY_Page_Down: ++ case XKB_KEY_Up: ++ case XKB_KEY_Down: + /* Not handling any of these correctly yet, but avoid putting + * charcters in the text widget when they're pressed. */ + break; + +- case NSFB_KEY_RSHIFT: +- modifier |= FBTK_MOD_RSHIFT; +- break; +- +- case NSFB_KEY_LSHIFT: +- modifier |= FBTK_MOD_LSHIFT; +- break; +- +- case NSFB_KEY_RCTRL: +- modifier |= FBTK_MOD_RCTRL; +- break; +- +- case NSFB_KEY_LCTRL: +- modifier |= FBTK_MOD_LCTRL; +- break; +- + default: +- if (modifier & FBTK_MOD_LCTRL || modifier & FBTK_MOD_RCTRL) { ++ if (mods & NSFB_MOD_CTRL) { + /* CTRL pressed, don't enter any text */ +- if (value == NSFB_KEY_u) { ++ if (sym == XKB_KEY_u) { + /* CTRL+U: clear writable */ + widget->u.text.idx = 0; + widget->u.text.len = 0; +@@ -412,6 +378,10 @@ text_input(fbtk_widget_t *widget, fbtk_callback_info *cbi) + break; + } + ++ key = xkb_keysym_to_utf32(sym); ++ if (key == 0) ++ break; ++ + /* allow for new character and null */ + temp = realloc(widget->u.text.text, widget->u.text.len + 2); + if (temp == NULL) { +@@ -422,8 +392,7 @@ text_input(fbtk_widget_t *widget, fbtk_callback_info *cbi) + memmove(widget->u.text.text + widget->u.text.idx + 1, + widget->u.text.text + widget->u.text.idx, + widget->u.text.len - widget->u.text.idx); +- widget->u.text.text[widget->u.text.idx] = +- fbtk_keycode_to_ucs4(value, modifier); ++ widget->u.text.text[widget->u.text.idx] = key; + widget->u.text.idx++; + widget->u.text.len++; + widget->u.text.text[widget->u.text.len] = '\0'; +diff --git a/frontends/framebuffer/gui.c b/frontends/framebuffer/gui.c +index e176ac9e4..6bf5152c0 100644 +--- a/frontends/framebuffer/gui.c ++++ b/frontends/framebuffer/gui.c +@@ -28,6 +28,7 @@ + #include <libnsfb.h> + #include <libnsfb_plot.h> + #include <libnsfb_event.h> ++#include <xkbcommon/xkbcommon.h> + + #include "utils/utils.h" + #include "utils/nsoption.h" +@@ -831,170 +832,123 @@ static int + fb_browser_window_input(fbtk_widget_t *widget, fbtk_callback_info *cbi) + { + struct gui_window *gw = cbi->context; +- static fbtk_modifier_type modifier = FBTK_MOD_CLEAR; +- int ucs4 = -1; ++ xkb_keysym_t sym = cbi->event->value.xkb.sym; ++ enum nsfb_mod_e mods = cbi->event->value.xkb.mod; ++ uint32_t key; + +- LOG("got value %d", cbi->event->value.keycode); +- +- switch (cbi->event->type) { +- case NSFB_EVENT_KEY_DOWN: +- switch (cbi->event->value.keycode) { +- +- case NSFB_KEY_DELETE: +- browser_window_key_press(gw->bw, NS_KEY_DELETE_RIGHT); +- break; ++ if (cbi->event->type != NSFB_EVENT_XKB_KEY_DOWN) ++ return 0; + +- case NSFB_KEY_PAGEUP: +- if (browser_window_key_press(gw->bw, +- NS_KEY_PAGE_UP) == false) +- widget_scroll_y(gw, -fbtk_get_height( +- gw->browser), false); +- break; ++ LOG("got value %d", cbi->event->value.xkb.sym); + +- case NSFB_KEY_PAGEDOWN: +- if (browser_window_key_press(gw->bw, +- NS_KEY_PAGE_DOWN) == false) +- widget_scroll_y(gw, fbtk_get_height( +- gw->browser), false); +- break; ++ switch (sym) { ++ case XKB_KEY_Delete: ++ browser_window_key_press(gw->bw, NS_KEY_DELETE_RIGHT); ++ break; + +- case NSFB_KEY_RIGHT: +- if (modifier & FBTK_MOD_RCTRL || +- modifier & FBTK_MOD_LCTRL) { +- /* CTRL held */ +- if (browser_window_key_press(gw->bw, +- NS_KEY_LINE_END) == false) +- widget_scroll_x(gw, INT_MAX, true); +- +- } else if (modifier & FBTK_MOD_RSHIFT || +- modifier & FBTK_MOD_LSHIFT) { +- /* SHIFT held */ +- if (browser_window_key_press(gw->bw, +- NS_KEY_WORD_RIGHT) == false) +- widget_scroll_x(gw, fbtk_get_width( +- gw->browser), false); ++ case XKB_KEY_Page_Up: ++ if (browser_window_key_press(gw->bw, ++ NS_KEY_PAGE_UP) == false) ++ widget_scroll_y(gw, -fbtk_get_height( ++ gw->browser), false); ++ break; + +- } else { +- /* no modifier */ +- if (browser_window_key_press(gw->bw, +- NS_KEY_RIGHT) == false) +- widget_scroll_x(gw, 100, false); +- } +- break; ++ case XKB_KEY_Page_Down: ++ if (browser_window_key_press(gw->bw, ++ NS_KEY_PAGE_DOWN) == false) ++ widget_scroll_y(gw, fbtk_get_height( ++ gw->browser), false); ++ break; + +- case NSFB_KEY_LEFT: +- if (modifier & FBTK_MOD_RCTRL || +- modifier & FBTK_MOD_LCTRL) { +- /* CTRL held */ +- if (browser_window_key_press(gw->bw, +- NS_KEY_LINE_START) == false) +- widget_scroll_x(gw, 0, true); +- +- } else if (modifier & FBTK_MOD_RSHIFT || +- modifier & FBTK_MOD_LSHIFT) { +- /* SHIFT held */ +- if (browser_window_key_press(gw->bw, +- NS_KEY_WORD_LEFT) == false) +- widget_scroll_x(gw, -fbtk_get_width( +- gw->browser), false); ++ case XKB_KEY_Right: ++ if (mods & NSFB_MOD_CTRL) { ++ /* CTRL held */ ++ if (browser_window_key_press(gw->bw, ++ NS_KEY_LINE_END) == false) ++ widget_scroll_x(gw, INT_MAX, true); + +- } else { +- /* no modifier */ +- if (browser_window_key_press(gw->bw, +- NS_KEY_LEFT) == false) +- widget_scroll_x(gw, -100, false); +- } +- break; ++ } else if (mods & NSFB_MOD_SHIFT) { ++ /* SHIFT held */ ++ if (browser_window_key_press(gw->bw, ++ NS_KEY_WORD_RIGHT) == false) ++ widget_scroll_x(gw, fbtk_get_width( ++ gw->browser), false); + +- case NSFB_KEY_UP: ++ } else { ++ /* no modifier */ + if (browser_window_key_press(gw->bw, +- NS_KEY_UP) == false) +- widget_scroll_y(gw, -100, false); +- break; ++ NS_KEY_RIGHT) == false) ++ widget_scroll_x(gw, 100, false); ++ } ++ break; + +- case NSFB_KEY_DOWN: ++ case XKB_KEY_Left: ++ if (mods & NSFB_MOD_CTRL) { ++ /* CTRL held */ + if (browser_window_key_press(gw->bw, +- NS_KEY_DOWN) == false) +- widget_scroll_y(gw, 100, false); +- break; ++ NS_KEY_LINE_START) == false) ++ widget_scroll_x(gw, 0, true); + +- case NSFB_KEY_RSHIFT: +- modifier |= FBTK_MOD_RSHIFT; +- break; ++ } else if (mods & NSFB_MOD_SHIFT) { ++ /* SHIFT held */ ++ if (browser_window_key_press(gw->bw, ++ NS_KEY_WORD_LEFT) == false) ++ widget_scroll_x(gw, -fbtk_get_width( ++ gw->browser), false); + +- case NSFB_KEY_LSHIFT: +- modifier |= FBTK_MOD_LSHIFT; +- break; ++ } else { ++ /* no modifier */ ++ if (browser_window_key_press(gw->bw, ++ NS_KEY_LEFT) == false) ++ widget_scroll_x(gw, -100, false); ++ } ++ break; + +- case NSFB_KEY_RCTRL: +- modifier |= FBTK_MOD_RCTRL; +- break; ++ case XKB_KEY_Up: ++ if (browser_window_key_press(gw->bw, ++ NS_KEY_UP) == false) ++ widget_scroll_y(gw, -100, false); ++ break; + +- case NSFB_KEY_LCTRL: +- modifier |= FBTK_MOD_LCTRL; +- break; ++ case XKB_KEY_Down: ++ if (browser_window_key_press(gw->bw, ++ NS_KEY_DOWN) == false) ++ widget_scroll_y(gw, 100, false); ++ break; + +- case NSFB_KEY_y: +- case NSFB_KEY_z: +- if (cbi->event->value.keycode == NSFB_KEY_z && +- (modifier & FBTK_MOD_RCTRL || +- modifier & FBTK_MOD_LCTRL) && +- (modifier & FBTK_MOD_RSHIFT || +- modifier & FBTK_MOD_LSHIFT)) { +- /* Z pressed with CTRL and SHIFT held */ +- browser_window_key_press(gw->bw, NS_KEY_REDO); ++ default: ++ if (mods & NSFB_MOD_CTRL) { ++ switch (sym) { ++ case XKB_KEY_a: ++ key = NS_KEY_SELECT_ALL; + break; +- +- } else if (cbi->event->value.keycode == NSFB_KEY_z && +- (modifier & FBTK_MOD_RCTRL || +- modifier & FBTK_MOD_LCTRL)) { +- /* Z pressed with CTRL held */ +- browser_window_key_press(gw->bw, NS_KEY_UNDO); ++ case XKB_KEY_c: ++ key = NS_KEY_COPY_SELECTION; + break; +- +- } else if (cbi->event->value.keycode == NSFB_KEY_y && +- (modifier & FBTK_MOD_RCTRL || +- modifier & FBTK_MOD_LCTRL)) { +- /* Y pressed with CTRL held */ +- browser_window_key_press(gw->bw, NS_KEY_REDO); ++ case XKB_KEY_u: ++ key = NS_KEY_DELETE_LINE; ++ break; ++ case XKB_KEY_v: ++ key = NS_KEY_PASTE; ++ break; ++ case XKB_KEY_x: ++ key = NS_KEY_CUT_SELECTION; ++ break; ++ case XKB_KEY_y: ++ key = NS_KEY_REDO; ++ break; ++ case XKB_KEY_z: ++ key = mods & NSFB_MOD_SHIFT ? NS_KEY_REDO : NS_KEY_UNDO; ++ break; ++ default: ++ key = 0; + break; + } +- /* Z or Y pressed but not undo or redo; +- * Fall through to default handling */ +- +- default: +- ucs4 = fbtk_keycode_to_ucs4(cbi->event->value.keycode, +- modifier); +- if (ucs4 != -1) +- browser_window_key_press(gw->bw, ucs4); +- break; +- } +- break; +- +- case NSFB_EVENT_KEY_UP: +- switch (cbi->event->value.keycode) { +- case NSFB_KEY_RSHIFT: +- modifier &= ~FBTK_MOD_RSHIFT; +- break; +- +- case NSFB_KEY_LSHIFT: +- modifier &= ~FBTK_MOD_LSHIFT; +- break; +- +- case NSFB_KEY_RCTRL: +- modifier &= ~FBTK_MOD_RCTRL; +- break; +- +- case NSFB_KEY_LCTRL: +- modifier &= ~FBTK_MOD_LCTRL; +- break; +- +- default: +- break; + } +- break; +- +- default: ++ if (key == 0) ++ key = xkb_keysym_to_utf32(cbi->event->value.xkb.sym); ++ if (key != 0) ++ browser_window_key_press(gw->bw, key); + break; + } + +-- +2.11.0 + diff --git a/pkg/netsurf/rev b/pkg/netsurf/rev new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/pkg/netsurf/rev @@ -0,0 +1 @@ +1 diff --git a/pkg/netsurf/sha256 b/pkg/netsurf/sha256 new file mode 100644 index 00000000..f58815e4 --- /dev/null +++ b/pkg/netsurf/sha256 @@ -0,0 +1 @@ +fdde93ab180222bda8e2135dbb52d7cc1b63c66eaa5da74782f1ce6d894df8b1 netsurf-all-3.6.tar.gz diff --git a/pkg/netsurf/src b/pkg/netsurf/src new file mode 160000 +Subproject c56ecfd924b16d15bf74385c4d556a6b7002e8a diff --git a/pkg/netsurf/testament.h b/pkg/netsurf/testament.h new file mode 100644 index 00000000..3735f861 --- /dev/null +++ b/pkg/netsurf/testament.h @@ -0,0 +1,8 @@ +#ifndef NETSURF_REVISION_TESTAMENT +#define NETSURF_REVISION_TESTAMENT 1 + +#define WT_NO_GIT 1 +#define WT_MODIFIED 0 +#define WT_MODIFICATIONS {} + +#endif diff --git a/pkg/netsurf/url b/pkg/netsurf/url new file mode 100644 index 00000000..a6bd02e3 --- /dev/null +++ b/pkg/netsurf/url @@ -0,0 +1 @@ +url = "http://download.netsurf-browser.org/netsurf/releases/source-full/netsurf-all-3.6.tar.gz" |
