modified creation of bison file so that it compiles using bison 2.4
git-svn-id: https://mot-adms.svn.sourceforge.net/svnroot/mot-adms/trunk@1183 6a24e58b-241e-0410-9a82-9c1a24ee876d
r29173
14 years ago
276 | 276 | admse__ladms, |
277 | 277 | admse__ladmst, |
278 | 278 | TK |
279 | #ifndef tktk_notequal | |
280 | $tk | |
281 | #endif | |
282 | 279 | admse__ |
283 | 280 | } admse; |
284 | 281 | @; |
1958 | 1955 | return " if(!strcmp(mytransform->_name,\"$obsolete\")) adms_message_obsolete((\"%s: please use '$new' instead\\n\",adms_transform_uid(mytransform)))\n"; |
1959 | 1956 | } |
1960 | 1957 | print admstpathYacc_y ' |
1958 | static int admstpathlex (p_pparse mypparse); | |
1961 | 1959 | static void dbpath (p_path mypath); |
1962 | 1960 | static void dbtext (p_text mytext); |
1963 | 1961 | static void postpath (p_path mypath); |
4022 | 4020 | adms_message_fatal_continue((\"\%s - invalid path \\\"\%s\\\"\\n\",s,mypparse->_value)) |
4023 | 4021 | adms_message_fatal((\"see \%s\\n\",adms_transform_uid(mypparse->_transform))) |
4024 | 4022 | } |
4025 | static const char* tparsecb (p_pparse mypparse) | |
4026 | { | |
4027 | const char* t=mypparse->_position; | |
4028 | mypparse->_tkstart=t; | |
4029 | if(0) {} | |
4030 | else if(*t=='\\\''&&INSIDEPATH) | |
4031 | { | |
4032 | adms_slist_pull(&globalctxt); | |
4033 | t+=1, mypparse->_tkid=tktk_cquote; | |
4034 | } | |
4035 | else if(*t=='\%') | |
4036 | { | |
4037 | if(*(t+1)=='\\0') | |
4038 | t+=1, mypparse->_tkid=tktk_anytext; | |
4039 | else if(*(t+1)=='s') | |
4040 | t+=2, mypparse->_tkid=tktk_percents; | |
4041 | else if(*(t+1)=='\%') | |
4042 | { | |
4043 | mypparse->_tkstart=t+1; | |
4044 | t+=2, mypparse->_tkid=tktk_anytext; | |
4045 | } | |
4046 | else if(*(t+1)=='(') | |
4047 | { | |
4048 | paren++; adms_slist_push(&parenidx,(p_adms)(long)paren); SETPATH | |
4049 | mypparse->_tkstart=t+2; | |
4050 | t+=2, mypparse->_tkid=tktk_percent; | |
4051 | } | |
4052 | else | |
4053 | t+=2, mypparse->_tkid=tktk_anytext; | |
4054 | } | |
4055 | else if(*t=='\\\\') | |
4056 | { | |
4057 | if(*(t+1)=='\\0') | |
4058 | t+=1, mypparse->_tkid=tktk_anytext; | |
4059 | if(*(t+1)=='n') | |
4060 | t+=2, mypparse->_tkid=tktk_cr; | |
4061 | else if(*(t+1)=='r') | |
4062 | t+=2, mypparse->_tkid=tktk_cr; | |
4063 | else if(*(t+1)=='t') | |
4064 | t+=2, mypparse->_tkid=tktk_tab; | |
4065 | else | |
4066 | { | |
4067 | mypparse->_tkstart=t+1; | |
4068 | t+=2, mypparse->_tkid=tktk_anytext; | |
4069 | } | |
4070 | } | |
4071 | else if(*t=='\$') | |
4072 | { | |
4073 | if(*(t+1)=='\\0') | |
4074 | t+=1, mypparse->_tkid=tktk_anytext; | |
4075 | if(*(t+1)=='(') | |
4076 | { | |
4077 | paren++; adms_slist_push(&parenidx,(p_adms)(long)paren); SETTEXT | |
4078 | mypparse->_tkstart=t+2; | |
4079 | t+=2, mypparse->_tkid=tktk_dollarvariable; | |
4080 | } | |
4081 | else | |
4082 | { | |
4083 | mypparse->_tkstart=t+1; | |
4084 | t++; | |
4085 | while(*t&&(isalnum(*t)||*t=='_')) | |
4086 | t++; | |
4087 | mypparse->_tkid=tktk_kdollarvariable; | |
4088 | } | |
4089 | } | |
4090 | else if(ISTEXT&&(*t==')')) | |
4091 | { | |
4092 | if(PARENMATCH) | |
4093 | { | |
4094 | t+=1, mypparse->_tkid=tktk_closeE, adms_slist_pull(&parenidx); | |
4095 | adms_slist_pull(&globalctxt); | |
4096 | } | |
4097 | else | |
4098 | t+=1, mypparse->_tkid=tktk_anytext; | |
4099 | paren--; | |
4100 | } | |
4101 | else | |
4102 | { | |
4103 | if(INSIDEPATH) | |
4104 | { | |
4105 | if(ISTEXT) while(*t&&(*t!=')')&&(*t!='\\0')&&(*t!='\%')&&(*t!='\\\\')&&(*t!='\$')&&(*t!='\\'')) | |
4106 | { | |
4107 | if(*t=='(') paren++; | |
4108 | t++; | |
4109 | } | |
4110 | else if(ISTIC) while(*t&&(*t!='\\0')&&(*t!='\%')&&(*t!='\\\\')&&(*t!='\$')&&(*t!='\\'')) | |
4111 | { | |
4112 | t++; | |
4113 | } | |
4114 | else | |
4115 | adms_message_fatal((\"%s:'%s' unexpected error in apath parser - please report to r29173\@users.sourceforge.net\\n\",adms_transform_uid(mypparse->_transform),mypparse->_value)) | |
4116 | } | |
4117 | else | |
4118 | { | |
4119 | if(ISTEXT) while(*t&&(*t!=')')&&(*t!='\\0')&&(*t!='\%')&&(*t!='\\\\')&&(*t!='\$')) | |
4120 | { | |
4121 | if(*t=='(') paren++; | |
4122 | t++; | |
4123 | } | |
4124 | else if(ISTIC) while(*t&&(*t!='\\0')&&(*t!='\%')&&(*t!='\\\\')&&(*t!='\$')) | |
4125 | { | |
4126 | t++; | |
4127 | } | |
4128 | else | |
4129 | adms_message_fatal((\"%s:'%s' unexpected error in apath parser - please report to r29173\@users.sourceforge.net\\n\",adms_transform_uid(mypparse->_transform),mypparse->_value)) | |
4130 | } | |
4131 | mypparse->_tkid=tktk_anytext; | |
4132 | } | |
4133 | mypparse->_tklen=(int)(long)(t-mypparse->_tkstart); | |
4134 | return t; | |
4135 | } | |
4136 | 4023 | "; |
4137 | 4024 | |
4138 | 4025 | #lexer |
4139 | print admstpathYacc_y "static int admstpathlex (p_pparse mypparse) | |
4140 | { | |
4141 | const char* t=mypparse->_position; | |
4142 | const char* tstart; | |
4143 | if(*t=='\\0') | |
4144 | return 0; | |
4145 | if(goto_atext) | |
4146 | { | |
4147 | goto_atext=0; | |
4148 | return tktk_goto_atext; | |
4149 | } | |
4150 | "; | |
4151 | map {print admstpathYacc_y " while(".xvalue($_).") t++;\n";} $admstpathxml->findnodes("//ignore"); | |
4152 | print admstpathYacc_y " tstart=t; | |
4153 | if(!strncmp(t,\"\\\'%p\\'\",4)&&!isalpha(*(t+4))) | |
4154 | t+=4, mypparse->_tkid=tktk_ticptr; | |
4155 | else if(!ISPATH) | |
4156 | t=tparsecb(mypparse); | |
4157 | "; | |
4158 | foreach($admstpathxml->findnodes("//constant|//regexp")) | |
4159 | { | |
4160 | if($_->nodeName eq "regexp") | |
4161 | { | |
4162 | print admstpathYacc_y $_->textContent; | |
4163 | } | |
4164 | elsif(xvalue($_)=~/\w$/) | |
4165 | { | |
4166 | my$len=length(xvalue($_)); | |
4167 | print admstpathYacc_y " else if(!strncmp(t,\"".xvalue($_)."\",$len)&&!isalpha(*(t+$len)))\n"; | |
4168 | print admstpathYacc_y " t+=$len, mypparse->_tkid=tktk_".xid($_).";\n"; | |
4169 | } | |
4170 | else | |
4171 | { | |
4172 | my$len=length(xvalue($_)); | |
4173 | print admstpathYacc_y " else if(!strncmp(t,\"".xvalue($_)."\",$len))\n"; | |
4174 | print admstpathYacc_y " t+=$len, mypparse->_tkid=tktk_".xid($_).";\n"; | |
4175 | } | |
4176 | } | |
4177 | print admstpathYacc_y " else | |
4178 | { | |
4179 | if(*t=='\\0') | |
4180 | return 0; | |
4181 | adms_message_fatal((\"%s: invalid path - unexpected character: %s\\n\", | |
4182 | adms_transform_uid(mypparse->_transform), | |
4183 | mypparse->_value)) | |
4184 | } | |
4185 | mypparse->_position=t; | |
4186 | return mypparse->_tkid; | |
4187 | } | |
4188 | "; | |
4189 | 4026 | |
4190 | 4027 | print admstpathYacc_y " |
4191 | 4028 | %} |
4762 | 4599 | } |
4763 | 4600 | print admstpathYacc_y " |
4764 | 4601 | %% |
4602 | static const char* tparsecb (p_pparse mypparse) | |
4603 | { | |
4604 | const char* t=mypparse->_position; | |
4605 | mypparse->_tkstart=t; | |
4606 | if(0) {} | |
4607 | else if(*t=='\\\''&&INSIDEPATH) | |
4608 | { | |
4609 | adms_slist_pull(&globalctxt); | |
4610 | t+=1, mypparse->_tkid=tktk_cquote; | |
4611 | } | |
4612 | else if(*t=='\%') | |
4613 | { | |
4614 | if(*(t+1)=='\\0') | |
4615 | t+=1, mypparse->_tkid=tktk_anytext; | |
4616 | else if(*(t+1)=='s') | |
4617 | t+=2, mypparse->_tkid=tktk_percents; | |
4618 | else if(*(t+1)=='\%') | |
4619 | { | |
4620 | mypparse->_tkstart=t+1; | |
4621 | t+=2, mypparse->_tkid=tktk_anytext; | |
4622 | } | |
4623 | else if(*(t+1)=='(') | |
4624 | { | |
4625 | paren++; adms_slist_push(&parenidx,(p_adms)(long)paren); SETPATH | |
4626 | mypparse->_tkstart=t+2; | |
4627 | t+=2, mypparse->_tkid=tktk_percent; | |
4628 | } | |
4629 | else | |
4630 | t+=2, mypparse->_tkid=tktk_anytext; | |
4631 | } | |
4632 | else if(*t=='\\\\') | |
4633 | { | |
4634 | if(*(t+1)=='\\0') | |
4635 | t+=1, mypparse->_tkid=tktk_anytext; | |
4636 | if(*(t+1)=='n') | |
4637 | t+=2, mypparse->_tkid=tktk_cr; | |
4638 | else if(*(t+1)=='r') | |
4639 | t+=2, mypparse->_tkid=tktk_cr; | |
4640 | else if(*(t+1)=='t') | |
4641 | t+=2, mypparse->_tkid=tktk_tab; | |
4642 | else | |
4643 | { | |
4644 | mypparse->_tkstart=t+1; | |
4645 | t+=2, mypparse->_tkid=tktk_anytext; | |
4646 | } | |
4647 | } | |
4648 | else if(*t=='\$') | |
4649 | { | |
4650 | if(*(t+1)=='\\0') | |
4651 | t+=1, mypparse->_tkid=tktk_anytext; | |
4652 | if(*(t+1)=='(') | |
4653 | { | |
4654 | paren++; adms_slist_push(&parenidx,(p_adms)(long)paren); SETTEXT | |
4655 | mypparse->_tkstart=t+2; | |
4656 | t+=2, mypparse->_tkid=tktk_dollarvariable; | |
4657 | } | |
4658 | else | |
4659 | { | |
4660 | mypparse->_tkstart=t+1; | |
4661 | t++; | |
4662 | while(*t&&(isalnum(*t)||*t=='_')) | |
4663 | t++; | |
4664 | mypparse->_tkid=tktk_kdollarvariable; | |
4665 | } | |
4666 | } | |
4667 | else if(ISTEXT&&(*t==')')) | |
4668 | { | |
4669 | if(PARENMATCH) | |
4670 | { | |
4671 | t+=1, mypparse->_tkid=tktk_closeE, adms_slist_pull(&parenidx); | |
4672 | adms_slist_pull(&globalctxt); | |
4673 | } | |
4674 | else | |
4675 | t+=1, mypparse->_tkid=tktk_anytext; | |
4676 | paren--; | |
4677 | } | |
4678 | else | |
4679 | { | |
4680 | if(INSIDEPATH) | |
4681 | { | |
4682 | if(ISTEXT) while(*t&&(*t!=')')&&(*t!='\\0')&&(*t!='\%')&&(*t!='\\\\')&&(*t!='\$')&&(*t!='\\'')) | |
4683 | { | |
4684 | if(*t=='(') paren++; | |
4685 | t++; | |
4686 | } | |
4687 | else if(ISTIC) while(*t&&(*t!='\\0')&&(*t!='\%')&&(*t!='\\\\')&&(*t!='\$')&&(*t!='\\'')) | |
4688 | { | |
4689 | t++; | |
4690 | } | |
4691 | else | |
4692 | adms_message_fatal((\"%s:'%s' unexpected error in apath parser - please report to r29173\@users.sourceforge.net\\n\",adms_transform_uid(mypparse->_transform),mypparse->_value)) | |
4693 | } | |
4694 | else | |
4695 | { | |
4696 | if(ISTEXT) while(*t&&(*t!=')')&&(*t!='\\0')&&(*t!='\%')&&(*t!='\\\\')&&(*t!='\$')) | |
4697 | { | |
4698 | if(*t=='(') paren++; | |
4699 | t++; | |
4700 | } | |
4701 | else if(ISTIC) while(*t&&(*t!='\\0')&&(*t!='\%')&&(*t!='\\\\')&&(*t!='\$')) | |
4702 | { | |
4703 | t++; | |
4704 | } | |
4705 | else | |
4706 | adms_message_fatal((\"%s:'%s' unexpected error in apath parser - please report to r29173\@users.sourceforge.net\\n\",adms_transform_uid(mypparse->_transform),mypparse->_value)) | |
4707 | } | |
4708 | mypparse->_tkid=tktk_anytext; | |
4709 | } | |
4710 | mypparse->_tklen=(int)(long)(t-mypparse->_tkstart); | |
4711 | return t; | |
4712 | } | |
4713 | static int admstpathlex (p_pparse mypparse) | |
4714 | { | |
4715 | const char* t=mypparse->_position; | |
4716 | const char* tstart; | |
4717 | if(*t=='\\0') | |
4718 | return 0; | |
4719 | if(goto_atext) | |
4720 | { | |
4721 | goto_atext=0; | |
4722 | return tktk_goto_atext; | |
4723 | } | |
4724 | "; | |
4725 | map {print admstpathYacc_y " while(".xvalue($_).") t++;\n";} $admstpathxml->findnodes("//ignore"); | |
4726 | print admstpathYacc_y " tstart=t; | |
4727 | if(!strncmp(t,\"\\\'%p\\'\",4)&&!isalpha(*(t+4))) | |
4728 | t+=4, mypparse->_tkid=tktk_ticptr; | |
4729 | else if(!ISPATH) | |
4730 | t=tparsecb(mypparse); | |
4731 | "; | |
4732 | foreach($admstpathxml->findnodes("//constant|//regexp")) | |
4733 | { | |
4734 | if($_->nodeName eq "regexp") | |
4735 | { | |
4736 | print admstpathYacc_y $_->textContent; | |
4737 | } | |
4738 | elsif(xvalue($_)=~/\w$/) | |
4739 | { | |
4740 | my$len=length(xvalue($_)); | |
4741 | print admstpathYacc_y " else if(!strncmp(t,\"".xvalue($_)."\",$len)&&!isalpha(*(t+$len)))\n"; | |
4742 | print admstpathYacc_y " t+=$len, mypparse->_tkid=tktk_".xid($_).";\n"; | |
4743 | } | |
4744 | else | |
4745 | { | |
4746 | my$len=length(xvalue($_)); | |
4747 | print admstpathYacc_y " else if(!strncmp(t,\"".xvalue($_)."\",$len))\n"; | |
4748 | print admstpathYacc_y " t+=$len, mypparse->_tkid=tktk_".xid($_).";\n"; | |
4749 | } | |
4750 | } | |
4751 | print admstpathYacc_y " else | |
4752 | { | |
4753 | if(*t=='\\0') | |
4754 | return 0; | |
4755 | adms_message_fatal((\"%s: invalid path - unexpected character: %s\\n\", | |
4756 | adms_transform_uid(mypparse->_transform), | |
4757 | mypparse->_value)) | |
4758 | } | |
4759 | mypparse->_position=t; | |
4760 | return mypparse->_tkid; | |
4761 | } | |
4765 | 4762 | p_path pparse (p_transform mytransform,const char* aname,const char* avalue) |
4766 | 4763 | { |
4767 | 4764 | p_path mypath; |