[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[misc 10/18] NPAR TESTS: Prefer lex_match_id() over lex_match_hyphenated
From: |
Ben Pfaff |
Subject: |
[misc 10/18] NPAR TESTS: Prefer lex_match_id() over lex_match_hyphenated_word() |
Date: |
Sat, 11 Dec 2010 22:20:04 -0800 |
This code used lex_match_hyphenated_word() in many places where it was
necessary to match a plain identifier. But it is better to use
lex_match_id() when it can be, because it is simpler and faster, so this
commit does that.
---
src/language/stats/npar.c | 34 +++++++++++++++++-----------------
1 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/language/stats/npar.c b/src/language/stats/npar.c
index 7dd94f7..6adeca4 100644
--- a/src/language/stats/npar.c
+++ b/src/language/stats/npar.c
@@ -158,7 +158,7 @@ parse_npar_tests (struct lexer *lexer, struct dataset *ds,
struct cmd_npar_tests
memset (npt->a_statistics, 0, sizeof npt->a_statistics);
for (;;)
{
- if (lex_match_hyphenated_word (lexer, "COCHRAN"))
+ if (lex_match_id (lexer, "COCHRAN"))
{
npt->cochran++;
switch (npar_cochran (lexer, ds, nps))
@@ -174,7 +174,7 @@ parse_npar_tests (struct lexer *lexer, struct dataset *ds,
struct cmd_npar_tests
NOT_REACHED ();
}
}
- else if (lex_match_hyphenated_word (lexer, "FRIEDMAN"))
+ else if (lex_match_id (lexer, "FRIEDMAN"))
{
npt->friedman++;
switch (npar_friedman (lexer, ds, nps))
@@ -190,7 +190,7 @@ parse_npar_tests (struct lexer *lexer, struct dataset *ds,
struct cmd_npar_tests
NOT_REACHED ();
}
}
- else if (lex_match_hyphenated_word (lexer, "KENDALL"))
+ else if (lex_match_id (lexer, "KENDALL"))
{
npt->kendall++;
switch (npar_kendall (lexer, ds, nps))
@@ -206,7 +206,7 @@ parse_npar_tests (struct lexer *lexer, struct dataset *ds,
struct cmd_npar_tests
NOT_REACHED ();
}
}
- else if (lex_match_hyphenated_word (lexer, "RUNS"))
+ else if (lex_match_id (lexer, "RUNS"))
{
npt->runs++;
switch (npar_runs (lexer, ds, nps))
@@ -222,7 +222,7 @@ parse_npar_tests (struct lexer *lexer, struct dataset *ds,
struct cmd_npar_tests
NOT_REACHED ();
}
}
- else if (lex_match_hyphenated_word (lexer, "CHISQUARE"))
+ else if (lex_match_id (lexer, "CHISQUARE"))
{
lex_match (lexer, T_EQUALS);
npt->chisquare++;
@@ -239,7 +239,7 @@ parse_npar_tests (struct lexer *lexer, struct dataset *ds,
struct cmd_npar_tests
NOT_REACHED ();
}
}
- else if (lex_match_hyphenated_word (lexer, "BINOMIAL"))
+ else if (lex_match_id (lexer, "BINOMIAL"))
{
lex_match (lexer, T_EQUALS);
npt->binomial++;
@@ -292,7 +292,7 @@ parse_npar_tests (struct lexer *lexer, struct dataset *ds,
struct cmd_npar_tests
NOT_REACHED ();
}
}
- else if (lex_match_hyphenated_word (lexer, "WILCOXON"))
+ else if (lex_match_id (lexer, "WILCOXON"))
{
lex_match (lexer, T_EQUALS);
npt->wilcoxon++;
@@ -309,7 +309,7 @@ parse_npar_tests (struct lexer *lexer, struct dataset *ds,
struct cmd_npar_tests
NOT_REACHED ();
}
}
- else if (lex_match_hyphenated_word (lexer, "SIGN"))
+ else if (lex_match_id (lexer, "SIGN"))
{
lex_match (lexer, T_EQUALS);
npt->sign++;
@@ -326,7 +326,7 @@ parse_npar_tests (struct lexer *lexer, struct dataset *ds,
struct cmd_npar_tests
NOT_REACHED ();
}
}
- else if (lex_match_hyphenated_word (lexer, "MISSING"))
+ else if (lex_match_id (lexer, "MISSING"))
{
lex_match (lexer, T_EQUALS);
npt->missing++;
@@ -337,13 +337,13 @@ parse_npar_tests (struct lexer *lexer, struct dataset
*ds, struct cmd_npar_tests
}
while (lex_token (lexer) != T_SLASH && lex_token (lexer) != T_ENDCMD)
{
- if (lex_match_hyphenated_word (lexer, "ANALYSIS"))
+ if (lex_match_id (lexer, "ANALYSIS"))
npt->miss = MISS_ANALYSIS;
- else if (lex_match_hyphenated_word (lexer, "LISTWISE"))
+ else if (lex_match_id (lexer, "LISTWISE"))
npt->miss = MISS_LISTWISE;
- else if (lex_match_hyphenated_word (lexer, "INCLUDE"))
+ else if (lex_match_id (lexer, "INCLUDE"))
nps->filter = MV_SYSTEM;
- else if (lex_match_hyphenated_word (lexer, "EXCLUDE"))
+ else if (lex_match_id (lexer, "EXCLUDE"))
nps->filter = MV_ANY;
else
{
@@ -353,7 +353,7 @@ parse_npar_tests (struct lexer *lexer, struct dataset *ds,
struct cmd_npar_tests
lex_match (lexer, T_COMMA);
}
}
- else if (lex_match_hyphenated_word (lexer, "METHOD"))
+ else if (lex_match_id (lexer, "METHOD"))
{
lex_match (lexer, T_EQUALS);
npt->method++;
@@ -375,15 +375,15 @@ parse_npar_tests (struct lexer *lexer, struct dataset
*ds, struct cmd_npar_tests
NOT_REACHED ();
}
}
- else if (lex_match_hyphenated_word (lexer, "STATISTICS"))
+ else if (lex_match_id (lexer, "STATISTICS"))
{
lex_match (lexer, T_EQUALS);
npt->statistics++;
while (lex_token (lexer) != T_SLASH && lex_token (lexer) != T_ENDCMD)
{
- if (lex_match_hyphenated_word (lexer, "DESCRIPTIVES"))
+ if (lex_match_id (lexer, "DESCRIPTIVES"))
npt->a_statistics[NPAR_ST_DESCRIPTIVES] = 1;
- else if (lex_match_hyphenated_word (lexer, "QUARTILES"))
+ else if (lex_match_id (lexer, "QUARTILES"))
npt->a_statistics[NPAR_ST_QUARTILES] = 1;
else if (lex_match (lexer, T_ALL))
npt->a_statistics[NPAR_ST_ALL] = 1;
--
1.7.1
- [misc 00/18] miscellaneous minor improvements, Ben Pfaff, 2010/12/12
- [misc 06/18] expressions: Make extract_min_valid() parameter const., Ben Pfaff, 2010/12/12
- [misc 01/18] friedman: Fix GCC warning about uninitialized fr.w., Ben Pfaff, 2010/12/12
- [misc 15/18] i18n: Remove unnecessary #ifs., Ben Pfaff, 2010/12/12
- [misc 12/18] DO REPEAT: Make this command usable anywhere., Ben Pfaff, 2010/12/12
- [misc 16/18] AGGREGATE: Align arg_func_tab[] in columns., Ben Pfaff, 2010/12/12
- [misc 10/18] NPAR TESTS: Prefer lex_match_id() over lex_match_hyphenated_word(),
Ben Pfaff <=
- [misc 14/18] ECHO: Use text_item, as intended., Ben Pfaff, 2010/12/12
- [misc 04/18] covariance: Fix const-ness of covariance_calculate[_unnormalized] retval., Ben Pfaff, 2010/12/12
- [misc 08/18] DEBUG XFORM FAIL: Issue an error message as part of transformation., Ben Pfaff, 2010/12/12
- [misc 18/18] value-parser: Remove redundant call to lex_force_string() in parse_value()., Ben Pfaff, 2010/12/12
- [misc 17/18] GET DATA: Fix punctuation in error message., Ben Pfaff, 2010/12/12
- [misc 07/18] INPUT PROGRAM: Remove unused enumeration., Ben Pfaff, 2010/12/12
- [misc 03/18] ONEWAY: Fix warning for passing "const" pointer as non-const parameter., Ben Pfaff, 2010/12/12
- [misc 09/18] q2c: Prefer lex_match_id() over lex_match_hyphenated_word() in emitted code., Ben Pfaff, 2010/12/12
- [misc 02/18] mann-whitney: Suppress GCC warning about unused parameter., Ben Pfaff, 2010/12/12
- [misc 05/18] categoricals: Make parameter to categoricals_done() const., Ben Pfaff, 2010/12/12