Skip to content

Inline Patterns may start with any character #48

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

Merged
merged 1 commit into from
Feb 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions fluent/syntax/ftlstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,18 @@ def is_number_start(self):
self.reset_peek()
return is_digit

def is_char_pattern_start(self, ch):
def is_char_pattern_continuation(self, ch):
return ch not in SPECIAL_LINE_START_CHARS

def is_peek_pattern_start(self):
self.peek_inline_ws()
ch = self.current_peek()

if self.current_peek_is('\n'):
return self.is_peek_next_line_pattern_start()
# Inline Patterns may start with any char.
if ch is not None and ch != '\n':
return True

is_pattern = self.is_char_pattern_start(self.current_peek())
self.reset_peek()
return is_pattern
return self.is_peek_next_line_pattern_start()

def is_peek_next_line_zero_four_style_comment(self):
if not self.current_peek_is('\n'):
Expand Down Expand Up @@ -227,7 +227,7 @@ def is_peek_next_line_pattern_start(self):
self.reset_peek()
return False

if not self.is_char_pattern_start(self.current_peek()):
if not self.is_char_pattern_continuation(self.current_peek()):
self.reset_peek()
return False

Expand Down
64 changes: 64 additions & 0 deletions tests/syntax/fixtures_structure/leading_dots.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
key01 = .Value
key02 = …Value
key03 = {"."}Value
key04 =
{"."}Value

key05 = Value
{"."}Continued

key06 = .Value
{"."}Continued

# ERROR (attr .Continued must have a value)
key07 = Value
.Continued

# ERROR (attr .Value must have a value)
key08 =
.Value

# ERROR (attr .Value must have a value)
key09 =
.Value
Continued

key10 =
.Value = which looks like an attribute
Continued

key11 =
{"."}Value = which looks like an attribute
Continued

key12 =
.accesskey =
A

key13 =
.attribute = .Value

key14 =
.attribute =
{"."}Value

key15 =
{ 1 ->
[one] .Value
*[other]
{"."}Value
}

# ERROR (variant must have a value)
key16 =
{ 1 ->
*[one]
.Value
}

# ERROR (unclosed placeable)
key17 =
{ 1 ->
*[one] Value
.Continued
}
Loading