Permalink
Browse files

Consistend camel case naming of variables and functions

  • Loading branch information...
josdejong committed Jun 13, 2018
1 parent b1777e3 commit f1ce47345762edb0d06dd654d88905f0534dcc98
Showing with 333 additions and 333 deletions.
  1. +2 −2 gulpfile.js
  2. +4 −4 src/core/function/import.js
  3. +44 −44 src/expression/parse.js
  4. +12 −12 src/function/algebra/decomposition/lup.js
  5. +4 −4 src/function/algebra/decomposition/slu.js
  6. +2 −2 src/function/algebra/simplify/simplifyCore.js
  7. +3 −3 src/function/algebra/solver/lusolve.js
  8. +15 −15 src/function/algebra/sparse/{cs_amd.js → csAmd.js}
  9. +8 −8 src/function/algebra/sparse/{cs_chol.js → csChol.js}
  10. +6 −6 src/function/algebra/sparse/{cs_counts.js → csCounts.js}
  11. +4 −4 src/function/algebra/sparse/{cs_cumsum.js → csCumsum.js}
  12. +13 −13 src/function/algebra/sparse/{cs_dfs.js → csDfs.js}
  13. +11 −11 src/function/algebra/sparse/{cs_ereach.js → csEreach}
  14. +4 −4 src/function/algebra/sparse/{cs_etree.js → csEtree.js}
  15. +4 −4 src/function/algebra/sparse/{cs_fkeep.js → csFkeep.js}
  16. +4 −4 src/function/algebra/sparse/{cs_flip.js → csFlip.js}
  17. +4 −4 src/function/algebra/sparse/{cs_ipvec.js → csIpvec.js}
  18. +4 −4 src/function/algebra/sparse/{cs_leaf.js → csLeaf.js}
  19. +7 −7 src/function/algebra/sparse/{cs_lu.js → csLu.js}
  20. +6 −6 src/function/algebra/sparse/{cs_mark.js → csMark.js}
  21. +4 −4 src/function/algebra/sparse/{cs_marked.js → csMarked.js}
  22. +4 −4 src/function/algebra/sparse/{cs_permute.js → csPermute.js}
  23. +6 −6 src/function/algebra/sparse/{cs_post.js → csPost.js}
  24. +11 −11 src/function/algebra/sparse/{cs_reach.js → csReach.js}
  25. +8 −8 src/function/algebra/sparse/{cs_spsolve.js → csSpsolve.js}
  26. +15 −15 src/function/algebra/sparse/{cs_sqr.js → csSqr.js}
  27. +6 −6 src/function/algebra/sparse/{cs_symperm.js → csSymperm.js}
  28. +4 −4 src/function/algebra/sparse/{cs_tdfs.js → csTdfs.js}
  29. +6 −6 src/function/algebra/sparse/{cs_unflip.js → csUnflip.js}
  30. +4 −4 src/function/arithmetic/cbrt.js
  31. +3 −3 src/function/arithmetic/log1p.js
  32. +3 −3 src/function/arithmetic/nthRoot.js
  33. +4 −4 src/function/matrix/expm.js
  34. +7 −7 src/function/matrix/inv.js
  35. +4 −4 src/function/matrix/sqrtm.js
  36. +10 −10 src/type/matrix/DenseMatrix.js
  37. +2 −2 src/utils/latex.js
  38. +7 −7 test-node/function/alegbra/sparse/{cs_amd.test.js → csAmd.test.js}
  39. +19 −20 test-node/function/alegbra/sparse/{cs_lu.test.js → csLu.test.js}
  40. +2 −2 test/function/algebra/derivative.test.js
  41. +22 −21 test/function/algebra/sparse/{cs_lu.test.js → csLu.test.js}
  42. +3 −3 test/function/matrix/det.test.js
  43. +3 −3 test/function/matrix/trace.test.js
  44. +7 −7 test/function/trigonometry/cos.test.js
  45. +4 −4 test/function/trigonometry/sin.test.js
  46. +2 −2 test/type/unit/Unit.test.js
  47. +2 −2 tools/approx.js
