@@ -905,12 +905,12 @@ std::optional<LexResult> keyword(std::string_view in) {
905905void Lexer::skipSpace () {
906906 while (true ) {
907907 if (auto ctx = annotation (next ())) {
908- index += ctx->span .size ();
908+ pos += ctx->span .size ();
909909 annotations.push_back (ctx->annotation );
910910 continue ;
911911 }
912912 if (auto ctx = space (next ())) {
913- index += ctx->span .size ();
913+ pos += ctx->span .size ();
914914 continue ;
915915 }
916916 break ;
@@ -919,7 +919,7 @@ void Lexer::skipSpace() {
919919
920920bool Lexer::takeLParen () {
921921 if (LexCtx (next ()).startsWith (" (" sv)) {
922- ++index ;
922+ ++pos ;
923923 advance ();
924924 return true ;
925925 }
@@ -928,7 +928,7 @@ bool Lexer::takeLParen() {
928928
929929bool Lexer::takeRParen () {
930930 if (LexCtx (next ()).startsWith (" )" sv)) {
931- ++index ;
931+ ++pos ;
932932 advance ();
933933 return true ;
934934 }
@@ -937,7 +937,7 @@ bool Lexer::takeRParen() {
937937
938938std::optional<std::string> Lexer::takeString () {
939939 if (auto result = str (next ())) {
940- index += result->span .size ();
940+ pos += result->span .size ();
941941 advance ();
942942 if (result->str ) {
943943 return result->str ;
@@ -950,7 +950,7 @@ std::optional<std::string> Lexer::takeString() {
950950
951951std::optional<Name> Lexer::takeID () {
952952 if (auto result = ident (next ())) {
953- index += result->span .size ();
953+ pos += result->span .size ();
954954 advance ();
955955 if (result->str ) {
956956 return Name (*result->str );
@@ -967,7 +967,7 @@ std::optional<Name> Lexer::takeID() {
967967
968968std::optional<std::string_view> Lexer::takeKeyword () {
969969 if (auto result = keyword (next ())) {
970- index += result->span .size ();
970+ pos += result->span .size ();
971971 advance ();
972972 return result->span ;
973973 }
@@ -976,7 +976,7 @@ std::optional<std::string_view> Lexer::takeKeyword() {
976976
977977bool Lexer::takeKeyword (std::string_view expected) {
978978 if (auto result = keyword (next ()); result && result->span == expected) {
979- index += expected.size ();
979+ pos += expected.size ();
980980 advance ();
981981 return true ;
982982 }
@@ -990,7 +990,7 @@ std::optional<uint64_t> Lexer::takeOffset() {
990990 }
991991 Lexer subLexer (result->span .substr (7 ));
992992 if (auto o = subLexer.takeU64 ()) {
993- index += result->span .size ();
993+ pos += result->span .size ();
994994 advance ();
995995 return o;
996996 }
@@ -1005,7 +1005,7 @@ std::optional<uint32_t> Lexer::takeAlign() {
10051005 }
10061006 Lexer subLexer (result->span .substr (6 ));
10071007 if (auto o = subLexer.takeU32 ()) {
1008- index += result->span .size ();
1008+ pos += result->span .size ();
10091009 advance ();
10101010 return o;
10111011 }
@@ -1016,7 +1016,7 @@ std::optional<uint32_t> Lexer::takeAlign() {
10161016template <typename T> std::optional<T> Lexer::takeU () {
10171017 static_assert (std::is_integral_v<T> && std::is_unsigned_v<T>);
10181018 if (auto result = integer (next ()); result && result->isUnsigned <T>()) {
1019- index += result->span .size ();
1019+ pos += result->span .size ();
10201020 advance ();
10211021 return T (result->n );
10221022 }
@@ -1027,7 +1027,7 @@ template<typename T> std::optional<T> Lexer::takeU() {
10271027template <typename T> std::optional<T> Lexer::takeS () {
10281028 static_assert (std::is_integral_v<T> && std::is_signed_v<T>);
10291029 if (auto result = integer (next ()); result && result->isSigned <T>()) {
1030- index += result->span .size ();
1030+ pos += result->span .size ();
10311031 advance ();
10321032 return T (result->n );
10331033 }
@@ -1038,7 +1038,7 @@ template<typename T> std::optional<T> Lexer::takeI() {
10381038 static_assert (std::is_integral_v<T> && std::is_unsigned_v<T>);
10391039 if (auto result = integer (next ())) {
10401040 if (result->isUnsigned <T>() || result->isSigned <std::make_signed_t <T>>()) {
1041- index += result->span .size ();
1041+ pos += result->span .size ();
10421042 advance ();
10431043 return T (result->n );
10441044 }
@@ -1078,12 +1078,12 @@ std::optional<double> Lexer::takeF64() {
10781078 bits = (bits & ~payloadMask) | payload;
10791079 memcpy (&d, &bits, sizeof (bits));
10801080 }
1081- index += result->span .size ();
1081+ pos += result->span .size ();
10821082 advance ();
10831083 return d;
10841084 }
10851085 if (auto result = integer (next ())) {
1086- index += result->span .size ();
1086+ pos += result->span .size ();
10871087 advance ();
10881088 if (result->sign == Neg) {
10891089 if (result->n == 0 ) {
@@ -1115,12 +1115,12 @@ std::optional<float> Lexer::takeF32() {
11151115 bits = (bits & ~payloadMask) | payload;
11161116 memcpy (&f, &bits, sizeof (bits));
11171117 }
1118- index += result->span .size ();
1118+ pos += result->span .size ();
11191119 advance ();
11201120 return f;
11211121 }
11221122 if (auto result = integer (next ())) {
1123- index += result->span .size ();
1123+ pos += result->span .size ();
11241124 advance ();
11251125 if (result->sign == Neg) {
11261126 if (result->n == 0 ) {
0 commit comments