From bc0961f2e259e5664a2c5865a53c7a5007c92703 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Thu, 6 Feb 2020 15:21:47 -0800 Subject: [PATCH] fix parsing errors --- MorphParse/MorphParse.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/MorphParse/MorphParse.js b/MorphParse/MorphParse.js index 4ed5ed9..f1cb48e 100644 --- a/MorphParse/MorphParse.js +++ b/MorphParse/MorphParse.js @@ -132,7 +132,9 @@ var MorphParse = function() var parseCase = function(code) { var morph = morphCodes.adjCase[code.charAt(2)]; - if (code.length > 3) { + if ( morph === undefined ) { + morph = parsePerson(code, 2); + } else if (code.length > 3) { morph += ' ' + parsePerson(code, 3); } return morph; @@ -141,10 +143,15 @@ var MorphParse = function() var parsePerson = function(code, pos) { var morph = morphCodes.person[code.charAt(pos)]; - pos++; - if (code.length > pos) { - morph += ' ' + parseGender(code, pos); + if ( morph === undefined ) { + morph = parseGender(code, pos); + } else { + pos++; + if (code.length > pos) { + morph += ' ' +parseGender(code, pos); + } } + return morph; }; @@ -173,4 +180,4 @@ var MorphParse = function() var morph = morphCodes.state[code.charAt(pos)]; return morph; }; -}; \ No newline at end of file +};