diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-10-29 11:45:56 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-29 08:45:56 -0700 |
| commit | 494e09af2cebafa34db49dc1f60afd43aebed619 (patch) | |
| tree | b3985b21d4470415a3ad1a6183836528a971ca54 /source/slang/slang-mangled-lexer.h | |
| parent | 1d7a7f23874151372f2792e7307f50c54dae877f (diff) | |
Handling imported/exporting symbols from serialized modules (#1589)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Fix handling of access modifiers inside type definition.
* Fix access problem for AST node.
Make dumping produce a single function with switch, to potentially make available without Dump specific access.
* WIP on serialization design doc.
* Remove project references to previously generated files.
* More docs on serialization design.
* Improve serialization documentation.
Remove unused function from IRSerialReader.
* Small fixes around naming. Remove long comment from slang-serialize.h - as covered in serialization.md
* Remove long comment in slang-serialize.h as covered in serialization.md
* More information about doing replacements on read for AST and problems surrounding.
* Typo fix.
* Spelling fixes.
* Value serialize.
* Value types with inheritence.
* Use value reflection serial conversion for more AST types
* Use automatic serialization on more of AST.
* Get the types via decltype, simplifies what the extractor has to do.
* Update the serialization.md for the value serialization.
* Small doc improvements.
* Update project.
* Remove ImportExternalDecl type
Added addImportSymbol and ImportSymbol type
Fixed bug in container which meant it wouldn't read back AST module
* Because of change of how imports and handled, store objects as SerialPointers.
* First pass symbol lookup from mangled names.
* Cache current module looked up from mangled name.
* Fix SourceLoc bug.
Improve comments.
* Added diagnostic on mangled symbol not being found
* Fix typo.
Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'source/slang/slang-mangled-lexer.h')
| -rw-r--r-- | source/slang/slang-mangled-lexer.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/source/slang/slang-mangled-lexer.h b/source/slang/slang-mangled-lexer.h index 6c8060cfd..7d096e45e 100644 --- a/source/slang/slang-mangled-lexer.h +++ b/source/slang/slang-mangled-lexer.h @@ -3,6 +3,7 @@ #define SLANG_MANGLED_LEXER_H_INCLUDED #include "../core/slang-basic.h" +#include "../core/slang-char-util.h" #include "slang-compiler.h" @@ -41,6 +42,12 @@ public: UInt readParamCount(); + /// Returns the character at the current position + char peekChar() { return *m_cursor; } + // Returns the current character and moves to next character. + char nextChar() { return *m_cursor++; } + + /// Ctor SLANG_FORCE_INLINE MangledLexer(const UnownedStringSlice& slice); @@ -50,13 +57,6 @@ private: // to strip off the main prefix void _start() { _expect("_S"); } - static bool _isDigit(char c) { return (c >= '0') && (c <= '9'); } - - /// Returns the character at the current position - char _peek() { return *m_cursor; } - // Returns the current character and moves to next character. - char _next() { return *m_cursor++; } - SLANG_INLINE void _expect(char c); void _expect(char const* str) @@ -82,10 +82,10 @@ SLANG_FORCE_INLINE MangledLexer::MangledLexer(const UnownedStringSlice& slice) // --------------------------------------------------------------------------- SLANG_INLINE void MangledLexer::readSimpleIntVal() { - int c = _peek(); - if (_isDigit((char)c)) + int c = peekChar(); + if (CharUtil::isDigit((char)c)) { - _next(); + nextChar(); } else { @@ -110,9 +110,9 @@ SLANG_INLINE void MangledLexer::readExtensionSpec() // --------------------------------------------------------------------------- SLANG_INLINE void MangledLexer::_expect(char c) { - if (_peek() == c) + if (peekChar() == c) { - _next(); + nextChar(); } else { @@ -121,5 +121,13 @@ SLANG_INLINE void MangledLexer::_expect(char c) } } +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! MangledNameParser !!!!!!!!!!!!!!!!!!!!!!!!!! + +struct MangledNameParser +{ + /// Tries to extract the module name from this mangled name. + static SlangResult parseModuleName(const UnownedStringSlice& in, UnownedStringSlice& outModuleName); +}; + } #endif |
