-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allows readers to interpret macro invocations as encoding directives. #976
Allows readers to interpret macro invocations as encoding directives. #976
Conversation
override fun iterateTypeAnnotations(): MutableIterator<String>? = currentValueExpression?.annotations?.mapTo(mutableListOf()) { it.assumeText() }?.iterator() | ||
override fun iterateTypeAnnotations(): MutableIterator<String> { | ||
return currentValueExpression?.annotations?.mapTo(mutableListOf()) { it.assumeText() }?.iterator() | ||
?: return Collections.emptyIterator() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IonReader.iterateTypeAnnotations()
is documented to return non-null.
@@ -22,8 +22,11 @@ internal class EncodingDirectiveReader(private val reader: IonReader, readerAdap | |||
private var state: State = State.READING_VALUE | |||
|
|||
var isSymbolTableAppend = false | |||
var isMacroTableAppend = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious... can this non-append concatenations?
$ion_encoding::(
(symbol_table [a, b, c] $ion_encoding [g, h, i])
(macro_table (macro pi () 3.14159) $ion_encoding)
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, not yet. I created #977
return makeSymbolsMap(FIRST_LOCAL_SYMBOL_ID, symbols); | ||
} | ||
|
||
private static void writeSymbolTableAppendMacroInvocation(IonRawWriter_1_1 writer, Map<String, Integer> existingSymbols, String... newSymbols) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The combination of "SymbolTableAppendMacro" got me confused. Maybe E-Expression would be a better choice here (and in the similar methods)?
private static void writeSymbolTableAppendMacroInvocation(IonRawWriter_1_1 writer, Map<String, Integer> existingSymbols, String... newSymbols) { | |
private static void writeSymbolTableAppendEExpression(IonRawWriter_1_1 writer, Map<String, Integer> existingSymbols, String... newSymbols) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
bf2951e
to
64610d7
Compare
Description of changes:
Builds on #973 to allow the readers to correctly interpret the
set_macros
,add_macros
,set_symbols
, andadd_symbols
system macros as encoding directives.As noted in the JavaDoc atop the EncodingDirectiveReader class, this PR includes some duplication between the top-level
EncodingDirectiveReader
and the one built into the core binary reader. We have a path to unifying these implementations in the future, but that is out of scope for this PR.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.