Skip to content

Added dfdlx:alignmentViaSkip property#770

Merged
mbeckerle merged 1 commit intoapache:mainfrom
mbeckerle:daf-2652-alignprop
Mar 14, 2022
Merged

Added dfdlx:alignmentViaSkip property#770
mbeckerle merged 1 commit intoapache:mainfrom
mbeckerle:daf-2652-alignprop

Conversation

@mbeckerle
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

@tuxji tuxji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Looks good.

Copy link
Copy Markdown
Member

@stevedlawrence stevedlawrence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, only thought about the name of the property, but I don't feel strongly about it. It's experimental so we can always change the name later if needed

Comment thread daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dfdlx.xsd Outdated
Copy link
Copy Markdown
Contributor

@tuxji tuxji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 once comments are addressed

Comment thread daffodil-core/src/main/scala/org/apache/daffodil/grammar/AlignedMixin.scala Outdated
Copy link
Copy Markdown
Contributor

@tuxji tuxji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 with comments about comments :)

Comment on lines +61 to +66
prop match {
case NotFound(_, _, _) => AlignmentKind.Automatic // default since this is a new property
case Found("automatic",_,_,_) => AlignmentKind.Automatic
case Found("manual",_,_,_) => AlignmentKind.Manual
case _ => Assert.impossible("Per validation, can only be 'automatic' or 'manual'")
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much more readable now! Even covers the impossible case so readers will understand what's happening.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

A second thought, why are we even manually implementing this? Shouldn't the property generator be able to easily generate code for this? Or does that not handle extension properties or something?

I guess we'd still need something manual to provide a default, but this could look something like

lazy val alignmentKindDefaulted = optionAlignmentKind.getOrElse(AlignmentKind.Automatic)

I think we use a similar pattern for other properties that have a default value?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know, that may be the case. I may have over complicated this. This is a regular property, except extension namespace, and default value.

Copy link
Copy Markdown
Member

@stevedlawrence stevedlawrence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to changes, minor comments

Comment on lines +61 to +66
prop match {
case NotFound(_, _, _) => AlignmentKind.Automatic // default since this is a new property
case Found("automatic",_,_,_) => AlignmentKind.Automatic
case Found("manual",_,_,_) => AlignmentKind.Manual
case _ => Assert.impossible("Per validation, can only be 'automatic' or 'manual'")
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

A second thought, why are we even manually implementing this? Shouldn't the property generator be able to easily generate code for this? Or does that not handle extension properties or something?

I guess we'd still need something manual to provide a default, but this could look something like

lazy val alignmentKindDefaulted = optionAlignmentKind.getOrElse(AlignmentKind.Automatic)

I think we use a similar pattern for other properties that have a default value?

@mbeckerle mbeckerle force-pushed the daf-2652-alignprop branch 2 times, most recently from 3ec0055 to fd2e6b5 Compare March 14, 2022 16:15
ParseError on charset not aligned.

This is a significant change in behavior, though because the compiler
puts down mandatory text alignment fill regions the automatic
alignmentby the I/O layer was redundant.

Without the mandatory text alignment regions, the I/O layer really
must not do auto alignment.

Removed dead code from TextParser and unused I/O layer getString
method.

DAFFODIL-2652
@mbeckerle mbeckerle force-pushed the daf-2652-alignprop branch from fd2e6b5 to 79d06ce Compare March 14, 2022 16:35
@mbeckerle mbeckerle merged commit 14f6c99 into apache:main Mar 14, 2022
@mbeckerle mbeckerle deleted the daf-2652-alignprop branch March 14, 2022 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants