File tree Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 22
33* Changes which are in master, but not yet in a release* :
44
5- * Added equality to ` PrefixInfo ` class
5+ * Adds equality to ` PrefixInfo ` class
6+ * Fixes parse error if external reference file path contains a space (` ='C:\My Dir\[file.xlsx]Sheet'!A1 ` )
67
78
89## 1.2.1
Original file line number Diff line number Diff line change @@ -683,5 +683,22 @@ public void TestFileNameString()
683683 {
684684 test ( "=[sheet]!A1" , "=[sheet.xls]!A1" ) ;
685685 }
686+
687+ [ TestMethod ]
688+ public void TestFilePathWithSpace ( )
689+ {
690+ test ( @"='C:\EOL\Management Report\DATAMART\REGIONAL ANALYSIS\REPORTS\052301\[DEAL BREAKDOWN ANALYSIS 05-23-01.xls]PHYSICAL+FINANCIAL PIVOT '!D8" ,
691+ @"='C:\EOL\Management Report\DATAMART\REGIONAL ANALYSIS\REPORTS\052301\[DEAL BREAKDOWN ANALYSIS 05-23-01.xls]PHYSICAL+FINANCIAL PIVOT '!D8" ,
692+ @"='C:\EOL\Management Report\DATAMART\REGIONAL ANALYSIS\REPORTS\052301\[DEAL BREAKDOWN ANALYSIS 05-23-01.xls]PHYSICAL+FINANCIAL PIVOT '!D6" ,
693+ @"='C:\EOL\Management Report\DATAMART\REGIONAL ANALYSIS\REPORTS\052301\[DEAL BREAKDOWN ANALYSIS 05-23-01.xls]PHYSICAL+FINANCIAL PIVOT '!D8" ,
694+ @"='C:\EOL\Management Report\DATAMART\REGIONAL ANALYSIS\REPORTS\052301\[DEAL BREAKDOWN ANALYSIS 05-23-01.xls]PHYSICAL+FINANCIAL PIVOT '!D7" ,
695+ @"='C:\EOL\Management Report\DATAMART\REGIONAL ANALYSIS\REPORTS\052301\[DEAL BREAKDOWN ANALYSIS 05-23-01.xls]FINANCIAL PIVOT'!D8" ,
696+ @"='C:\EOL\Management Report\DATAMART\REGIONAL ANALYSIS\REPORTS\052301\[DEAL BREAKDOWN ANALYSIS 05-23-01.xls]FINANCIAL PIVOT'!D8" ,
697+ @"='C:\EOL\Management Report\DATAMART\REGIONAL ANALYSIS\REPORTS\052301\[DEAL BREAKDOWN ANALYSIS 05-23-01.xls]FINANCIAL PIVOT'!D7" ,
698+ @"='C:\EOL\Management Report\DATAMART\REGIONAL ANALYSIS\REPORTS\052301\[DEAL BREAKDOWN ANALYSIS 05-23-01.xls]PHYSICAL PIVOT'!D6" ,
699+ @"='C:\EOL\Management Report\DATAMART\REGIONAL ANALYSIS\REPORTS\052301\[DEAL BREAKDOWN ANALYSIS 05-23-01.xls]PHYSICAL PIVOT'!D8" ,
700+ @"='C:\EOL\Management Report\DATAMART\REGIONAL ANALYSIS\REPORTS\052301\[DEAL BREAKDOWN ANALYSIS 05-23-01.xls]PHYSICAL PIVOT'!D7"
701+ ) ;
702+ }
686703 }
687704}
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ namespace XLParser
88 /// <summary>
99 /// Contains the XLParser grammar
1010 /// </summary>
11- [ Language ( "Excel Formulas" , "1.2.0 " , "Grammar for Excel Formulas" ) ]
11+ [ Language ( "Excel Formulas" , "1.2.2 " , "Grammar for Excel Formulas" ) ]
1212 public class ExcelFormulaGrammar : Grammar
1313 {
1414 #region 1-Terminals
@@ -149,12 +149,13 @@ public class ExcelFormulaGrammar : Grammar
149149 public Terminal FileToken = new RegexBasedTerminal ( GrammarNames . TokenFileNameNumeric , fileNameNumericRegex )
150150 { Priority = TerminalPriority . FileNameNumericToken } ;
151151
152- private const string fileNameRegex = @"\[[^<>:""/\|?*\[\]]+\]" ;
152+ private const string fileNameForbiddenCharacter = @"<>:""/\|?*" ;
153+ private const string fileNameRegex = @"\[[^" + fileNameForbiddenCharacter + @"\[\]]+\]" ;
153154 public Terminal EnclosedInBracketsToken { get ; } = new RegexBasedTerminal ( GrammarNames . TokenEnclosedInBrackets , fileNameRegex )
154155 { Priority = TerminalPriority . FileName } ;
155156
156157 // Source: http://stackoverflow.com/a/6416209/572635
157- private const string filePathRegex = @"(?:[a-zA-Z]\:|\\\\[\w\.]+\\[\w.$]+)\\(?:[\w] +\\)*" ;
158+ private const string filePathRegex = @"(?:[a-zA-Z]\:|\\\\[\w\.]+\\[\w.$]+)\\(([^" + fileNameForbiddenCharacter + @"\\]| ) +\\)*";
158159 public Terminal FilePathWindowsToken { get ; } = new RegexBasedTerminal ( GrammarNames . TokenFilePathWindows , filePathRegex ) ;
159160 #endregion
160161
You can’t perform that action at this time.
0 commit comments