diff options
Diffstat (limited to 'src/WixToolset.Core/Preprocessor.cs')
| -rw-r--r-- | src/WixToolset.Core/Preprocessor.cs | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/WixToolset.Core/Preprocessor.cs b/src/WixToolset.Core/Preprocessor.cs index c6cd3801..b111b291 100644 --- a/src/WixToolset.Core/Preprocessor.cs +++ b/src/WixToolset.Core/Preprocessor.cs | |||
| @@ -63,10 +63,10 @@ namespace WixToolset.Core | |||
| 63 | /// </summary> | 63 | /// </summary> |
| 64 | public event ProcessedStreamEventHandler ProcessedStream; | 64 | public event ProcessedStreamEventHandler ProcessedStream; |
| 65 | 65 | ||
| 66 | /// <summary> | 66 | // <summary> |
| 67 | /// Event for resolved variables. | 67 | // Event for resolved variables. |
| 68 | /// </summary> | 68 | // </summary> |
| 69 | /// TOOD: Remove? | 69 | // TOOD: Remove? |
| 70 | //public event ResolvedVariableEventHandler ResolvedVariable; | 70 | //public event ResolvedVariableEventHandler ResolvedVariable; |
| 71 | 71 | ||
| 72 | /// <summary> | 72 | /// <summary> |
| @@ -134,7 +134,7 @@ namespace WixToolset.Core | |||
| 134 | /// <summary> | 134 | /// <summary> |
| 135 | /// Preprocesses a file. | 135 | /// Preprocesses a file. |
| 136 | /// </summary> | 136 | /// </summary> |
| 137 | /// <param name="context">The preprocessing context.</param> | 137 | /// <param name="state">The preprocessing context.</param> |
| 138 | /// <param name="reader">XmlReader to processing the context.</param> | 138 | /// <param name="reader">XmlReader to processing the context.</param> |
| 139 | /// <returns>XDocument with the postprocessed data.</returns> | 139 | /// <returns>XDocument with the postprocessed data.</returns> |
| 140 | private IPreprocessResult Process(ProcessingState state, XmlReader reader) | 140 | private IPreprocessResult Process(ProcessingState state, XmlReader reader) |
| @@ -266,6 +266,7 @@ namespace WixToolset.Core | |||
| 266 | /// <summary> | 266 | /// <summary> |
| 267 | /// Processes an xml reader into an xml writer. | 267 | /// Processes an xml reader into an xml writer. |
| 268 | /// </summary> | 268 | /// </summary> |
| 269 | /// <param name="state"></param> | ||
| 269 | /// <param name="include">Specifies if reader is from an included file.</param> | 270 | /// <param name="include">Specifies if reader is from an included file.</param> |
| 270 | /// <param name="reader">Reader for the source document.</param> | 271 | /// <param name="reader">Reader for the source document.</param> |
| 271 | /// <param name="container">Node where content should be added.</param> | 272 | /// <param name="container">Node where content should be added.</param> |
| @@ -546,6 +547,7 @@ namespace WixToolset.Core | |||
| 546 | /// <summary> | 547 | /// <summary> |
| 547 | /// Processes an error processing instruction. | 548 | /// Processes an error processing instruction. |
| 548 | /// </summary> | 549 | /// </summary> |
| 550 | /// <param name="state"></param> | ||
| 549 | /// <param name="errorMessage">Text from source.</param> | 551 | /// <param name="errorMessage">Text from source.</param> |
| 550 | private void PreprocessError(ProcessingState state, string errorMessage) | 552 | private void PreprocessError(ProcessingState state, string errorMessage) |
| 551 | { | 553 | { |
| @@ -558,6 +560,7 @@ namespace WixToolset.Core | |||
| 558 | /// <summary> | 560 | /// <summary> |
| 559 | /// Processes a warning processing instruction. | 561 | /// Processes a warning processing instruction. |
| 560 | /// </summary> | 562 | /// </summary> |
| 563 | /// <param name="state"></param> | ||
| 561 | /// <param name="warningMessage">Text from source.</param> | 564 | /// <param name="warningMessage">Text from source.</param> |
| 562 | private void PreprocessWarning(ProcessingState state, string warningMessage) | 565 | private void PreprocessWarning(ProcessingState state, string warningMessage) |
| 563 | { | 566 | { |
| @@ -570,6 +573,7 @@ namespace WixToolset.Core | |||
| 570 | /// <summary> | 573 | /// <summary> |
| 571 | /// Processes a define processing instruction and creates the appropriate parameter. | 574 | /// Processes a define processing instruction and creates the appropriate parameter. |
| 572 | /// </summary> | 575 | /// </summary> |
| 576 | /// <param name="state"></param> | ||
| 573 | /// <param name="originalDefine">Text from source.</param> | 577 | /// <param name="originalDefine">Text from source.</param> |
| 574 | private void PreprocessDefine(ProcessingState state, string originalDefine) | 578 | private void PreprocessDefine(ProcessingState state, string originalDefine) |
| 575 | { | 579 | { |
| @@ -607,6 +611,7 @@ namespace WixToolset.Core | |||
| 607 | /// <summary> | 611 | /// <summary> |
| 608 | /// Processes an undef processing instruction and creates the appropriate parameter. | 612 | /// Processes an undef processing instruction and creates the appropriate parameter. |
| 609 | /// </summary> | 613 | /// </summary> |
| 614 | /// <param name="state"></param> | ||
| 610 | /// <param name="originalDefine">Text from source.</param> | 615 | /// <param name="originalDefine">Text from source.</param> |
| 611 | private void PreprocessUndef(ProcessingState state, string originalDefine) | 616 | private void PreprocessUndef(ProcessingState state, string originalDefine) |
| 612 | { | 617 | { |
| @@ -625,6 +630,7 @@ namespace WixToolset.Core | |||
| 625 | /// <summary> | 630 | /// <summary> |
| 626 | /// Processes an included file. | 631 | /// Processes an included file. |
| 627 | /// </summary> | 632 | /// </summary> |
| 633 | /// <param name="state"></param> | ||
| 628 | /// <param name="includePath">Path to included file.</param> | 634 | /// <param name="includePath">Path to included file.</param> |
| 629 | /// <param name="parent">Parent container for included content.</param> | 635 | /// <param name="parent">Parent container for included content.</param> |
| 630 | private void PreprocessInclude(ProcessingState state, string includePath, XContainer parent) | 636 | private void PreprocessInclude(ProcessingState state, string includePath, XContainer parent) |
| @@ -671,6 +677,7 @@ namespace WixToolset.Core | |||
| 671 | /// <summary> | 677 | /// <summary> |
| 672 | /// Preprocess a foreach processing instruction. | 678 | /// Preprocess a foreach processing instruction. |
| 673 | /// </summary> | 679 | /// </summary> |
| 680 | /// <param name="state"></param> | ||
| 674 | /// <param name="reader">The xml reader.</param> | 681 | /// <param name="reader">The xml reader.</param> |
| 675 | /// <param name="container">The container where to output processed data.</param> | 682 | /// <param name="container">The container where to output processed data.</param> |
| 676 | /// <param name="offset">Offset for the line numbers.</param> | 683 | /// <param name="offset">Offset for the line numbers.</param> |
| @@ -785,7 +792,9 @@ namespace WixToolset.Core | |||
| 785 | /// <summary> | 792 | /// <summary> |
| 786 | /// Processes a pragma processing instruction | 793 | /// Processes a pragma processing instruction |
| 787 | /// </summary> | 794 | /// </summary> |
| 795 | /// <param name="state"></param> | ||
| 788 | /// <param name="pragmaText">Text from source.</param> | 796 | /// <param name="pragmaText">Text from source.</param> |
| 797 | /// <param name="parent"></param> | ||
| 789 | private void PreprocessPragma(ProcessingState state, string pragmaText, XContainer parent) | 798 | private void PreprocessPragma(ProcessingState state, string pragmaText, XContainer parent) |
| 790 | { | 799 | { |
| 791 | var match = PragmaRegex.Match(pragmaText); | 800 | var match = PragmaRegex.Match(pragmaText); |
| @@ -811,6 +820,7 @@ namespace WixToolset.Core | |||
| 811 | /// <summary> | 820 | /// <summary> |
| 812 | /// Gets the next token in an expression. | 821 | /// Gets the next token in an expression. |
| 813 | /// </summary> | 822 | /// </summary> |
| 823 | /// <param name="state"></param> | ||
| 814 | /// <param name="originalExpression">Expression to parse.</param> | 824 | /// <param name="originalExpression">Expression to parse.</param> |
| 815 | /// <param name="expression">Expression with token removed.</param> | 825 | /// <param name="expression">Expression with token removed.</param> |
| 816 | /// <param name="stringLiteral">Flag if token is a string literal instead of a variable.</param> | 826 | /// <param name="stringLiteral">Flag if token is a string literal instead of a variable.</param> |
| @@ -958,6 +968,7 @@ namespace WixToolset.Core | |||
| 958 | /// <summary> | 968 | /// <summary> |
| 959 | /// Gets the value for a variable. | 969 | /// Gets the value for a variable. |
| 960 | /// </summary> | 970 | /// </summary> |
| 971 | /// <param name="state"></param> | ||
| 961 | /// <param name="originalExpression">Original expression for error message.</param> | 972 | /// <param name="originalExpression">Original expression for error message.</param> |
| 962 | /// <param name="variable">Variable to evaluate.</param> | 973 | /// <param name="variable">Variable to evaluate.</param> |
| 963 | /// <returns>Value of variable.</returns> | 974 | /// <returns>Value of variable.</returns> |
| @@ -996,6 +1007,7 @@ namespace WixToolset.Core | |||
| 996 | /// <summary> | 1007 | /// <summary> |
| 997 | /// Gets the left side value, operator, and right side value of an expression. | 1008 | /// Gets the left side value, operator, and right side value of an expression. |
| 998 | /// </summary> | 1009 | /// </summary> |
| 1010 | /// <param name="state"></param> | ||
| 999 | /// <param name="originalExpression">Original expression to evaluate.</param> | 1011 | /// <param name="originalExpression">Original expression to evaluate.</param> |
| 1000 | /// <param name="expression">Expression modified while processing.</param> | 1012 | /// <param name="expression">Expression modified while processing.</param> |
| 1001 | /// <param name="leftValue">Left side value from expression.</param> | 1013 | /// <param name="leftValue">Left side value from expression.</param> |
| @@ -1048,6 +1060,7 @@ namespace WixToolset.Core | |||
| 1048 | /// <summary> | 1060 | /// <summary> |
| 1049 | /// Evaluates an expression. | 1061 | /// Evaluates an expression. |
| 1050 | /// </summary> | 1062 | /// </summary> |
| 1063 | /// <param name="state"></param> | ||
| 1051 | /// <param name="originalExpression">Original expression to evaluate.</param> | 1064 | /// <param name="originalExpression">Original expression to evaluate.</param> |
| 1052 | /// <param name="expression">Expression modified while processing.</param> | 1065 | /// <param name="expression">Expression modified while processing.</param> |
| 1053 | /// <returns>true if expression evaluates to true.</returns> | 1066 | /// <returns>true if expression evaluates to true.</returns> |
| @@ -1143,6 +1156,7 @@ namespace WixToolset.Core | |||
| 1143 | /// <summary> | 1156 | /// <summary> |
| 1144 | /// Gets a sub-expression in parenthesis. | 1157 | /// Gets a sub-expression in parenthesis. |
| 1145 | /// </summary> | 1158 | /// </summary> |
| 1159 | /// <param name="state"></param> | ||
| 1146 | /// <param name="originalExpression">Original expression to evaluate.</param> | 1160 | /// <param name="originalExpression">Original expression to evaluate.</param> |
| 1147 | /// <param name="expression">Expression modified while processing.</param> | 1161 | /// <param name="expression">Expression modified while processing.</param> |
| 1148 | /// <param name="endSubExpression">Index of end of sub-expression.</param> | 1162 | /// <param name="endSubExpression">Index of end of sub-expression.</param> |
| @@ -1197,6 +1211,7 @@ namespace WixToolset.Core | |||
| 1197 | /// <summary> | 1211 | /// <summary> |
| 1198 | /// Updates expression based on operation. | 1212 | /// Updates expression based on operation. |
| 1199 | /// </summary> | 1213 | /// </summary> |
| 1214 | /// <param name="state"></param> | ||
| 1200 | /// <param name="currentValue">State to update.</param> | 1215 | /// <param name="currentValue">State to update.</param> |
| 1201 | /// <param name="operation">Operation to apply to current value.</param> | 1216 | /// <param name="operation">Operation to apply to current value.</param> |
| 1202 | /// <param name="prevResult">Previous result.</param> | 1217 | /// <param name="prevResult">Previous result.</param> |
| @@ -1221,6 +1236,7 @@ namespace WixToolset.Core | |||
| 1221 | /// <summary> | 1236 | /// <summary> |
| 1222 | /// Evaluate an expression. | 1237 | /// Evaluate an expression. |
| 1223 | /// </summary> | 1238 | /// </summary> |
| 1239 | /// <param name="state"></param> | ||
| 1224 | /// <param name="expression">Expression to evaluate.</param> | 1240 | /// <param name="expression">Expression to evaluate.</param> |
| 1225 | /// <returns>Boolean result of expression.</returns> | 1241 | /// <returns>Boolean result of expression.</returns> |
| 1226 | private bool EvaluateExpression(ProcessingState state, string expression) | 1242 | private bool EvaluateExpression(ProcessingState state, string expression) |
| @@ -1252,6 +1268,7 @@ namespace WixToolset.Core | |||
| 1252 | /// $(var.A) and $(var.B)>2 or $(var.B) <= 2 | 1268 | /// $(var.A) and $(var.B)>2 or $(var.B) <= 2 |
| 1253 | /// $(var.A) != "2" | 1269 | /// $(var.A) != "2" |
| 1254 | /// </summary> | 1270 | /// </summary> |
| 1271 | /// <param name="state"></param> | ||
| 1255 | /// <param name="originalExpression">The original expression</param> | 1272 | /// <param name="originalExpression">The original expression</param> |
| 1256 | /// <param name="expression">The expression currently being evaluated</param> | 1273 | /// <param name="expression">The expression currently being evaluated</param> |
| 1257 | /// <param name="prevResultOperation">The operation to apply to this result</param> | 1274 | /// <param name="prevResultOperation">The operation to apply to this result</param> |
| @@ -1322,6 +1339,7 @@ namespace WixToolset.Core | |||
| 1322 | /// <summary> | 1339 | /// <summary> |
| 1323 | /// Update the current line number with the reader's current state. | 1340 | /// Update the current line number with the reader's current state. |
| 1324 | /// </summary> | 1341 | /// </summary> |
| 1342 | /// <param name="state"></param> | ||
| 1325 | /// <param name="reader">The xml reader for the preprocessor.</param> | 1343 | /// <param name="reader">The xml reader for the preprocessor.</param> |
| 1326 | /// <param name="offset">This is the artificial offset of the line numbers from the reader. Used for the foreach processing.</param> | 1344 | /// <param name="offset">This is the artificial offset of the line numbers from the reader. Used for the foreach processing.</param> |
| 1327 | private void UpdateCurrentLineNumber(ProcessingState state, XmlReader reader, int offset) | 1345 | private void UpdateCurrentLineNumber(ProcessingState state, XmlReader reader, int offset) |
| @@ -1341,6 +1359,7 @@ namespace WixToolset.Core | |||
| 1341 | /// <summary> | 1359 | /// <summary> |
| 1342 | /// Pushes a file name on the stack of included files. | 1360 | /// Pushes a file name on the stack of included files. |
| 1343 | /// </summary> | 1361 | /// </summary> |
| 1362 | /// <param name="state"></param> | ||
| 1344 | /// <param name="fileName">Name to push on to the stack of included files.</param> | 1363 | /// <param name="fileName">Name to push on to the stack of included files.</param> |
| 1345 | private void PushInclude(ProcessingState state, string fileName) | 1364 | private void PushInclude(ProcessingState state, string fileName) |
| 1346 | { | 1365 | { |
| @@ -1374,6 +1393,7 @@ namespace WixToolset.Core | |||
| 1374 | /// through the search paths in the order given on the command line | 1393 | /// through the search paths in the order given on the command line |
| 1375 | /// (leftmost first, ...). | 1394 | /// (leftmost first, ...). |
| 1376 | /// </summary> | 1395 | /// </summary> |
| 1396 | /// <param name="state"></param> | ||
| 1377 | /// <param name="includePath">User-specified path to the included file (usually just the file name).</param> | 1397 | /// <param name="includePath">User-specified path to the included file (usually just the file name).</param> |
| 1378 | /// <returns>Returns a FileInfo for the found include file, or null if the file cannot be found.</returns> | 1398 | /// <returns>Returns a FileInfo for the found include file, or null if the file cannot be found.</returns> |
| 1379 | private string GetIncludeFile(ProcessingState state, string includePath) | 1399 | private string GetIncludeFile(ProcessingState state, string includePath) |
