uninitialized token indexes in some fragments
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
Empieza en SqlScriptDom/Parser/TSql/TSql80.g alrededor de las líneas 6276-6294 y reproduce los dos ejemplos de SQL del issue. Inspecciona cómo se asignan los índices de token a OptimizerHint y StatementList; el trabajo estará terminado cuando esos fragmentos indiquen los índices de token primero y último correctos en lugar de -1.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Using Microsoft.SqlServer.TransactSql.ScriptDom version 161.9135.0.
For example:
select 1
option(recompile)
gets parsed as:
TOKENS:
0: Select "select"
1: WhiteSpace " "
2: Integer "1"
3: WhiteSpace "\n"
4: Option "option"
5: LeftParenthesis "("
6: Identifier "recompile"
7: RightParenthesis ")"
8: EndOfFile
FRAGMENTS:
TSqlScript {
FirstTokenIndex = 0,
LastTokenIndex = 8,
Batches = [
TSqlBatch {
FirstTokenIndex = 0,
LastTokenIndex = 7,
Statements = [
SelectStatement {
FirstTokenIndex = 0,
LastTokenIndex = 7,
QueryExpression = QuerySpecification {
FirstTokenIndex = 0,
LastTokenIndex = 2,
UniqueRowFilter = NotSpecified,
SelectElements = [
SelectScalarExpression {
FirstTokenIndex = 2,
LastTokenIndex = 2,
Expression = IntegerLiteral {
FirstTokenIndex = 2,
LastTokenIndex = 2,
LiteralType = Integer,
Value = 1,
},
},
],
},
OptimizerHints = [
OptimizerHint {
FirstTokenIndex = -1,
LastTokenIndex = -1,
HintKind = Recompile,
},
],
},
],
},
],
}
where OptimizerHint ends up with -1 in FirstTokenIndex and LastTokenIndex.
I think the issue here is that here
tokens get assigned to vParent and should be assigned to vHint.
Another example:
if 1=1
begin
select 1
end
gets parsed as:
TOKENS:
0: If "if"
1: WhiteSpace " "
2: Integer "1"
3: EqualsSign "="
4: Integer "1"
5: WhiteSpace "\n"
6: Begin "begin"
7: WhiteSpace "\n"
8: WhiteSpace " "
9: Select "select"
10: WhiteSpace " "
11: Integer "1"
12: WhiteSpace "\n"
13: End "end"
14: EndOfFile
FRAGMENTS:
TSqlScript {
FirstTokenIndex = 0,
LastTokenIndex = 14,
Batches = [
TSqlBatch {
FirstTokenIndex = 0,
LastTokenIndex = 13,
Statements = [
IfStatement {
FirstTokenIndex = 0,
LastTokenIndex = 13,
Predicate = BooleanComparisonExpression {
FirstTokenIndex = 2,
LastTokenIndex = 4,
ComparisonType = Equals,
FirstExpression = IntegerLiteral {
FirstTokenIndex = 2,
LastTokenIndex = 2,
LiteralType = Integer,
Value = 1,
},
SecondExpression = IntegerLiteral {
FirstTokenIndex = 4,
LastTokenIndex = 4,
LiteralType = Integer,
Value = 1,
},
},
ThenStatement = BeginEndBlockStatement {
FirstTokenIndex = 6,
LastTokenIndex = 13,
StatementList = StatementList {
FirstTokenIndex = -1,
LastTokenIndex = -1,
Statements = [
SelectStatement {
FirstTokenIndex = 9,
LastTokenIndex = 11,
QueryExpression = QuerySpecification {
FirstTokenIndex = 9,
LastTokenIndex = 11,
UniqueRowFilter = NotSpecified,
SelectElements = [
SelectScalarExpression {
FirstTokenIndex = 11,
LastTokenIndex = 11,
Expression = IntegerLiteral {
FirstTokenIndex = 11,
LastTokenIndex = 11,
LiteralType = Integer,
Value = 1,
},
},
],
},
},
],
},
},
},
],
},
],
}
here StatementList is missing token indexes.
- Lenguaje dominante
- GAP
- Estrellas
- 277
- Forks
- 43
- Merge medio
- 6 d 17 h
- PR fusionados (30 d)
- 3
Guía de contribución
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/SqlScriptDOM
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
microsoft/SqlScriptDOM#228 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
microsoft/SqlScriptDOM#183 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 56/100
microsoft/SqlScriptDOM#226 · 1 reacción ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
microsoft/SqlScriptDOM#225 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
microsoft/SqlScriptDOM#224 ·
Todos los issues de microsoft/SqlScriptDOM
Issues similares
-
todo:perf
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
-
StUnhex.number() misformats Long.MIN_VALUE as scientific notation instead of a plain integer Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
objectionary/eo#8894 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
objectionary/phie#154 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
objectionary/jeo-maven-plugin#1774 ·
-
Minor breakage w/ LLVM 7: `test_llvm.cpp: error: cannot convert 'llvm::Module' to 'llvm::Module*'` Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100