[BUG] Inconsistent and maybe buggy parsing of generalized-identifier compared to Power-BI
@JordanBoltonMN ya está trabajando en esto.
Desde el 9/2/2023.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Hi, a user of powerqueryformatter.com filed this issue with me a couple of days.
He outlines that he cannot name the column of a table type with just a digit like that:
[...] type table [1 = text, 2 = text, 3 = text, 4 = text, 5 = text]
the parser doesn't parse it saying Errors: Expected to find a identifier, but a numeric literal was found instead but in Power-BI
it works. The issue is not pressing, as the digits can be escaped using quoted-identifier but I thought I'd let you know.
I digged in the language specification and the relevant rules are
table-type:
"table" row-type
row-type:
"[" field-specification-list? "]"
field-specification-list:
field-specification
field-specification "," field-specification-list
field-specification:
optional? field-name field-type-specification?
field-type-specification: //this branch is not relevant
"=" field-type
field-name:
generalized-identifier
quoted-identifier
generalized-identifier:
generalized-identifier-part
generalized-identifier separated only by blanks (U+0020) generalized-identifier-part
generalized-identifier-part:
generalized-identifier-segment
decimal-digit-character generalized-identifier-segment
generalized-identifier-segment:
keyword-or-identifier
keyword-or-identifier dot-character keyword-or-identifier
keyword-or-identifier:
letter-character
underscore-character
identifier-start-character identifier-part-characters
letter-character:
A Unicode character of classes Lu, Ll, Lt, Lm, Lo, or Nl
identifier-start-character:
letter-character
underscore-character
decimal-digit-character:
A Unicode character of the class Nd
to me it seems single digit identifiers are not according to spec. So either the spec is wrong or the Power-BI parser is wrong. Also when we look at generalized-identifier-part it seems that according to second branch in
generalized-identifier-part:
generalized-identifier-segment
decimal-digit-character generalized-identifier-segment
the identifier 1a should be valid, but it does not parse. If I understand the spec correctly this is a bug.
Expected behavior
Consistency between language specification, microsoft/powerquery-parser and Power-BI.
Parsing of generalized-identifier according to spec
Actual behavior
Parser Power-BI and language specification are inconsistent.
1b does not parse as generalized-identifier in a table type.
To Reproduce
Please include the following:
- (Required) The Power Query script that triggers the issue.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Pcy5DcAwDEPRXVS7iZ1MY6jIfcf7dxYVgwWLBwI/Z+kk+EbR8CvaJirZZqq3LdRgW12xVTYK2ylUDgqVk0LlcqVWuSn8D4W9FCofhUoR1Qo=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t]),
GroupedRows =
Table.Group (
Source,
{"Column1"},
{
{
"Transform",
each
Table.PromoteHeaders (
Table.Transpose (
_[[Column2], [Column3]]
)
),
type table [1 = text, 2 = text, 3 = text, 4 = text, 5 = text]
}
}
),
ExpandedCount =
Table.ExpandTableColumn (
GroupedRows,
"Transform",
{"1", "2", "3", "4", "5"},
{"1", "2", "3", "4", "5"}
)
in
ExpandedCount
- (Required) Any non-default settings used in the API call(s) which trigger the issue.
- (Ideally) A minimal reproducible example. Can you reproduce the problem by calling a function in
src/example.ts?
- Lenguaje dominante
- TypeScript
- Estrellas
- 137
- Forks
- 34
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/powerquery-parser
-
[BUG] Section Access Expression Not ParsedPosiblemente ocupada @JordanBoltonMN la tomó hace 10 días. Abiertobug
microsoft/powerquery-parser#417 · 1 comentario · 1 asignado ·
-
[Enhancement] switch packaging from CommonJS to ESMQuizá libre de nuevo @mattmasson la tomó hace 309 días y no hay ningún pull request abierto. Abiertoenhancement
microsoft/powerquery-parser#399 · 1 asignado ·
-
[BUG] Quoted identifiers and unquoted identifiers sometimes parse differentlyQuizá libre de nuevo @JordanBoltonMN la tomó hace 1207 días y no hay ningún pull request abierto. Abiertobug
microsoft/powerquery-parser#370 · 1 asignado ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
microsoft/powerquery-parser#354 ·
-
[BUG] - Recursive Section Member Reference Isn't Accepted as ValidQuizá libre de nuevo @JordanBoltonMN la tomó hace 1519 días y no hay ningún pull request abierto. Abiertobug
microsoft/powerquery-parser#340 · 4 comentarios · 1 asignado ·
Todos los issues de microsoft/powerquery-parser
Issues similares
-
Add: CanalPlusActionEurope.nlAbiertocheck:passed streams:add
Dificultad 1/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
beta technical-medium ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
walletbeat/walletbeat#1625 ·
Los mantenedores suelen responder en 1 día
-
[Good First Issue]: Add unit tests for NetworkVersionInfoPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. AbiertoGood First Issue hacktoberfest
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
hiero-ledger/hiero-sdk-js#4489 ·
Los mantenedores suelen responder en 1 día
-
[Bug] The clients language filter cannot select the rows the page labels as unknownPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
apache/rocketmq-dashboard#6103 ·
Los mantenedores suelen responder en 4 días
-
Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
payloadcms/payload#18652 ·
Los mantenedores suelen responder en 1 día