1919
2020#include " common.h"
2121#include " contexts.h"
22- #include " input .h"
22+ #include " lexer .h"
2323
2424namespace wasm ::WATParser {
2525
@@ -190,8 +190,8 @@ template<typename Ctx>
190190Result<typename Ctx::LabelIdxT> labelidx (Ctx&, bool inDelegate = false );
191191template <typename Ctx> Result<typename Ctx::TagIdxT> tagidx (Ctx&);
192192template <typename Ctx> Result<typename Ctx::TypeUseT> typeuse (Ctx&);
193- MaybeResult<ImportNames> inlineImport (ParseInput &);
194- Result<std::vector<Name>> inlineExports (ParseInput &);
193+ MaybeResult<ImportNames> inlineImport (Lexer &);
194+ Result<std::vector<Name>> inlineExports (Lexer &);
195195template <typename Ctx> Result<> strtype (Ctx&);
196196template <typename Ctx> MaybeResult<typename Ctx::ModuleNameT> subtype (Ctx&);
197197template <typename Ctx> MaybeResult<> deftype (Ctx&);
@@ -223,10 +223,10 @@ template<typename Ctx> struct WithPosition {
223223 Index original;
224224
225225 WithPosition (Ctx& ctx, Index pos) : ctx(ctx), original(ctx.in.getPos()) {
226- ctx.in .lexer . setIndex (pos);
226+ ctx.in .setIndex (pos);
227227 }
228228
229- ~WithPosition () { ctx.in .lexer . setIndex (original); }
229+ ~WithPosition () { ctx.in .setIndex (original); }
230230};
231231
232232// Deduction guide to satisfy -Wctad-maybe-unsupported.
@@ -786,7 +786,7 @@ template<typename Ctx> MaybeResult<> foldedinstr(Ctx& ctx) {
786786
787787 // A stack of (start, end) position pairs defining the positions of
788788 // instructions that need to be parsed after their folded children.
789- std::vector<std::pair<Index , std::optional<Index >>> foldedInstrs;
789+ std::vector<std::pair<size_t , std::optional<size_t >>> foldedInstrs;
790790
791791 do {
792792 if (ctx.in .takeRParen ()) {
@@ -893,7 +893,7 @@ template<typename Ctx> Result<typename Ctx::BlockTypeT> blocktype(Ctx& ctx) {
893893
894894 // We either had no results or multiple results. Reset and parse again as a
895895 // type use.
896- ctx.in .lexer . setIndex (pos);
896+ ctx.in .setIndex (pos);
897897 auto use = typeuse (ctx);
898898 CHECK_ERR (use);
899899
@@ -1129,7 +1129,7 @@ template<typename Ctx> MaybeResult<> trycatch(Ctx& ctx, bool folded) {
11291129 if (id && id != label) {
11301130 // Instead of returning an error, retry without the ID.
11311131 parseID = false ;
1132- ctx.in .lexer . setIndex (afterCatchPos);
1132+ ctx.in .setIndex (afterCatchPos);
11331133 continue ;
11341134 }
11351135 }
@@ -1138,7 +1138,7 @@ template<typename Ctx> MaybeResult<> trycatch(Ctx& ctx, bool folded) {
11381138 if (parseID && tag.getErr ()) {
11391139 // Instead of returning an error, retry without the ID.
11401140 parseID = false ;
1141- ctx.in .lexer . setIndex (afterCatchPos);
1141+ ctx.in .setIndex (afterCatchPos);
11421142 continue ;
11431143 }
11441144 CHECK_ERR (tag);
@@ -2247,7 +2247,7 @@ template<typename Ctx> Result<typename Ctx::TypeUseT> typeuse(Ctx& ctx) {
22472247}
22482248
22492249// ('(' 'import' mod:name nm:name ')')?
2250- MaybeResult<ImportNames> inlineImport (ParseInput & in) {
2250+ MaybeResult<ImportNames> inlineImport (Lexer & in) {
22512251 if (!in.takeSExprStart (" import" sv)) {
22522252 return {};
22532253 }
@@ -2267,7 +2267,7 @@ MaybeResult<ImportNames> inlineImport(ParseInput& in) {
22672267}
22682268
22692269// ('(' 'export' name ')')*
2270- Result<std::vector<Name>> inlineExports (ParseInput & in) {
2270+ Result<std::vector<Name>> inlineExports (Lexer & in) {
22712271 std::vector<Name> exports;
22722272 while (in.takeSExprStart (" export" sv)) {
22732273 auto name = in.takeName ();
@@ -2834,7 +2834,7 @@ template<typename Ctx> MaybeResult<> elem(Ctx& ctx) {
28342834 offset = *off;
28352835 } else {
28362836 // This must be the beginning of the elemlist instead.
2837- ctx.in .lexer . setIndex (beforeLParen);
2837+ ctx.in .setIndex (beforeLParen);
28382838 }
28392839 }
28402840 }
0 commit comments