MCPcopy Create free account
hub / github.com/GJDuck/e9patch / parsePatchArg

Function parsePatchArg

src/e9tool/e9action.cpp:914–1217  ·  view source on GitHub ↗

* Parse a patch arg. */

Source from the content-addressed store, hash-verified

912 * Parse a patch arg.
913 */
914static const Argument parsePatchArg(Parser &parser)
915{
916 int t = parser.getToken();
917 Type cast = TYPE_NONE;
918 bool _static = false;
919 if (t == '(')
920 {
921 // Parse cast/modifiers
922 if (parser.peekToken() == TOKEN_STATIC)
923 {
924 parser.getToken();
925 _static = true;
926 }
927 bool ptr = false;
928 switch (parser.peekToken())
929 {
930 case ')':
931 if (_static)
932 break;
933 parser.unexpectedToken();
934 case TOKEN_CONST:
935 parser.getToken();
936 cast |= TYPE_CONST;
937 ptr = true;
938 // Fallthrough:
939 default:
940 switch (parser.getToken())
941 {
942 case TOKEN_INT8_T:
943 cast |= TYPE_INT8; break;
944 case TOKEN_INT16_T:
945 cast |= TYPE_INT16; break;
946 case TOKEN_INT32_T:
947 cast |= TYPE_INT32; break;
948 case TOKEN_INT64_T:
949 cast |= TYPE_INT64; break;
950 case TOKEN_VOID:
951 ptr = true;
952 cast |= TYPE_VOID; break;
953 case TOKEN_CHAR:
954 ptr = true;
955 cast |= TYPE_CHAR; break;
956 default:
957 parser.unexpectedToken();
958 }
959 if (parser.peekToken() == '*')
960 {
961 parser.getToken();
962 cast |= TYPE_PTR;
963 }
964 if (ptr && (cast & TYPE_PTR) == 0x0)
965 parser.unexpectedToken();
966 break;
967 }
968 parser.expectToken(')');
969 t = parser.getToken();
970 }
971 bool ptr = false, end = false, neg = false;

Callers 1

parsePatchFunction · 0.85

Calls 12

parseSymbolNameFunction · 0.85
deprecatedFunction · 0.85
parseMemOpFunction · 0.85
strDupFunction · 0.85
parseIndexFunction · 0.85
errorFunction · 0.85
warningFunction · 0.85
getTokenMethod · 0.80
peekTokenMethod · 0.80
unexpectedTokenMethod · 0.80
expectTokenMethod · 0.80
getNameMethod · 0.80

Tested by

no test coverage detected