@@ -142,11 +142,11 @@ gulp.task('minify', ['bundle'], function () {
// test whether the docs for the expression parser are complete
gulp.task('validate', ['minify'], function (cb) {
const child_process = require('child_process')
const childProcess = require('child_process')
// this is run in a separate process as the modules need to be reloaded
// with every validation (and required modules stay in cache).
child_process.execFile('node', ['./tools/validate'], function (err, stdout, stderr) {
childProcess.execFile('node', ['./tools/validate'], function (err, stdout, stderr) {
if (err instanceof Error) {
throw err
}
@@ -53,7 +53,7 @@ function factory (type, config, load, typed, math) {
* @param {Object | Array} object Object with functions to be imported.
* @param {Object} [options] Import options.
*/
function math_import (object, options) {
function mathImport (object, options) {
const num = arguments.length
if (num !== 1 && num !== 2) {
throw new ArgumentsError('import', num, 1, 2)
@@ -69,7 +69,7 @@ function factory (type, config, load, typed, math) {
// TODO: allow a typed-function with name too
else if (Array.isArray(object)) {
object.forEach(function (entry) {
math_import(entry, options)
mathImport(entry, options)
})
} else if (typeof object === 'object') {
// a map with functions
@@ -81,7 +81,7 @@ function factory (type, config, load, typed, math) {
} else if (isFactory(object)) {
_importFactory(object, options)
} else {
math_import(value, options)
mathImport(value, options)
}
}
}
@@ -289,7 +289,7 @@ function factory (type, config, load, typed, math) {
'chain': true // chain method not supported. Note that there is a unit chain too.
}
return math_import
return mathImport
}
exports.math = true // request access to the math namespace as 5th argument of the factory function
@@ -59,7 +59,7 @@ function factory (type, config, load, typed) {
}
// pass extra nodes
extra_nodes = (options && options.nodes) ? options.nodes : {}
extraNodes = (options && options.nodes) ? options.nodes : {}
if (typeof expr === 'string') {
// parse a single expression
@@ -154,15 +154,15 @@ function factory (type, config, load, typed) {
'Infinity'
]
let extra_nodes = {} // current extra nodes
let extraNodes = {} // current extra nodes
let expression = '' // current expression
let comment = '' // last parsed comment
let index = 0 // current index in expr
let c = '' // current token character in expr
let token = '' // current token
let token_type = TOKENTYPE.NULL // type of the token
let nesting_level = 0 // level of nesting inside parameters, used to ignore newline characters
let conditional_level = null // when a conditional is being parsed, the level of the conditional is stored here
let tokenType = TOKENTYPE.NULL // type of the token
let nestingLevel = 0 // level of nesting inside parameters, used to ignore newline characters
let conditionalLevel = null // when a conditional is being parsed, the level of the conditional is stored here
const tokenStates = [] // holds saved token states
/**
@@ -174,8 +174,8 @@ function factory (type, config, load, typed) {
function first () {
index = 0
c = expression.charAt(0)
nesting_level = 0
conditional_level = null
nestingLevel = 0
conditionalLevel = null
}
/**
@@ -222,7 +222,7 @@ function factory (type, config, load, typed) {
*/
function pushTokenState () {
tokenStates.push({
token_type: token_type,
tokenType: tokenType,
token: token,
comment: comment,
index: index,
@@ -236,7 +236,7 @@ function factory (type, config, load, typed) {
*/
function popTokenState () {
const restoredState = tokenStates.pop()
token_type = restoredState.token_type
tokenType = restoredState.tokenType
token = restoredState.token
comment = restoredState.comment
index = restoredState.index
@@ -253,17 +253,17 @@ function factory (type, config, load, typed) {
/**
* Get next token in the current string expr.
* The token and token type are available as token and token_type
* The token and token type are available as token and tokenType
* @private
*/
function getToken () {
token_type = TOKENTYPE.NULL
tokenType = TOKENTYPE.NULL
token = ''
comment = ''
// skip over whitespaces
// space, tab, and newline when inside parameters
while (parse.isWhitespace(c, nesting_level)) {
while (parse.isWhitespace(c, nestingLevel)) {
next()
}
@@ -278,13 +278,13 @@ function factory (type, config, load, typed) {
// check for end of expression
if (c === '') {
// token is still empty
token_type = TOKENTYPE.DELIMITER
tokenType = TOKENTYPE.DELIMITER
return
}
// check for new line character
if (c === '\n' && !nesting_level) {
token_type = TOKENTYPE.DELIMITER
if (c === '\n' && !nestingLevel) {
tokenType = TOKENTYPE.DELIMITER
token = c
next()
return
@@ -294,7 +294,7 @@ function factory (type, config, load, typed) {
let c2 = c + nextPreview()
const c3 = c2 + nextNextPreview()
if (c3.length === 3 && DELIMITERS[c3]) {
token_type = TOKENTYPE.DELIMITER
tokenType = TOKENTYPE.DELIMITER
token = c3
next()
next()
@@ -304,7 +304,7 @@ function factory (type, config, load, typed) {
// check for delimiters consisting of 2 characters
if (c2.length === 2 && DELIMITERS[c2]) {
token_type = TOKENTYPE.DELIMITER
tokenType = TOKENTYPE.DELIMITER
token = c2
next()
next()
@@ -313,15 +313,15 @@ function factory (type, config, load, typed) {
// check for delimiters consisting of 1 character
if (DELIMITERS[c]) {
token_type = TOKENTYPE.DELIMITER
tokenType = TOKENTYPE.DELIMITER
token = c
next()
return
}
// check for a number
if (parse.isDigitDot(c)) {
token_type = TOKENTYPE.NUMBER
tokenType = TOKENTYPE.NUMBER
// get number, can have a single dot
if (c === '.') {
@@ -330,7 +330,7 @@ function factory (type, config, load, typed) {
if (!parse.isDigit(c)) {
// this is no number, it is just a dot (can be dot notation)
token_type = TOKENTYPE.DELIMITER
tokenType = TOKENTYPE.DELIMITER
}
} else {
while (parse.isDigit(c)) {
@@ -389,16 +389,16 @@ function factory (type, config, load, typed) {
}
if (NAMED_DELIMITERS.hasOwnProperty(token)) {
token_type = TOKENTYPE.DELIMITER
tokenType = TOKENTYPE.DELIMITER
} else {
token_type = TOKENTYPE.SYMBOL
tokenType = TOKENTYPE.SYMBOL
}
return
}
// something unknown is found, wrong characters -> a syntax error
token_type = TOKENTYPE.UNKNOWN
tokenType = TOKENTYPE.UNKNOWN
while (c !== '') {
token += c
next()
@@ -421,15 +421,15 @@ function factory (type, config, load, typed) {
* New line characters will be ignored until closeParams() is called
*/
function openParams () {
nesting_level++
nestingLevel++
}
/**
* Close parameters.
* New line characters will no longer be ignored
*/
function closeParams () {
nesting_level--
nestingLevel--
}
/**
@@ -540,9 +540,9 @@ function factory (type, config, load, typed) {
const node = parseBlock()
// check for garbage at the end of the expression
// an expression ends with a empty character '' and token_type DELIMITER
// an expression ends with a empty character '' and tokenType DELIMITER
if (token !== '') {
if (token_type === TOKENTYPE.DELIMITER) {
if (tokenType === TOKENTYPE.DELIMITER) {
// user entered a not existing operator like "//"
// TODO: give hints for aliases, for example with "<>" give as hint " did you mean !== ?"
@@ -674,25 +674,25 @@ function factory (type, config, load, typed) {
while (token === '?') {
// set a conditional level, the range operator will be ignored as long
// as conditional_level === nesting_level.
const prev = conditional_level
conditional_level = nesting_level
// as conditionalLevel === nestingLevel.
const prev = conditionalLevel
conditionalLevel = nestingLevel
getTokenSkipNewline()
const condition = node
const trueExpr = parseAssignment()
if (token !== ':') throw createSyntaxError('False part of conditional expression expected')
conditional_level = null
conditionalLevel = null
getTokenSkipNewline()
const falseExpr = parseAssignment() // Note: check for conditional operator again, right associativity
node = new ConditionalNode(condition, trueExpr, falseExpr)
// restore the previous conditional level
conditional_level = prev
conditionalLevel = prev
}
return node
@@ -903,7 +903,7 @@ function factory (type, config, load, typed) {
node = parseAddSubtract()
}
if (token === ':' && (conditional_level !== nesting_level)) {
if (token === ':' && (conditionalLevel !== nestingLevel)) {
// we ignore the range operator when a conditional operator is being processed on the same level
params.push(node)
@@ -1008,9 +1008,9 @@ function factory (type, config, load, typed) {
last = node
while (true) {
if ((token_type === TOKENTYPE.SYMBOL) ||
if ((tokenType === TOKENTYPE.SYMBOL) ||
(token === 'in' && type.isConstantNode(node)) ||
(token_type === TOKENTYPE.NUMBER &&
(tokenType === TOKENTYPE.NUMBER &&
!type.isConstantNode(last) &&
(!type.isOperatorNode(last) || last.op === '!')) ||
(token === '(')) {
@@ -1050,13 +1050,13 @@ function factory (type, config, load, typed) {
getTokenSkipNewline()
// Match the "number / number" part of the pattern
if (token_type === TOKENTYPE.NUMBER) {
if (tokenType === TOKENTYPE.NUMBER) {
// Look ahead again
pushTokenState()
getTokenSkipNewline()
// Match the "symbol" part of the pattern, or a left parenthesis
if (token_type === TOKENTYPE.SYMBOL || token === '(') {
if (tokenType === TOKENTYPE.SYMBOL || token === '(') {
// We've matched the pattern "number / number symbol".
// Rewind once and build the "number / number" node; the symbol will be consumed later
popTokenState()
@@ -1192,8 +1192,8 @@ function factory (type, config, load, typed) {
function parseCustomNodes () {
let params = []
if (token_type === TOKENTYPE.SYMBOL && extra_nodes.hasOwnProperty(token)) {
const CustomNode = extra_nodes[token]
if (tokenType === TOKENTYPE.SYMBOL && extraNodes.hasOwnProperty(token)) {
const CustomNode = extraNodes[token]
getToken()
@@ -1237,8 +1237,8 @@ function factory (type, config, load, typed) {
function parseSymbol () {
let node, name
if (token_type === TOKENTYPE.SYMBOL ||
(token_type === TOKENTYPE.DELIMITER && token in NAMED_DELIMITERS)) {
if (tokenType === TOKENTYPE.SYMBOL ||
(tokenType === TOKENTYPE.DELIMITER && token in NAMED_DELIMITERS)) {
name = token
getToken()
@@ -1334,7 +1334,7 @@ function factory (type, config, load, typed) {
// dot notation like variable.prop
getToken()
if (token_type !== TOKENTYPE.SYMBOL) {
if (tokenType !== TOKENTYPE.SYMBOL) {
throw createSyntaxError('Property name expected after dot')
}
params.push(new ConstantNode(token))
@@ -1505,7 +1505,7 @@ function factory (type, config, load, typed) {
// parse key
if (token === '"') {
key = parseStringToken()
} else if (token_type === TOKENTYPE.SYMBOL) {
} else if (tokenType === TOKENTYPE.SYMBOL) {
key = token
getToken()
} else {
@@ -1548,7 +1548,7 @@ function factory (type, config, load, typed) {
function parseNumber () {
let numberStr
if (token_type === TOKENTYPE.NUMBER) {
if (tokenType === TOKENTYPE.NUMBER) {
// this is a number
numberStr = token
getToken()
Oops, something went wrong.

0 comments on commit f1ce473

Please sign in to comment.