input CHANGE optimize newlines counting in input handler

Moves counting newlines from input handler functions to the parsers
which have much better idea about the content of the data beeing
processed and can better optimize counting newlines. Counting newlines
in the input handler functions mostly caused reading data twice.
diff --git a/src/parser_yang.c b/src/parser_yang.c
index f3d98fe..a35e904 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -153,6 +153,7 @@
     ctx->in->current -= len;
     if (c == '\n') {
         ctx->indent = 0;
+        LY_IN_NEW_LINE(ctx->in);
     } else {
         /* note - even the multibyte character is count as 1 */
         ++ctx->indent;
@@ -427,6 +428,8 @@
             switch (ctx->in->current[0]) {
             case 'n':
                 ctx->in->current = "\n";
+                /* fix false newline count in buf_store_char() */
+                ctx->in->line--;
                 break;
             case 't':
                 ctx->in->current = "\t";
@@ -455,6 +458,8 @@
                 need_buf = 1;
                 break;
             case '\n':
+                LY_IN_NEW_LINE(ctx->in);
+                /* fall through */
             case ' ':
             case '\t':
                 /* just skip */
@@ -468,6 +473,8 @@
         case STRING_PAUSED_CONTINUE:
             switch (ctx->in->current[0]) {
             case '\n':
+                LY_IN_NEW_LINE(ctx->in);
+                /* fall through */
             case ' ':
             case '\t':
                 /* skip */
@@ -584,6 +591,7 @@
                 /* word is finished */
                 goto str_end;
             }
+            LY_IN_NEW_LINE(ctx->in);
             MOVE_INPUT(ctx, 1);
 
             /* reset indent */
@@ -667,6 +675,7 @@
             continue;
         case '\n':
             /* skip whitespaces (optsep) */
+            LY_IN_NEW_LINE(ctx->in);
             ctx->indent = 0;
             break;
         case ' ':
@@ -4453,6 +4462,9 @@
             LY_CHECK_RET(skip_comment(ctx, 2));
         } else if (isspace(ctx->in->current[0])) {
             /* whitespace */
+            if (ctx->in->current[0] == '\n') {
+                LY_IN_NEW_LINE(ctx->in);
+            }
             ly_in_skip(ctx->in, 1);
         } else {
             break;